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