Commit | Line | Data |
---|---|---|
d373b0dc | 1 | /* |
1810611d | 2 | * Copyright (c) 1982, 1986 Regents of the University of California. |
da7c5cc6 KM |
3 | * All rights reserved. The Berkeley software License Agreement |
4 | * specifies the terms and conditions for redistribution. | |
5 | * | |
dde10e18 | 6 | * @(#)ioctl.h 7.4 (Berkeley) %G% |
da7c5cc6 KM |
7 | */ |
8 | ||
b9c8e1f1 | 9 | /* |
e4858c2b | 10 | * Ioctl definitions |
d373b0dc BJ |
11 | */ |
12 | #ifndef _IOCTL_ | |
13 | #define _IOCTL_ | |
e4858c2b | 14 | #ifdef KERNEL |
88fc1c0a JB |
15 | #include "ttychars.h" |
16 | #include "ttydev.h" | |
e4858c2b SL |
17 | #else |
18 | #include <sys/ttychars.h> | |
19 | #include <sys/ttydev.h> | |
20 | #endif | |
21 | ||
d373b0dc BJ |
22 | struct tchars { |
23 | char t_intrc; /* interrupt */ | |
24 | char t_quitc; /* quit */ | |
25 | char t_startc; /* start output */ | |
26 | char t_stopc; /* stop output */ | |
27 | char t_eofc; /* end-of-file */ | |
28 | char t_brkc; /* input delimiter (like nl) */ | |
29 | }; | |
30 | struct ltchars { | |
31 | char t_suspc; /* stop process signal */ | |
a5ad116d | 32 | char t_dsuspc; /* delayed stop process signal */ |
d373b0dc BJ |
33 | char t_rprntc; /* reprint line */ |
34 | char t_flushc; /* flush output (toggles) */ | |
35 | char t_werasc; /* word erase */ | |
36 | char t_lnextc; /* literal next character */ | |
d373b0dc | 37 | }; |
35820102 | 38 | |
1d568305 MK |
39 | /* |
40 | * Structure for TIOCGETP and TIOCSETP ioctls. | |
41 | */ | |
42 | ||
43 | #ifndef _SGTTYB_ | |
44 | #define _SGTTYB_ | |
45 | struct sgttyb { | |
46 | char sg_ispeed; /* input speed */ | |
47 | char sg_ospeed; /* output speed */ | |
48 | char sg_erase; /* erase character */ | |
49 | char sg_kill; /* kill character */ | |
50 | short sg_flags; /* mode flags */ | |
51 | }; | |
52 | #endif | |
53 | ||
22e2baa4 | 54 | /* |
728e1bdb MK |
55 | * Window/terminal size structure. |
56 | * This information is stored by the kernel | |
57 | * in order to provide a consistent interface, | |
58 | * but is not used by the kernel. | |
218e6c1f JB |
59 | * |
60 | * Type must be "unsigned short" so that types.h not required. | |
22e2baa4 JB |
61 | */ |
62 | struct winsize { | |
218e6c1f JB |
63 | unsigned short ws_row; /* rows, in characters */ |
64 | unsigned short ws_col; /* columns, in characters */ | |
65 | unsigned short ws_xpixel; /* horizontal size, pixels */ | |
66 | unsigned short ws_ypixel; /* vertical size, pixels */ | |
22e2baa4 JB |
67 | }; |
68 | ||
728e1bdb MK |
69 | /* |
70 | * Pun for SUN. | |
71 | */ | |
72 | struct ttysize { | |
218e6c1f JB |
73 | unsigned short ts_lines; |
74 | unsigned short ts_cols; | |
75 | unsigned short ts_xxx; | |
76 | unsigned short ts_yyy; | |
728e1bdb MK |
77 | }; |
78 | #define TIOCGSIZE TIOCGWINSZ | |
79 | #define TIOCSSIZE TIOCSWINSZ | |
80 | ||
16df015f | 81 | #ifndef _IO |
4b72e2f9 SL |
82 | /* |
83 | * Ioctl's have the command encoded in the lower word, | |
84 | * and the size of any in or out parameters in the upper | |
d410d77f MK |
85 | * word. The high 3 bits of the upper word are used |
86 | * to encode the in/out status of the parameter. | |
4b72e2f9 | 87 | */ |
d410d77f MK |
88 | #define IOCPARM_MASK 0x1fff /* parameter length, at most 13 bits */ |
89 | #define IOCPARM_LEN(x) (((x) >> 16) & IOCPARM_MASK) | |
90 | #define IOCPARM_MAX NBPG /* max size of ioctl, mult. of NBPG */ | |
4b72e2f9 SL |
91 | #define IOC_VOID 0x20000000 /* no parameters */ |
92 | #define IOC_OUT 0x40000000 /* copy out parameters */ | |
93 | #define IOC_IN 0x80000000 /* copy in parameters */ | |
94 | #define IOC_INOUT (IOC_IN|IOC_OUT) | |
d410d77f | 95 | #define IOC_DIRMASK 0xe0000000 /* mask for IN/OUT/VOID */ |
4b72e2f9 SL |
96 | /* the 0x20000000 is so we can distinguish new ioctl's from old */ |
97 | #define _IO(x,y) (IOC_VOID|('x'<<8)|y) | |
98 | #define _IOR(x,y,t) (IOC_OUT|((sizeof(t)&IOCPARM_MASK)<<16)|('x'<<8)|y) | |
99 | #define _IOW(x,y,t) (IOC_IN|((sizeof(t)&IOCPARM_MASK)<<16)|('x'<<8)|y) | |
100 | /* this should be _IORW, but stdio got there first */ | |
101 | #define _IOWR(x,y,t) (IOC_INOUT|((sizeof(t)&IOCPARM_MASK)<<16)|('x'<<8)|y) | |
16df015f | 102 | #endif |
4b72e2f9 | 103 | |
d373b0dc BJ |
104 | /* |
105 | * tty ioctl commands | |
106 | */ | |
4b72e2f9 SL |
107 | #define TIOCGETD _IOR(t, 0, int) /* get line discipline */ |
108 | #define TIOCSETD _IOW(t, 1, int) /* set line discipline */ | |
109 | #define TIOCHPCL _IO(t, 2) /* hang up on last close */ | |
110 | #define TIOCMODG _IOR(t, 3, int) /* get modem control state */ | |
111 | #define TIOCMODS _IOW(t, 4, int) /* set modem control state */ | |
e4858c2b SL |
112 | #define TIOCM_LE 0001 /* line enable */ |
113 | #define TIOCM_DTR 0002 /* data terminal ready */ | |
114 | #define TIOCM_RTS 0004 /* request to send */ | |
115 | #define TIOCM_ST 0010 /* secondary transmit */ | |
116 | #define TIOCM_SR 0020 /* secondary receive */ | |
117 | #define TIOCM_CTS 0040 /* clear to send */ | |
118 | #define TIOCM_CAR 0100 /* carrier detect */ | |
119 | #define TIOCM_CD TIOCM_CAR | |
120 | #define TIOCM_RNG 0200 /* ring */ | |
121 | #define TIOCM_RI TIOCM_RNG | |
122 | #define TIOCM_DSR 0400 /* data set ready */ | |
4b72e2f9 SL |
123 | #define TIOCGETP _IOR(t, 8,struct sgttyb)/* get parameters -- gtty */ |
124 | #define TIOCSETP _IOW(t, 9,struct sgttyb)/* set parameters -- stty */ | |
125 | #define TIOCSETN _IOW(t,10,struct sgttyb)/* as above, but no flushtty */ | |
126 | #define TIOCEXCL _IO(t, 13) /* set exclusive use of tty */ | |
127 | #define TIOCNXCL _IO(t, 14) /* reset exclusive use of tty */ | |
128 | #define TIOCFLUSH _IOW(t, 16, int) /* flush buffers */ | |
129 | #define TIOCSETC _IOW(t,17,struct tchars)/* set special characters */ | |
130 | #define TIOCGETC _IOR(t,18,struct tchars)/* get special characters */ | |
e4858c2b SL |
131 | #define TANDEM 0x00000001 /* send stopc on out q full */ |
132 | #define CBREAK 0x00000002 /* half-cooked mode */ | |
133 | #define LCASE 0x00000004 /* simulate lower case */ | |
134 | #define ECHO 0x00000008 /* echo input */ | |
135 | #define CRMOD 0x00000010 /* map \r to \r\n on output */ | |
136 | #define RAW 0x00000020 /* no i/o processing */ | |
137 | #define ODDP 0x00000040 /* get/send odd parity */ | |
138 | #define EVENP 0x00000080 /* get/send even parity */ | |
139 | #define ANYP 0x000000c0 /* get any parity/send none */ | |
140 | #define NLDELAY 0x00000300 /* \n delay */ | |
141 | #define NL0 0x00000000 | |
142 | #define NL1 0x00000100 /* tty 37 */ | |
143 | #define NL2 0x00000200 /* vt05 */ | |
144 | #define NL3 0x00000300 | |
145 | #define TBDELAY 0x00000c00 /* horizontal tab delay */ | |
146 | #define TAB0 0x00000000 | |
147 | #define TAB1 0x00000400 /* tty 37 */ | |
148 | #define TAB2 0x00000800 | |
149 | #define XTABS 0x00000c00 /* expand tabs on output */ | |
150 | #define CRDELAY 0x00003000 /* \r delay */ | |
151 | #define CR0 0x00000000 | |
152 | #define CR1 0x00001000 /* tn 300 */ | |
153 | #define CR2 0x00002000 /* tty 37 */ | |
154 | #define CR3 0x00003000 /* concept 100 */ | |
155 | #define VTDELAY 0x00004000 /* vertical tab delay */ | |
156 | #define FF0 0x00000000 | |
157 | #define FF1 0x00004000 /* tty 37 */ | |
158 | #define BSDELAY 0x00008000 /* \b delay */ | |
159 | #define BS0 0x00000000 | |
160 | #define BS1 0x00008000 | |
728e1bdb | 161 | #define ALLDELAY (NLDELAY|TBDELAY|CRDELAY|VTDELAY|BSDELAY) |
e4858c2b SL |
162 | #define CRTBS 0x00010000 /* do backspacing for crt */ |
163 | #define PRTERA 0x00020000 /* \ ... / erase */ | |
164 | #define CRTERA 0x00040000 /* " \b " to wipe out char */ | |
165 | #define TILDE 0x00080000 /* hazeltine tilde kludge */ | |
166 | #define MDMBUF 0x00100000 /* start/stop output on carrier intr */ | |
167 | #define LITOUT 0x00200000 /* literal output */ | |
168 | #define TOSTOP 0x00400000 /* SIGSTOP on background output */ | |
169 | #define FLUSHO 0x00800000 /* flush output to terminal */ | |
170 | #define NOHANG 0x01000000 /* no SIGHUP on carrier drop */ | |
171 | #define L001000 0x02000000 | |
172 | #define CRTKIL 0x04000000 /* kill line with " \b " */ | |
fb01874e | 173 | #define PASS8 0x08000000 |
e4858c2b SL |
174 | #define CTLECH 0x10000000 /* echo control chars as ^X */ |
175 | #define PENDIN 0x20000000 /* tp->t_rawq needs reread */ | |
176 | #define DECCTQ 0x40000000 /* only ^Q starts after ^S */ | |
177 | #define NOFLSH 0x80000000 /* no output flush on signal */ | |
f68336af | 178 | /* locals, from 127 down */ |
f68336af SL |
179 | #define TIOCLBIS _IOW(t, 127, int) /* bis local mode bits */ |
180 | #define TIOCLBIC _IOW(t, 126, int) /* bic local mode bits */ | |
181 | #define TIOCLSET _IOW(t, 125, int) /* set entire local mode word */ | |
182 | #define TIOCLGET _IOR(t, 124, int) /* get local modes */ | |
183 | #define LCRTBS (CRTBS>>16) | |
184 | #define LPRTERA (PRTERA>>16) | |
185 | #define LCRTERA (CRTERA>>16) | |
186 | #define LTILDE (TILDE>>16) | |
187 | #define LMDMBUF (MDMBUF>>16) | |
188 | #define LLITOUT (LITOUT>>16) | |
189 | #define LTOSTOP (TOSTOP>>16) | |
190 | #define LFLUSHO (FLUSHO>>16) | |
191 | #define LNOHANG (NOHANG>>16) | |
192 | #define LCRTKIL (CRTKIL>>16) | |
fb01874e | 193 | #define LPASS8 (PASS8>>16) |
f68336af SL |
194 | #define LCTLECH (CTLECH>>16) |
195 | #define LPENDIN (PENDIN>>16) | |
196 | #define LDECCTQ (DECCTQ>>16) | |
197 | #define LNOFLSH (NOFLSH>>16) | |
f68336af SL |
198 | #define TIOCSBRK _IO(t, 123) /* set break bit */ |
199 | #define TIOCCBRK _IO(t, 122) /* clear break bit */ | |
200 | #define TIOCSDTR _IO(t, 121) /* set data terminal ready */ | |
201 | #define TIOCCDTR _IO(t, 120) /* clear data terminal ready */ | |
202 | #define TIOCGPGRP _IOR(t, 119, int) /* get pgrp of tty */ | |
203 | #define TIOCSPGRP _IOW(t, 118, int) /* set pgrp of tty */ | |
204 | #define TIOCSLTC _IOW(t,117,struct ltchars)/* set local special chars */ | |
205 | #define TIOCGLTC _IOR(t,116,struct ltchars)/* get local special chars */ | |
8b008a4e | 206 | #define TIOCOUTQ _IOR(t, 115, int) /* output queue size */ |
f68336af SL |
207 | #define TIOCSTI _IOW(t, 114, char) /* simulate terminal input */ |
208 | #define TIOCNOTTY _IO(t, 113) /* void tty association */ | |
209 | #define TIOCPKT _IOW(t, 112, int) /* pty: set/clear packet mode */ | |
210 | #define TIOCPKT_DATA 0x00 /* data packet */ | |
211 | #define TIOCPKT_FLUSHREAD 0x01 /* flush packet */ | |
212 | #define TIOCPKT_FLUSHWRITE 0x02 /* flush packet */ | |
213 | #define TIOCPKT_STOP 0x04 /* stop output */ | |
214 | #define TIOCPKT_START 0x08 /* start output */ | |
215 | #define TIOCPKT_NOSTOP 0x10 /* no more ^S, ^Q */ | |
216 | #define TIOCPKT_DOSTOP 0x20 /* now do ^S ^Q */ | |
217 | #define TIOCSTOP _IO(t, 111) /* stop output, like ^S */ | |
218 | #define TIOCSTART _IO(t, 110) /* start output, like ^Q */ | |
219 | #define TIOCMSET _IOW(t, 109, int) /* set all modem bits */ | |
220 | #define TIOCMBIS _IOW(t, 108, int) /* bis modem bits */ | |
221 | #define TIOCMBIC _IOW(t, 107, int) /* bic modem bits */ | |
222 | #define TIOCMGET _IOR(t, 106, int) /* get all modem bits */ | |
559d4544 | 223 | #define TIOCREMOTE _IOW(t, 105, int) /* remote input editing */ |
728e1bdb MK |
224 | #define TIOCGWINSZ _IOR(t, 104, struct winsize) /* get window size */ |
225 | #define TIOCSWINSZ _IOW(t, 103, struct winsize) /* set window size */ | |
226 | #define TIOCUCNTL _IOW(t, 102, int) /* pty: set/clr usr cntl mode */ | |
f43102f9 | 227 | #define UIOCCMD(n) _IO(u, n) /* usr cntl op "n" */ |
5c416ee2 | 228 | #define TIOCCONS _IO(t, 102) /* become virtual console */ |
d373b0dc | 229 | |
150e6005 | 230 | #define OTTYDISC 0 /* old, v7 std tty driver */ |
d373b0dc | 231 | #define NETLDISC 1 /* line discip for berk net */ |
150e6005 | 232 | #define NTTYDISC 2 /* new tty discipline */ |
23a45435 | 233 | #define TABLDISC 3 /* tablet discipline */ |
6b5b71ed | 234 | #define SLIPDISC 4 /* serial IP discipline */ |
d373b0dc | 235 | |
dde10e18 KM |
236 | #define FIOCLEX _IO(f, 1) /* set close on exec on fd */ |
237 | #define FIONCLEX _IO(f, 2) /* remove close on exec */ | |
d373b0dc | 238 | /* another local */ |
4b72e2f9 SL |
239 | #define FIONREAD _IOR(f, 127, int) /* get # bytes to read */ |
240 | #define FIONBIO _IOW(f, 126, int) /* set/clear non-blocking i/o */ | |
241 | #define FIOASYNC _IOW(f, 125, int) /* set/clear async i/o */ | |
10e4a6a4 SL |
242 | #define FIOSETOWN _IOW(f, 124, int) /* set owner */ |
243 | #define FIOGETOWN _IOR(f, 123, int) /* get owner */ | |
b335e111 | 244 | |
4b72e2f9 | 245 | /* socket i/o controls */ |
a4e0b3c8 SL |
246 | #define SIOCSHIWAT _IOW(s, 0, int) /* set high watermark */ |
247 | #define SIOCGHIWAT _IOR(s, 1, int) /* get high watermark */ | |
248 | #define SIOCSLOWAT _IOW(s, 2, int) /* set low watermark */ | |
249 | #define SIOCGLOWAT _IOR(s, 3, int) /* get low watermark */ | |
250 | #define SIOCATMARK _IOR(s, 7, int) /* at oob mark? */ | |
251 | #define SIOCSPGRP _IOW(s, 8, int) /* set process group */ | |
252 | #define SIOCGPGRP _IOR(s, 9, int) /* get process group */ | |
1116b929 SL |
253 | |
254 | #define SIOCADDRT _IOW(r, 10, struct rtentry) /* add route */ | |
255 | #define SIOCDELRT _IOW(r, 11, struct rtentry) /* delete route */ | |
256 | ||
257 | #define SIOCSIFADDR _IOW(i, 12, struct ifreq) /* set ifnet address */ | |
258 | #define SIOCGIFADDR _IOWR(i,13, struct ifreq) /* get ifnet address */ | |
259 | #define SIOCSIFDSTADDR _IOW(i, 14, struct ifreq) /* set p-p address */ | |
260 | #define SIOCGIFDSTADDR _IOWR(i,15, struct ifreq) /* get p-p address */ | |
261 | #define SIOCSIFFLAGS _IOW(i, 16, struct ifreq) /* set ifnet flags */ | |
262 | #define SIOCGIFFLAGS _IOWR(i,17, struct ifreq) /* get ifnet flags */ | |
9bf79906 | 263 | #define SIOCGIFBRDADDR _IOWR(i,18, struct ifreq) /* get broadcast addr */ |
115e5722 | 264 | #define SIOCSIFBRDADDR _IOW(i,19, struct ifreq) /* set broadcast addr */ |
1116b929 | 265 | #define SIOCGIFCONF _IOWR(i,20, struct ifconf) /* get ifnet list */ |
115e5722 MK |
266 | #define SIOCGIFNETMASK _IOWR(i,21, struct ifreq) /* get net addr mask */ |
267 | #define SIOCSIFNETMASK _IOW(i,22, struct ifreq) /* set net addr mask */ | |
35b428f7 MK |
268 | #define SIOCGIFMETRIC _IOWR(i,23, struct ifreq) /* get IF metric */ |
269 | #define SIOCSIFMETRIC _IOW(i,24, struct ifreq) /* set IF metric */ | |
47208c5b MK |
270 | |
271 | #define SIOCSARP _IOW(i, 30, struct arpreq) /* set arp entry */ | |
9bf79906 | 272 | #define SIOCGARP _IOWR(i,31, struct arpreq) /* get arp entry */ |
47208c5b | 273 | #define SIOCDARP _IOW(i, 32, struct arpreq) /* delete arp entry */ |
eadcfc1e | 274 | |
d373b0dc | 275 | #endif |