]> git.ipfire.org Git - thirdparty/glibc.git/blob - sysdeps/unix/bsd/bsd4.4/ioctls.h
initial import
[thirdparty/glibc.git] / sysdeps / unix / bsd / bsd4.4 / ioctls.h
1 /*-
2 * Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. All advertising materials mentioning features or use of this software
14 * must display the following acknowledgement:
15 * This product includes software developed by the University of
16 * California, Berkeley and its contributors.
17 * 4. Neither the name of the University nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * @(#)ioctl.h 7.19 (Berkeley) 6/26/91
34 */
35
36 #ifndef _IOCTLS_H_
37 #define _IOCTLS_H_
38
39 #define TIOCGSIZE TIOCGWINSZ
40 #define TIOCSSIZE TIOCSWINSZ
41
42 /*
43 * Ioctl's have the command encoded in the lower word, and the size of
44 * any in or out parameters in the upper word. The high 3 bits of the
45 * upper word are used to encode the in/out status of the parameter.
46 */
47 #define IOCPARM_MASK 0x1fff /* parameter length, at most 13 bits */
48 #define IOCPARM_LEN(x) (((x) >> 16) & IOCPARM_MASK)
49 #define IOCBASECMD(x) ((x) & ~IOCPARM_MASK)
50 #define IOCGROUP(x) (((x) >> 8) & 0xff)
51
52 #define IOCPARM_MAX NBPG /* max size of ioctl, mult. of NBPG */
53 #define IOC_VOID 0x20000000 /* no parameters */
54 #define IOC_OUT 0x40000000 /* copy out parameters */
55 #define IOC_IN 0x80000000 /* copy in parameters */
56 #define IOC_INOUT (IOC_IN|IOC_OUT)
57 #define IOC_DIRMASK 0xe0000000 /* mask for IN/OUT/VOID */
58
59 #define _IOC(inout,group,num,len) \
60 (inout | ((len & IOCPARM_MASK) << 16) | ((group) << 8) | (num))
61 #define _IO(g,n) _IOC(IOC_VOID, (g), (n), 0)
62 #define _IOR(g,n,t) _IOC(IOC_OUT, (g), (n), sizeof(t))
63 #define _IOW(g,n,t) _IOC(IOC_IN, (g), (n), sizeof(t))
64 /* this should be _IORW, but stdio got there first */
65 #define _IOWR(g,n,t) _IOC(IOC_INOUT, (g), (n), sizeof(t))
66
67 #define TIOCMODG _IOR('t', 3, int) /* get modem control state */
68 #define TIOCMODS _IOW('t', 4, int) /* set modem control state */
69 #define TIOCM_LE 0001 /* line enable */
70 #define TIOCM_DTR 0002 /* data terminal ready */
71 #define TIOCM_RTS 0004 /* request to send */
72 #define TIOCM_ST 0010 /* secondary transmit */
73 #define TIOCM_SR 0020 /* secondary receive */
74 #define TIOCM_CTS 0040 /* clear to send */
75 #define TIOCM_CAR 0100 /* carrier detect */
76 #define TIOCM_CD TIOCM_CAR
77 #define TIOCM_RNG 0200 /* ring */
78 #define TIOCM_RI TIOCM_RNG
79 #define TIOCM_DSR 0400 /* data set ready */
80 /* 8-10 compat */
81 #define TIOCEXCL _IO('t', 13) /* set exclusive use of tty */
82 #define TIOCNXCL _IO('t', 14) /* reset exclusive use of tty */
83 /* 15 unused */
84 #define TIOCFLUSH _IOW('t', 16, int) /* flush buffers */
85 /* 17-18 compat */
86 #define TIOCGETA _IOR('t', 19, struct termios) /* get termios struct */
87 #define TIOCSETA _IOW('t', 20, struct termios) /* set termios struct */
88 #define TIOCSETAW _IOW('t', 21, struct termios) /* drain output, set */
89 #define TIOCSETAF _IOW('t', 22, struct termios) /* drn out, fls in, set */
90 #define TIOCGETD _IOR('t', 26, int) /* get line discipline */
91 #define TIOCSETD _IOW('t', 27, int) /* set line discipline */
92 /* 127-124 compat */
93 #define TIOCSBRK _IO('t', 123) /* set break bit */
94 #define TIOCCBRK _IO('t', 122) /* clear break bit */
95 #define TIOCSDTR _IO('t', 121) /* set data terminal ready */
96 #define TIOCCDTR _IO('t', 120) /* clear data terminal ready */
97 #define TIOCGPGRP _IOR('t', 119, int) /* get pgrp of tty */
98 #define TIOCSPGRP _IOW('t', 118, int) /* set pgrp of tty */
99 /* 117-116 compat */
100 #define TIOCOUTQ _IOR('t', 115, int) /* output queue size */
101 #define TIOCSTI _IOW('t', 114, char) /* simulate terminal input */
102 #define TIOCNOTTY _IO('t', 113) /* void tty association */
103 #define TIOCPKT _IOW('t', 112, int) /* pty: set/clear packet mode */
104 #define TIOCPKT_DATA 0x00 /* data packet */
105 #define TIOCPKT_FLUSHREAD 0x01 /* flush packet */
106 #define TIOCPKT_FLUSHWRITE 0x02 /* flush packet */
107 #define TIOCPKT_STOP 0x04 /* stop output */
108 #define TIOCPKT_START 0x08 /* start output */
109 #define TIOCPKT_NOSTOP 0x10 /* no more ^S, ^Q */
110 #define TIOCPKT_DOSTOP 0x20 /* now do ^S ^Q */
111 #define TIOCPKT_IOCTL 0x40 /* state change of pty driver */
112 #define TIOCSTOP _IO('t', 111) /* stop output, like ^S */
113 #define TIOCSTART _IO('t', 110) /* start output, like ^Q */
114 #define TIOCMSET _IOW('t', 109, int) /* set all modem bits */
115 #define TIOCMBIS _IOW('t', 108, int) /* bis modem bits */
116 #define TIOCMBIC _IOW('t', 107, int) /* bic modem bits */
117 #define TIOCMGET _IOR('t', 106, int) /* get all modem bits */
118 #define TIOCREMOTE _IOW('t', 105, int) /* remote input editing */
119 #define TIOCGWINSZ _IOR('t', 104, struct winsize) /* get window size */
120 #define TIOCSWINSZ _IOW('t', 103, struct winsize) /* set window size */
121 #define TIOCUCNTL _IOW('t', 102, int) /* pty: set/clr usr cntl mode */
122 #define UIOCCMD(n) _IO('u', n) /* usr cntl op "n" */
123 #define TIOCCONS _IOW('t', 98, int) /* become virtual console */
124 #define TIOCSCTTY _IO('t', 97) /* become controlling tty */
125 #define TIOCEXT _IOW('t', 96, int) /* pty: external processing */
126 #define TIOCSIG _IO('t', 95) /* pty: generate signal */
127 #define TIOCDRAIN _IO('t', 94) /* wait till output drained */
128
129 #define TTYDISC 0 /* termios tty line discipline */
130 #define TABLDISC 3 /* tablet discipline */
131 #define SLIPDISC 4 /* serial IP discipline */
132
133
134 #define FIOCLEX _IO('f', 1) /* set close on exec on fd */
135 #define FIONCLEX _IO('f', 2) /* remove close on exec */
136 #define FIONREAD _IOR('f', 127, int) /* get # bytes to read */
137 #define FIONBIO _IOW('f', 126, int) /* set/clear non-blocking i/o */
138 #define FIOASYNC _IOW('f', 125, int) /* set/clear async i/o */
139 #define FIOSETOWN _IOW('f', 124, int) /* set owner */
140 #define FIOGETOWN _IOR('f', 123, int) /* get owner */
141
142 /* socket i/o controls */
143 #define SIOCSHIWAT _IOW('s', 0, int) /* set high watermark */
144 #define SIOCGHIWAT _IOR('s', 1, int) /* get high watermark */
145 #define SIOCSLOWAT _IOW('s', 2, int) /* set low watermark */
146 #define SIOCGLOWAT _IOR('s', 3, int) /* get low watermark */
147 #define SIOCATMARK _IOR('s', 7, int) /* at oob mark? */
148 #define SIOCSPGRP _IOW('s', 8, int) /* set process group */
149 #define SIOCGPGRP _IOR('s', 9, int) /* get process group */
150
151 #define SIOCADDRT _IOW('r', 10, struct ortentry) /* add route */
152 #define SIOCDELRT _IOW('r', 11, struct ortentry) /* delete route */
153
154 #define SIOCSIFADDR _IOW('i', 12, struct ifreq) /* set ifnet address */
155 #define OSIOCGIFADDR _IOWR('i',13, struct ifreq) /* get ifnet address */
156 #define SIOCGIFADDR _IOWR('i',33, struct ifreq) /* get ifnet address */
157 #define SIOCSIFDSTADDR _IOW('i', 14, struct ifreq) /* set p-p address */
158 #define OSIOCGIFDSTADDR _IOWR('i',15, struct ifreq) /* get p-p address */
159 #define SIOCGIFDSTADDR _IOWR('i',34, struct ifreq) /* get p-p address */
160 #define SIOCSIFFLAGS _IOW('i', 16, struct ifreq) /* set ifnet flags */
161 #define SIOCGIFFLAGS _IOWR('i',17, struct ifreq) /* get ifnet flags */
162 #define OSIOCGIFBRDADDR _IOWR('i',18, struct ifreq) /* get broadcast addr */
163 #define SIOCGIFBRDADDR _IOWR('i',35, struct ifreq) /* get broadcast addr */
164 #define SIOCSIFBRDADDR _IOW('i',19, struct ifreq) /* set broadcast addr */
165 #define OSIOCGIFCONF _IOWR('i',20, struct ifconf) /* get ifnet list */
166 #define SIOCGIFCONF _IOWR('i',36, struct ifconf) /* get ifnet list */
167 #define OSIOCGIFNETMASK _IOWR('i',21, struct ifreq) /* get net addr mask */
168 #define SIOCGIFNETMASK _IOWR('i',37, struct ifreq) /* get net addr mask */
169 #define SIOCSIFNETMASK _IOW('i',22, struct ifreq) /* set net addr mask */
170 #define SIOCGIFMETRIC _IOWR('i',23, struct ifreq) /* get IF metric */
171 #define SIOCSIFMETRIC _IOW('i',24, struct ifreq) /* set IF metric */
172 #define SIOCDIFADDR _IOW('i',25, struct ifreq) /* delete IF addr */
173 #define SIOCAIFADDR _IOW('i',26, struct ifaliasreq) /* add/chg IF alias */
174
175 #define SIOCSARP _IOW('i', 30, struct arpreq) /* set arp entry */
176 #define OSIOCGARP _IOWR('i',31, struct arpreq) /* get arp entry */
177 #define SIOCGARP _IOWR('i',38, struct arpreq) /* get arp entry */
178 #define SIOCDARP _IOW('i', 32, struct arpreq) /* delete arp entry */
179
180
181 /* Compatibility with 4.3 BSD terminal driver.
182 From 4.4 <sys/ioctl_compat.h>. */
183
184 #ifdef USE_OLD_TTY
185 # undef TIOCGETD
186 # define TIOCGETD _IOR('t', 0, int) /* get line discipline */
187 # undef TIOCSETD
188 # define TIOCSETD _IOW('t', 1, int) /* set line discipline */
189 #else
190 # define OTIOCGETD _IOR('t', 0, int) /* get line discipline */
191 # define OTIOCSETD _IOW('t', 1, int) /* set line discipline */
192 #endif
193 #define TIOCHPCL _IO('t', 2) /* hang up on last close */
194 #define TIOCGETP _IOR('t', 8,struct sgttyb)/* get parameters -- gtty */
195 #define TIOCSETP _IOW('t', 9,struct sgttyb)/* set parameters -- stty */
196 #define TIOCSETN _IOW('t',10,struct sgttyb)/* as above, but no flushtty*/
197 #define TIOCSETC _IOW('t',17,struct tchars)/* set special characters */
198 #define TIOCGETC _IOR('t',18,struct tchars)/* get special characters */
199 #define TANDEM 0x00000001 /* send stopc on out q full */
200 #define CBREAK 0x00000002 /* half-cooked mode */
201 #define LCASE 0x00000004 /* simulate lower case */
202 #define ECHO 0x00000008 /* echo input */
203 #define CRMOD 0x00000010 /* map \r to \r\n on output */
204 #define RAW 0x00000020 /* no i/o processing */
205 #define ODDP 0x00000040 /* get/send odd parity */
206 #define EVENP 0x00000080 /* get/send even parity */
207 #define ANYP 0x000000c0 /* get any parity/send none */
208 #define NLDELAY 0x00000300 /* \n delay */
209 #define NL0 0x00000000
210 #define NL1 0x00000100 /* tty 37 */
211 #define NL2 0x00000200 /* vt05 */
212 #define NL3 0x00000300
213 #define TBDELAY 0x00000c00 /* horizontal tab delay */
214 #define TAB0 0x00000000
215 #define TAB1 0x00000400 /* tty 37 */
216 #define TAB2 0x00000800
217 #define XTABS 0x00000c00 /* expand tabs on output */
218 #define CRDELAY 0x00003000 /* \r delay */
219 #define CR0 0x00000000
220 #define CR1 0x00001000 /* tn 300 */
221 #define CR2 0x00002000 /* tty 37 */
222 #define CR3 0x00003000 /* concept 100 */
223 #define VTDELAY 0x00004000 /* vertical tab delay */
224 #define FF0 0x00000000
225 #define FF1 0x00004000 /* tty 37 */
226 #define BSDELAY 0x00008000 /* \b delay */
227 #define BS0 0x00000000
228 #define BS1 0x00008000
229 #define ALLDELAY (NLDELAY|TBDELAY|CRDELAY|VTDELAY|BSDELAY)
230 #define CRTBS 0x00010000 /* do backspacing for crt */
231 #define PRTERA 0x00020000 /* \ ... / erase */
232 #define CRTERA 0x00040000 /* " \b " to wipe out char */
233 #define TILDE 0x00080000 /* hazeltine tilde kludge */
234 #define MDMBUF 0x00100000 /*start/stop output on carrier*/
235 #define LITOUT 0x00200000 /* literal output */
236 #define TOSTOP 0x00400000 /*SIGSTOP on background output*/
237 #define FLUSHO 0x00800000 /* flush output to terminal */
238 #define NOHANG 0x01000000 /* (no-op) was no SIGHUP on carrier drop */
239 #define L001000 0x02000000
240 #define CRTKIL 0x04000000 /* kill line with " \b " */
241 #define PASS8 0x08000000
242 #define CTLECH 0x10000000 /* echo control chars as ^X */
243 #define PENDIN 0x20000000 /* tp->t_rawq needs reread */
244 #define DECCTQ 0x40000000 /* only ^Q starts after ^S */
245 #define NOFLSH 0x80000000 /* no output flush on signal */
246 #define TIOCLBIS _IOW('t', 127, int) /* bis local mode bits */
247 #define TIOCLBIC _IOW('t', 126, int) /* bic local mode bits */
248 #define TIOCLSET _IOW('t', 125, int) /* set entire local mode word */
249 #define TIOCLGET _IOR('t', 124, int) /* get local modes */
250 #define LCRTBS (CRTBS>>16)
251 #define LPRTERA (PRTERA>>16)
252 #define LCRTERA (CRTERA>>16)
253 #define LTILDE (TILDE>>16)
254 #define LMDMBUF (MDMBUF>>16)
255 #define LLITOUT (LITOUT>>16)
256 #define LTOSTOP (TOSTOP>>16)
257 #define LFLUSHO (FLUSHO>>16)
258 #define LNOHANG (NOHANG>>16)
259 #define LCRTKIL (CRTKIL>>16)
260 #define LPASS8 (PASS8>>16)
261 #define LCTLECH (CTLECH>>16)
262 #define LPENDIN (PENDIN>>16)
263 #define LDECCTQ (DECCTQ>>16)
264 #define LNOFLSH (NOFLSH>>16)
265 #define TIOCSLTC _IOW('t',117,struct ltchars)/* set local special chars*/
266 #define TIOCGLTC _IOR('t',116,struct ltchars)/* get local special chars*/
267 #define OTIOCCONS _IO('t', 98) /* for hp300 -- sans int arg */
268 #define OTTYDISC 0
269 #define NETLDISC 1
270 #define NTTYDISC 2
271
272 /* From 4.4 <sys/ttydev.h>. */
273 #ifdef USE_OLD_TTY
274 #define B0 0
275 #define B50 1
276 #define B75 2
277 #define B110 3
278 #define B134 4
279 #define B150 5
280 #define B200 6
281 #define B300 7
282 #define B600 8
283 #define B1200 9
284 #define B1800 10
285 #define B2400 11
286 #define B4800 12
287 #define B9600 13
288 #define EXTA 14
289 #define EXTB 15
290 #endif /* USE_OLD_TTY */
291
292 #endif /* !_IOCTLS_H_ */