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-2001 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.
32 #include <asm/ioctl.h>
35 compare(const void *a, const void *b)
37 unsigned long code1 = (unsigned long) a;
38 unsigned long code2 = ((struct_ioctlent *) b)->code;
39 return (code1 > code2) ? 1 : (code1 < code2) ? -1 : 0;
42 const struct_ioctlent *
43 ioctl_lookup(unsigned long code)
47 code &= (_IOC_NRMASK<<_IOC_NRSHIFT) | (_IOC_TYPEMASK<<_IOC_TYPESHIFT);
48 iop = bsearch((void*)code, ioctlent,
49 nioctlents, sizeof(ioctlent[0]), compare);
50 while (iop > ioctlent) {
52 if (iop->code != code) {
60 const struct_ioctlent *
61 ioctl_next_match(const struct_ioctlent *iop)
67 if (iop < ioctlent + nioctlents && iop->code == code)
73 ioctl_decode(struct tcb *tcp, long code, long arg)
75 switch ((code >> 8) & 0xff) {
76 #if defined(ALPHA) || defined(POWERPC)
77 case 'f': case 't': case 'T':
81 return term_ioctl(tcp, code, arg);
83 return sock_ioctl(tcp, code, arg);
85 return rtc_ioctl(tcp, code, arg);
88 return block_ioctl(tcp, code, arg);
91 return scsi_ioctl(tcp, code, arg);
94 return loop_ioctl(tcp, code, arg);
96 return mtd_ioctl(tcp, code, arg);
99 return ubi_ioctl(tcp, code, arg);
101 return ptp_ioctl(tcp, code, arg);
109 * Registry of ioctl characters, culled from
110 * @(#)ioccom.h 1.7 89/06/16 SMI; from UCB ioctl.h 7.1 6/4/86
112 * char file where defined notes
113 * ---- ------------------ -----
117 * M sundev/mcpcmd.h *overlap*
118 * M sys/modem.h *overlap*
120 * T sys/termio.h -no overlap-
121 * T sys/termios.h -no overlap-
124 * d sun/dkio.h -no overlap with sys/des.h-
125 * d sys/des.h (possible overlap)
126 * d vax/dkio.h (possible overlap)
127 * d vaxuba/rxreg.h (possible overlap)
129 * g sunwindow/win_ioctl.h -no overlap-
130 * g sunwindowdev/winioctl.c !no manifest constant! -no overlap-
131 * h sundev/hrc_common.h
132 * i sys/sockio.h *overlap*
133 * i vaxuba/ikreg.h *overlap*
135 * m sundev/msio.h (possible overlap)
136 * m sundev/msreg.h (possible overlap)
137 * m sys/mtio.h (possible overlap)
139 * p net/nit_buf.h (possible overlap)
140 * p net/nit_if.h (possible overlap)
141 * p net/nit_pf.h (possible overlap)
142 * p sundev/fpareg.h (possible overlap)
143 * p sys/sockio.h (possible overlap)
144 * p vaxuba/psreg.h (possible overlap)
148 * t sys/ttold.h (possible overlap)
149 * t sys/ttycom.h (possible overlap)
150 * v sundev/vuid_event.h *overlap*
151 * v sys/vcmd.h *overlap*