Commit | Line | Data |
---|---|---|
15637ed4 RG |
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 | * | |
78ed81a3 | 33 | * from: @(#)ioctl.h 7.19 (Berkeley) 6/26/91 |
34 | * $Id$ | |
15637ed4 RG |
35 | */ |
36 | ||
37 | #ifndef _IOCTL_H_ | |
38 | #define _IOCTL_H_ | |
39 | ||
40 | /* | |
41 | * Window/terminal size structure. This information is stored by the kernel | |
42 | * in order to provide a consistent interface, but is not used by the kernel. | |
43 | */ | |
44 | struct winsize { | |
45 | unsigned short ws_row; /* rows, in characters */ | |
46 | unsigned short ws_col; /* columns, in characters */ | |
47 | unsigned short ws_xpixel; /* horizontal size, pixels */ | |
48 | unsigned short ws_ypixel; /* vertical size, pixels */ | |
49 | }; | |
50 | ||
51 | /* | |
52 | * Pun for SUN. | |
53 | */ | |
54 | struct ttysize { | |
55 | unsigned short ts_lines; | |
56 | unsigned short ts_cols; | |
57 | unsigned short ts_xxx; | |
58 | unsigned short ts_yyy; | |
59 | }; | |
60 | #define TIOCGSIZE TIOCGWINSZ | |
61 | #define TIOCSSIZE TIOCSWINSZ | |
62 | ||
63 | /* | |
64 | * Ioctl's have the command encoded in the lower word, and the size of | |
65 | * any in or out parameters in the upper word. The high 3 bits of the | |
66 | * upper word are used to encode the in/out status of the parameter. | |
67 | */ | |
68 | #define IOCPARM_MASK 0x1fff /* parameter length, at most 13 bits */ | |
69 | #define IOCPARM_LEN(x) (((x) >> 16) & IOCPARM_MASK) | |
70 | #define IOCBASECMD(x) ((x) & ~IOCPARM_MASK) | |
71 | #define IOCGROUP(x) (((x) >> 8) & 0xff) | |
72 | ||
73 | #define IOCPARM_MAX NBPG /* max size of ioctl, mult. of NBPG */ | |
74 | #define IOC_VOID 0x20000000 /* no parameters */ | |
75 | #define IOC_OUT 0x40000000 /* copy out parameters */ | |
76 | #define IOC_IN 0x80000000 /* copy in parameters */ | |
77 | #define IOC_INOUT (IOC_IN|IOC_OUT) | |
78 | #define IOC_DIRMASK 0xe0000000 /* mask for IN/OUT/VOID */ | |
79 | ||
78ed81a3 | 80 | #define _IOC(inout,group,num,len) \ |
15637ed4 RG |
81 | (inout | ((len & IOCPARM_MASK) << 16) | ((group) << 8) | (num)) |
82 | #define _IO(g,n) _IOC(IOC_VOID, (g), (n), 0) | |
83 | #define _IOR(g,n,t) _IOC(IOC_OUT, (g), (n), sizeof(t)) | |
84 | #define _IOW(g,n,t) _IOC(IOC_IN, (g), (n), sizeof(t)) | |
85 | /* this should be _IORW, but stdio got there first */ | |
86 | #define _IOWR(g,n,t) _IOC(IOC_INOUT, (g), (n), sizeof(t)) | |
87 | ||
88 | #define TIOCMODG _IOR('t', 3, int) /* get modem control state */ | |
89 | #define TIOCMODS _IOW('t', 4, int) /* set modem control state */ | |
90 | #define TIOCM_LE 0001 /* line enable */ | |
91 | #define TIOCM_DTR 0002 /* data terminal ready */ | |
92 | #define TIOCM_RTS 0004 /* request to send */ | |
93 | #define TIOCM_ST 0010 /* secondary transmit */ | |
94 | #define TIOCM_SR 0020 /* secondary receive */ | |
95 | #define TIOCM_CTS 0040 /* clear to send */ | |
96 | #define TIOCM_CAR 0100 /* carrier detect */ | |
97 | #define TIOCM_CD TIOCM_CAR | |
98 | #define TIOCM_RNG 0200 /* ring */ | |
99 | #define TIOCM_RI TIOCM_RNG | |
100 | #define TIOCM_DSR 0400 /* data set ready */ | |
101 | /* 8-10 compat */ | |
102 | #define TIOCEXCL _IO('t', 13) /* set exclusive use of tty */ | |
103 | #define TIOCNXCL _IO('t', 14) /* reset exclusive use of tty */ | |
104 | /* 15 unused */ | |
105 | #define TIOCFLUSH _IOW('t', 16, int) /* flush buffers */ | |
106 | /* 17-18 compat */ | |
107 | #define TIOCGETA _IOR('t', 19, struct termios) /* get termios struct */ | |
108 | #define TIOCSETA _IOW('t', 20, struct termios) /* set termios struct */ | |
109 | #define TIOCSETAW _IOW('t', 21, struct termios) /* drain output, set */ | |
110 | #define TIOCSETAF _IOW('t', 22, struct termios) /* drn out, fls in, set */ | |
111 | #define TIOCGETD _IOR('t', 26, int) /* get line discipline */ | |
112 | #define TIOCSETD _IOW('t', 27, int) /* set line discipline */ | |
113 | /* 127-124 compat */ | |
114 | #define TIOCSBRK _IO('t', 123) /* set break bit */ | |
115 | #define TIOCCBRK _IO('t', 122) /* clear break bit */ | |
116 | #define TIOCSDTR _IO('t', 121) /* set data terminal ready */ | |
117 | #define TIOCCDTR _IO('t', 120) /* clear data terminal ready */ | |
118 | #define TIOCGPGRP _IOR('t', 119, int) /* get pgrp of tty */ | |
119 | #define TIOCSPGRP _IOW('t', 118, int) /* set pgrp of tty */ | |
120 | /* 117-116 compat */ | |
121 | #define TIOCOUTQ _IOR('t', 115, int) /* output queue size */ | |
122 | #define TIOCSTI _IOW('t', 114, char) /* simulate terminal input */ | |
123 | #define TIOCNOTTY _IO('t', 113) /* void tty association */ | |
124 | #define TIOCPKT _IOW('t', 112, int) /* pty: set/clear packet mode */ | |
125 | #define TIOCPKT_DATA 0x00 /* data packet */ | |
126 | #define TIOCPKT_FLUSHREAD 0x01 /* flush packet */ | |
127 | #define TIOCPKT_FLUSHWRITE 0x02 /* flush packet */ | |
128 | #define TIOCPKT_STOP 0x04 /* stop output */ | |
129 | #define TIOCPKT_START 0x08 /* start output */ | |
130 | #define TIOCPKT_NOSTOP 0x10 /* no more ^S, ^Q */ | |
131 | #define TIOCPKT_DOSTOP 0x20 /* now do ^S ^Q */ | |
132 | #define TIOCPKT_IOCTL 0x40 /* state change of pty driver */ | |
133 | #define TIOCSTOP _IO('t', 111) /* stop output, like ^S */ | |
134 | #define TIOCSTART _IO('t', 110) /* start output, like ^Q */ | |
135 | #define TIOCMSET _IOW('t', 109, int) /* set all modem bits */ | |
136 | #define TIOCMBIS _IOW('t', 108, int) /* bis modem bits */ | |
137 | #define TIOCMBIC _IOW('t', 107, int) /* bic modem bits */ | |
138 | #define TIOCMGET _IOR('t', 106, int) /* get all modem bits */ | |
139 | #define TIOCREMOTE _IOW('t', 105, int) /* remote input editing */ | |
140 | #define TIOCGWINSZ _IOR('t', 104, struct winsize) /* get window size */ | |
141 | #define TIOCSWINSZ _IOW('t', 103, struct winsize) /* set window size */ | |
142 | #define TIOCUCNTL _IOW('t', 102, int) /* pty: set/clr usr cntl mode */ | |
143 | #define UIOCCMD(n) _IO('u', n) /* usr cntl op "n" */ | |
78ed81a3 | 144 | #define TIOCSTAT _IOW('t', 101, int) /* generate status message */ |
15637ed4 RG |
145 | #define TIOCCONS _IOW('t', 98, int) /* become virtual console */ |
146 | #define TIOCSCTTY _IO('t', 97) /* become controlling tty */ | |
147 | #define TIOCEXT _IOW('t', 96, int) /* pty: external processing */ | |
148 | #define TIOCSIG _IO('t', 95) /* pty: generate signal */ | |
78ed81a3 | 149 | #define TIOCDRAIN _IO('t', 94) /* wait till output drained */ |
150 | #define TIOCMSBIDIR _IOW('t', 93, int) /* modem: set bidir cap. */ | |
151 | #define TIOCMGBIDIR _IOR('t', 92, int) /* modem: get bidir cap. */ | |
152 | ||
153 | #define TTYDISC 0 /* termios tty line discipline */ | |
154 | #define NETLDISC 1 /* line discip for berk net */ | |
155 | #define NTTYDISC 2 /* new tty discipline */ | |
156 | #define TABLDISC 3 /* hitachi tablet discipline */ | |
15637ed4 | 157 | #define SLIPDISC 4 /* serial IP discipline */ |
78ed81a3 | 158 | #define PPPDISC 5 /* PPP discipline */ |
159 | #define MOUSELDISC 6 /* mouse discipline */ | |
160 | #define KBDLDISC 7 /* up/down keyboard trans (console) */ | |
161 | #define NTABLDISC 8 /* gtco tablet discipline */ | |
15637ed4 RG |
162 | |
163 | #define FIOCLEX _IO('f', 1) /* set close on exec on fd */ | |
164 | #define FIONCLEX _IO('f', 2) /* remove close on exec */ | |
165 | #define FIONREAD _IOR('f', 127, int) /* get # bytes to read */ | |
166 | #define FIONBIO _IOW('f', 126, int) /* set/clear non-blocking i/o */ | |
167 | #define FIOASYNC _IOW('f', 125, int) /* set/clear async i/o */ | |
168 | #define FIOSETOWN _IOW('f', 124, int) /* set owner */ | |
169 | #define FIOGETOWN _IOR('f', 123, int) /* get owner */ | |
170 | ||
171 | /* socket i/o controls */ | |
172 | #define SIOCSHIWAT _IOW('s', 0, int) /* set high watermark */ | |
173 | #define SIOCGHIWAT _IOR('s', 1, int) /* get high watermark */ | |
174 | #define SIOCSLOWAT _IOW('s', 2, int) /* set low watermark */ | |
175 | #define SIOCGLOWAT _IOR('s', 3, int) /* get low watermark */ | |
176 | #define SIOCATMARK _IOR('s', 7, int) /* at oob mark? */ | |
177 | #define SIOCSPGRP _IOW('s', 8, int) /* set process group */ | |
178 | #define SIOCGPGRP _IOR('s', 9, int) /* get process group */ | |
179 | ||
180 | #define SIOCADDRT _IOW('r', 10, struct ortentry) /* add route */ | |
181 | #define SIOCDELRT _IOW('r', 11, struct ortentry) /* delete route */ | |
182 | ||
183 | #define SIOCSIFADDR _IOW('i', 12, struct ifreq) /* set ifnet address */ | |
184 | #define OSIOCGIFADDR _IOWR('i',13, struct ifreq) /* get ifnet address */ | |
185 | #define SIOCGIFADDR _IOWR('i',33, struct ifreq) /* get ifnet address */ | |
186 | #define SIOCSIFDSTADDR _IOW('i', 14, struct ifreq) /* set p-p address */ | |
187 | #define OSIOCGIFDSTADDR _IOWR('i',15, struct ifreq) /* get p-p address */ | |
188 | #define SIOCGIFDSTADDR _IOWR('i',34, struct ifreq) /* get p-p address */ | |
189 | #define SIOCSIFFLAGS _IOW('i', 16, struct ifreq) /* set ifnet flags */ | |
190 | #define SIOCGIFFLAGS _IOWR('i',17, struct ifreq) /* get ifnet flags */ | |
191 | #define OSIOCGIFBRDADDR _IOWR('i',18, struct ifreq) /* get broadcast addr */ | |
192 | #define SIOCGIFBRDADDR _IOWR('i',35, struct ifreq) /* get broadcast addr */ | |
193 | #define SIOCSIFBRDADDR _IOW('i',19, struct ifreq) /* set broadcast addr */ | |
194 | #define OSIOCGIFCONF _IOWR('i',20, struct ifconf) /* get ifnet list */ | |
195 | #define SIOCGIFCONF _IOWR('i',36, struct ifconf) /* get ifnet list */ | |
196 | #define OSIOCGIFNETMASK _IOWR('i',21, struct ifreq) /* get net addr mask */ | |
197 | #define SIOCGIFNETMASK _IOWR('i',37, struct ifreq) /* get net addr mask */ | |
198 | #define SIOCSIFNETMASK _IOW('i',22, struct ifreq) /* set net addr mask */ | |
199 | #define SIOCGIFMETRIC _IOWR('i',23, struct ifreq) /* get IF metric */ | |
200 | #define SIOCSIFMETRIC _IOW('i',24, struct ifreq) /* set IF metric */ | |
201 | #define SIOCDIFADDR _IOW('i',25, struct ifreq) /* delete IF addr */ | |
202 | #define SIOCAIFADDR _IOW('i',26, struct ifaliasreq) /* add/chg IF alias */ | |
203 | ||
204 | #define SIOCSARP _IOW('i', 30, struct arpreq) /* set arp entry */ | |
205 | #define OSIOCGARP _IOWR('i',31, struct arpreq) /* get arp entry */ | |
206 | #define SIOCGARP _IOWR('i',38, struct arpreq) /* get arp entry */ | |
207 | #define SIOCDARP _IOW('i', 32, struct arpreq) /* delete arp entry */ | |
208 | ||
78ed81a3 | 209 | #define SIOCSIFMTU _IOW('i', 127, struct ifreq) /* set ifnet mtu */ |
210 | #define SIOCGIFMTU _IOWR('i',126, struct ifreq) /* get ifnet mtu */ | |
211 | #define SIOCSIFASYNCMAP _IOW('i', 125, struct ifreq) /* set ppp asyncmap */ | |
212 | #define SIOCGIFASYNCMAP _IOWR('i',124, struct ifreq) /* get ppp asyncmap */ | |
213 | ||
15637ed4 RG |
214 | #ifndef KERNEL |
215 | ||
216 | #include <sys/cdefs.h> | |
217 | ||
218 | __BEGIN_DECLS | |
219 | int ioctl __P((int, unsigned long, ...)); | |
220 | __END_DECLS | |
221 | ||
222 | #endif /* !KERNEL */ | |
223 | ||
224 | #endif /* !_IOCTL_H_ */ | |
225 | ||
226 | /* - note: keep outside _IOCTL_H_ | |
227 | * Compatability with old terminal driver | |
228 | * | |
229 | * Source level -> #define USE_OLD_TTY | |
230 | * Kernel level -> options COMPAT_43 | |
231 | */ | |
232 | #if defined(USE_OLD_TTY) || defined(COMPAT_43) | |
233 | #ifdef KERNEL | |
234 | #include "ioctl_compat.h" | |
235 | #else | |
236 | #include <sys/ioctl_compat.h> | |
237 | #endif | |
238 | #endif |