2 * Copyright (c) 1991, 1992 Paul Kranenburg <pk@cs.few.eur.nl>
3 * Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
4 * Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com>
5 * Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl>
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. The name of the author may not be used to endorse or promote products
17 * derived from this software without specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 struct ioctlent ioctlent0[] = {
37 * `ioctlent.h' may be generated from `ioctlent.raw' by the auxiliary
38 * program `ioctlsort', such that the list is sorted by the `code' field.
39 * This has the side-effect of resolving the _IO.. macros into
40 * plain integers, eliminating the need to include here everything
47 #include <asm/ioctl.h>
50 int nioctlents0 = sizeof ioctlent0 / sizeof ioctlent0[0];
52 #if SUPPORTED_PERSONALITIES >= 2
53 struct ioctlent ioctlent1[] = {
54 #include "ioctlent1.h"
57 int nioctlents1 = sizeof ioctlent1 / sizeof ioctlent1[0];
58 #endif /* SUPPORTED_PERSONALITIES >= 2 */
60 #if SUPPORTED_PERSONALITIES >= 3
61 struct ioctlent ioctlent2[] = {
62 #include "ioctlent2.h"
65 int nioctlents1 = sizeof ioctlent2 / sizeof ioctlent2[0];
66 #endif /* SUPPORTED_PERSONALITIES >= 3 */
68 struct ioctlent *ioctlent;
76 unsigned long code1 = ((struct ioctlent *) a)->code;
77 unsigned long code2 = ((struct ioctlent *) b)->code;
78 return (code1 > code2) ? 1 : (code1 < code2) ? -1 : 0;
85 struct ioctlent *iop, ioent;
89 ioent.code &= (_IOC_NRMASK<<_IOC_NRSHIFT) | (_IOC_TYPEMASK<<_IOC_TYPESHIFT);
91 iop = (struct ioctlent *) bsearch((char *) &ioent, (char *) ioctlent,
92 nioctlents, sizeof(struct ioctlent), compare);
93 return iop ? iop->symbol : NULL;
97 ioctl_decode(tcp, code, arg)
101 switch ((code >> 8) & 0xff) {
104 case 'f': case 't': case 'T':
109 case 'f': case 't': case 'T':
111 return term_ioctl(tcp, code, arg);
115 case 'r': case 's': case 'i':
120 return sock_ioctl(tcp, code, arg);
122 #ifndef HAVE_MP_PROCFS
128 return proc_ioctl(tcp, code, arg);
130 #endif /* USE_PROCFS */
131 #ifdef HAVE_SYS_STREAM_H
133 return stream_ioctl(tcp, code, arg);
134 #endif /* HAVE_SYS_STREAM_H */
142 * Registry of ioctl characters, culled from
143 * @(#)ioccom.h 1.7 89/06/16 SMI; from UCB ioctl.h 7.1 6/4/86
145 * char file where defined notes
146 * ---- ------------------ -----
150 * M sundev/mcpcmd.h *overlap*
151 * M sys/modem.h *overlap*
153 * T sys/termio.h -no overlap-
154 * T sys/termios.h -no overlap-
157 * d sun/dkio.h -no overlap with sys/des.h-
158 * d sys/des.h (possible overlap)
159 * d vax/dkio.h (possible overlap)
160 * d vaxuba/rxreg.h (possible overlap)
162 * g sunwindow/win_ioctl.h -no overlap-
163 * g sunwindowdev/winioctl.c !no manifest constant! -no overlap-
164 * h sundev/hrc_common.h
165 * i sys/sockio.h *overlap*
166 * i vaxuba/ikreg.h *overlap*
168 * m sundev/msio.h (possible overlap)
169 * m sundev/msreg.h (possible overlap)
170 * m sys/mtio.h (possible overlap)
172 * p net/nit_buf.h (possible overlap)
173 * p net/nit_if.h (possible overlap)
174 * p net/nit_pf.h (possible overlap)
175 * p sundev/fpareg.h (possible overlap)
176 * p sys/sockio.h (possible overlap)
177 * p vaxuba/psreg.h (possible overlap)
181 * t sys/ttold.h (possible overlap)
182 * t sys/ttycom.h (possible overlap)
183 * v sundev/vuid_event.h *overlap*
184 * v sys/vcmd.h *overlap*