ioctl_compat.h revision 1.6 1 1.6 cgd /*
2 1.6 cgd * Copyright (c) 1990 The Regents of the University of California.
3 1.6 cgd * All rights reserved.
4 1.6 cgd * (c) UNIX System Laboratories, Inc.
5 1.6 cgd * All or some portions of this file are derived from material licensed
6 1.6 cgd * to the University of California by American Telephone and Telegraph
7 1.6 cgd * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8 1.6 cgd * the permission of UNIX System Laboratories, Inc.
9 1.6 cgd *
10 1.6 cgd * Redistribution and use in source and binary forms, with or without
11 1.6 cgd * modification, are permitted provided that the following conditions
12 1.6 cgd * are met:
13 1.6 cgd * 1. Redistributions of source code must retain the above copyright
14 1.6 cgd * notice, this list of conditions and the following disclaimer.
15 1.6 cgd * 2. Redistributions in binary form must reproduce the above copyright
16 1.6 cgd * notice, this list of conditions and the following disclaimer in the
17 1.6 cgd * documentation and/or other materials provided with the distribution.
18 1.6 cgd * 3. All advertising materials mentioning features or use of this software
19 1.6 cgd * must display the following acknowledgement:
20 1.6 cgd * This product includes software developed by the University of
21 1.6 cgd * California, Berkeley and its contributors.
22 1.6 cgd * 4. Neither the name of the University nor the names of its contributors
23 1.6 cgd * may be used to endorse or promote products derived from this software
24 1.6 cgd * without specific prior written permission.
25 1.6 cgd *
26 1.6 cgd * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
27 1.6 cgd * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 1.6 cgd * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29 1.6 cgd * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
30 1.6 cgd * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31 1.6 cgd * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 1.6 cgd * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 1.6 cgd * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 1.6 cgd * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 1.6 cgd * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 1.6 cgd * SUCH DAMAGE.
37 1.6 cgd *
38 1.6 cgd * from: @(#)ioctl_compat.h 7.4 (Berkeley) 2/5/91
39 1.6 cgd * $Id: ioctl_compat.h,v 1.6 1994/05/17 04:25:02 cgd Exp $
40 1.6 cgd */
41 1.6 cgd
42 1.6 cgd #ifndef _SYS_IOCTL_COMPAT_H_
43 1.6 cgd #define _SYS_IOCTL_COMPAT_H_
44 1.6 cgd
45 1.6 cgd #include <sys/ttychars.h>
46 1.6 cgd #include <sys/ttydev.h>
47 1.6 cgd
48 1.6 cgd struct tchars {
49 1.6 cgd char t_intrc; /* interrupt */
50 1.6 cgd char t_quitc; /* quit */
51 1.6 cgd char t_startc; /* start output */
52 1.6 cgd char t_stopc; /* stop output */
53 1.6 cgd char t_eofc; /* end-of-file */
54 1.6 cgd char t_brkc; /* input delimiter (like nl) */
55 1.6 cgd };
56 1.6 cgd
57 1.6 cgd struct ltchars {
58 1.6 cgd char t_suspc; /* stop process signal */
59 1.6 cgd char t_dsuspc; /* delayed stop process signal */
60 1.6 cgd char t_rprntc; /* reprint line */
61 1.6 cgd char t_flushc; /* flush output (toggles) */
62 1.6 cgd char t_werasc; /* word erase */
63 1.6 cgd char t_lnextc; /* literal next character */
64 1.6 cgd };
65 1.6 cgd
66 1.6 cgd /*
67 1.6 cgd * Structure for TIOCGETP and TIOCSETP ioctls.
68 1.6 cgd */
69 1.6 cgd #ifndef _SGTTYB_
70 1.6 cgd #define _SGTTYB_
71 1.6 cgd struct sgttyb {
72 1.6 cgd char sg_ispeed; /* input speed */
73 1.6 cgd char sg_ospeed; /* output speed */
74 1.6 cgd char sg_erase; /* erase character */
75 1.6 cgd char sg_kill; /* kill character */
76 1.6 cgd short sg_flags; /* mode flags */
77 1.6 cgd };
78 1.6 cgd #endif
79 1.6 cgd
80 1.6 cgd #ifdef USE_OLD_TTY
81 1.6 cgd # undef TIOCGETD
82 1.6 cgd # define TIOCGETD _IOR('t', 0, int) /* get line discipline */
83 1.6 cgd # undef TIOCSETD
84 1.6 cgd # define TIOCSETD _IOW('t', 1, int) /* set line discipline */
85 1.6 cgd #else
86 1.6 cgd # define OTIOCGETD _IOR('t', 0, int) /* get line discipline */
87 1.6 cgd # define OTIOCSETD _IOW('t', 1, int) /* set line discipline */
88 1.6 cgd #endif
89 1.6 cgd #define TIOCHPCL _IO('t', 2) /* hang up on last close */
90 1.6 cgd #define TIOCGETP _IOR('t', 8,struct sgttyb)/* get parameters -- gtty */
91 1.6 cgd #define TIOCSETP _IOW('t', 9,struct sgttyb)/* set parameters -- stty */
92 1.6 cgd #define TIOCSETN _IOW('t',10,struct sgttyb)/* as above, but no flushtty*/
93 1.6 cgd #define TIOCSETC _IOW('t',17,struct tchars)/* set special characters */
94 1.6 cgd #define TIOCGETC _IOR('t',18,struct tchars)/* get special characters */
95 1.6 cgd #define TANDEM 0x00000001 /* send stopc on out q full */
96 1.6 cgd #define CBREAK 0x00000002 /* half-cooked mode */
97 1.6 cgd #define LCASE 0x00000004 /* simulate lower case */
98 1.6 cgd #define ECHO 0x00000008 /* echo input */
99 1.6 cgd #define CRMOD 0x00000010 /* map \r to \r\n on output */
100 1.6 cgd #define RAW 0x00000020 /* no i/o processing */
101 1.6 cgd #define ODDP 0x00000040 /* get/send odd parity */
102 1.6 cgd #define EVENP 0x00000080 /* get/send even parity */
103 1.6 cgd #define ANYP 0x000000c0 /* get any parity/send none */
104 1.6 cgd #define NLDELAY 0x00000300 /* \n delay */
105 1.6 cgd #define NL0 0x00000000
106 1.6 cgd #define NL1 0x00000100 /* tty 37 */
107 1.6 cgd #define NL2 0x00000200 /* vt05 */
108 1.6 cgd #define NL3 0x00000300
109 1.6 cgd #define TBDELAY 0x00000c00 /* horizontal tab delay */
110 1.6 cgd #define TAB0 0x00000000
111 1.6 cgd #define TAB1 0x00000400 /* tty 37 */
112 1.6 cgd #define TAB2 0x00000800
113 1.6 cgd #define XTABS 0x00000c00 /* expand tabs on output */
114 1.6 cgd #define CRDELAY 0x00003000 /* \r delay */
115 1.6 cgd #define CR0 0x00000000
116 1.6 cgd #define CR1 0x00001000 /* tn 300 */
117 1.6 cgd #define CR2 0x00002000 /* tty 37 */
118 1.6 cgd #define CR3 0x00003000 /* concept 100 */
119 1.6 cgd #define VTDELAY 0x00004000 /* vertical tab delay */
120 1.6 cgd #define FF0 0x00000000
121 1.6 cgd #define FF1 0x00004000 /* tty 37 */
122 1.6 cgd #define BSDELAY 0x00008000 /* \b delay */
123 1.6 cgd #define BS0 0x00000000
124 1.6 cgd #define BS1 0x00008000
125 1.6 cgd #define ALLDELAY (NLDELAY|TBDELAY|CRDELAY|VTDELAY|BSDELAY)
126 1.6 cgd #define CRTBS 0x00010000 /* do backspacing for crt */
127 1.6 cgd #define PRTERA 0x00020000 /* \ ... / erase */
128 1.6 cgd #define CRTERA 0x00040000 /* " \b " to wipe out char */
129 1.6 cgd #define TILDE 0x00080000 /* hazeltine tilde kludge */
130 1.6 cgd #define MDMBUF 0x00100000 /*start/stop output on carrier*/
131 1.6 cgd #define LITOUT 0x00200000 /* literal output */
132 1.6 cgd #define TOSTOP 0x00400000 /*SIGSTOP on background output*/
133 1.6 cgd #define FLUSHO 0x00800000 /* flush output to terminal */
134 1.6 cgd #define NOHANG 0x01000000 /* (no-op) was no SIGHUP on carrier drop */
135 1.6 cgd #define L001000 0x02000000
136 1.6 cgd #define CRTKIL 0x04000000 /* kill line with " \b " */
137 1.6 cgd #define PASS8 0x08000000
138 1.6 cgd #define CTLECH 0x10000000 /* echo control chars as ^X */
139 1.6 cgd #define PENDIN 0x20000000 /* tp->t_rawq needs reread */
140 1.6 cgd #define DECCTQ 0x40000000 /* only ^Q starts after ^S */
141 1.6 cgd #define NOFLSH 0x80000000 /* no output flush on signal */
142 1.6 cgd #define TIOCLBIS _IOW('t', 127, int) /* bis local mode bits */
143 1.6 cgd #define TIOCLBIC _IOW('t', 126, int) /* bic local mode bits */
144 1.6 cgd #define TIOCLSET _IOW('t', 125, int) /* set entire local mode word */
145 1.6 cgd #define TIOCLGET _IOR('t', 124, int) /* get local modes */
146 1.6 cgd #define LCRTBS (CRTBS>>16)
147 1.6 cgd #define LPRTERA (PRTERA>>16)
148 1.6 cgd #define LCRTERA (CRTERA>>16)
149 1.6 cgd #define LTILDE (TILDE>>16)
150 1.6 cgd #define LMDMBUF (MDMBUF>>16)
151 1.6 cgd #define LLITOUT (LITOUT>>16)
152 1.6 cgd #define LTOSTOP (TOSTOP>>16)
153 1.6 cgd #define LFLUSHO (FLUSHO>>16)
154 1.6 cgd #define LNOHANG (NOHANG>>16)
155 1.6 cgd #define LCRTKIL (CRTKIL>>16)
156 1.6 cgd #define LPASS8 (PASS8>>16)
157 1.6 cgd #define LCTLECH (CTLECH>>16)
158 1.6 cgd #define LPENDIN (PENDIN>>16)
159 1.6 cgd #define LDECCTQ (DECCTQ>>16)
160 1.6 cgd #define LNOFLSH (NOFLSH>>16)
161 1.6 cgd #define TIOCSLTC _IOW('t',117,struct ltchars)/* set local special chars*/
162 1.6 cgd #define TIOCGLTC _IOR('t',116,struct ltchars)/* get local special chars*/
163 1.6 cgd #define OTIOCCONS _IO('t', 98) /* for hp300 -- sans int arg */
164 1.6 cgd #define OTTYDISC 0
165 1.6 cgd #define NETLDISC 1
166 1.6 cgd #define NTTYDISC 2
167 1.6 cgd
168 1.6 cgd #define gtty(fd, tty) ioctl(fd, TIOCGETP, tty)
169 1.6 cgd #define stty(fd, tty) ioctl(fd, TIOCSETP, tty)
170 1.6 cgd
171 1.6 cgd #endif /* !_SYS_IOCTL_COMPAT_H_ */
172