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>
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. The name of the author may not be used to endorse or promote products
16 * derived from this software without specific prior written permission.
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 struct ioctlent ioctlent0[] = {
36 * `ioctlent.h' may be generated from `ioctlent.raw' by the auxiliary
37 * program `ioctlsort', such that the list is sorted by the `code' field.
38 * This has the side-effect of resolving the _IO.. macros into
39 * plain integers, eliminating the need to include here everything
45 int nioctlents0 = sizeof ioctlent0 / sizeof ioctlent0[0];
47 #if SUPPORTED_PERSONALITIES >= 2
48 struct ioctlent ioctlent1[] = {
49 #include "ioctlent1.h"
52 int nioctlents1 = sizeof ioctlent1 / sizeof ioctlent1[0];
53 #endif /* SUPPORTED_PERSONALITIES >= 2 */
55 #if SUPPORTED_PERSONALITIES >= 3
56 struct ioctlent ioctlent2[] = {
57 #include "ioctlent2.h"
60 int nioctlents1 = sizeof ioctlent2 / sizeof ioctlent2[0];
61 #endif /* SUPPORTED_PERSONALITIES >= 3 */
63 struct ioctlent *ioctlent;
71 unsigned long code1 = ((struct ioctlent *) a)->code;
72 unsigned long code2 = ((struct ioctlent *) b)->code;
73 return (code1 > code2) ? 1 : (code1 < code2) ? -1 : 0;
80 struct ioctlent *iop, ioent;
83 iop = (struct ioctlent *) bsearch((char *) &ioent, (char *) ioctlent,
84 nioctlents, sizeof(struct ioctlent), compare);
85 return iop ? iop->symbol : NULL;
89 ioctl_decode(tcp, code, arg)
93 switch ((code >> 8) & 0xff) {
96 case 'f': case 't': case 'T':
101 case 'f': case 't': case 'T':
103 return term_ioctl(tcp, code, arg);
107 case 'r': case 's': case 'i': case 'p':
109 return sock_ioctl(tcp, code, arg);
112 return proc_ioctl(tcp, code, arg);
114 #ifdef HAVE_SYS_STREAM_H
116 return stream_ioctl(tcp, code, arg);
117 #endif /* HAVE_SYS_STREAM_H */
125 * Registry of ioctl characters, culled from
126 * @(#)ioccom.h 1.7 89/06/16 SMI; from UCB ioctl.h 7.1 6/4/86
128 * char file where defined notes
129 * ---- ------------------ -----
133 * M sundev/mcpcmd.h *overlap*
134 * M sys/modem.h *overlap*
136 * T sys/termio.h -no overlap-
137 * T sys/termios.h -no overlap-
140 * d sun/dkio.h -no overlap with sys/des.h-
141 * d sys/des.h (possible overlap)
142 * d vax/dkio.h (possible overlap)
143 * d vaxuba/rxreg.h (possible overlap)
145 * g sunwindow/win_ioctl.h -no overlap-
146 * g sunwindowdev/winioctl.c !no manifest constant! -no overlap-
147 * h sundev/hrc_common.h
148 * i sys/sockio.h *overlap*
149 * i vaxuba/ikreg.h *overlap*
151 * m sundev/msio.h (possible overlap)
152 * m sundev/msreg.h (possible overlap)
153 * m sys/mtio.h (possible overlap)
155 * p net/nit_buf.h (possible overlap)
156 * p net/nit_if.h (possible overlap)
157 * p net/nit_pf.h (possible overlap)
158 * p sundev/fpareg.h (possible overlap)
159 * p sys/sockio.h (possible overlap)
160 * p vaxuba/psreg.h (possible overlap)
164 * t sys/ttold.h (possible overlap)
165 * t sys/ttycom.h (possible overlap)
166 * v sundev/vuid_event.h *overlap*
167 * v sys/vcmd.h *overlap*