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