1 /* $NetBSD: osf1_ioctl.c,v 1.21 2007/12/08 18:36:21 dsl Exp $ */
4 * Copyright (c) 1999 Christopher G. Demetriou. All rights reserved.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. All advertising materials mentioning features or use of this software
15 * must display the following acknowledgement:
16 * This product includes software developed by Christopher G. Demetriou
17 * for the NetBSD Project.
18 * 4. The name of the author may not be used to endorse or promote products
19 * derived from this software without specific prior written permission
21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 * Copyright (c) 1994, 1995 Carnegie-Mellon University.
35 * All rights reserved.
37 * Author: Chris G. Demetriou
39 * Permission to use, copy, modify and distribute this software and
40 * its documentation is hereby granted, provided that both the copyright
41 * notice and this permission notice appear in all copies of the
42 * software, derivative works or modified versions, and any portions
43 * thereof, and that both notices appear in supporting documentation.
45 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
46 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
47 * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
49 * Carnegie Mellon requests users of this software to return to
51 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
52 * School of Computer Science
53 * Carnegie Mellon University
54 * Pittsburgh PA 15213-3890
56 * any improvements or extensions that they make and grant Carnegie the
57 * rights to redistribute these changes.
60 #include <sys/cdefs.h>
61 __KERNEL_RCSID(0, "$NetBSD: osf1_ioctl.c,v 1.21 2007/12/08 18:36:21 dsl Exp $");
63 #if defined(_KERNEL_OPT)
64 #include "opt_compat_43.h"
65 #include "opt_syscall_debug.h"
68 #include <sys/param.h>
69 #include <sys/systm.h>
70 #include <sys/ioctl.h>
71 #include <sys/termios.h>
72 #include <sys/mount.h>
73 #include <sys/syscallargs.h>
75 #include <compat/osf1/osf1.h>
76 #include <compat/osf1/osf1_syscallargs.h>
82 static int osf1_ioctl_f(struct lwp
*l
, const struct sys_ioctl_args
*nuap
,
83 register_t
*retval
, int cmd
, int dir
, int len
);
84 static int osf1_ioctl_i(struct lwp
*l
, const struct sys_ioctl_args
*nuap
,
85 register_t
*retval
, int cmd
, int dir
, int len
);
86 static int osf1_ioctl_t(struct lwp
*l
, const struct sys_ioctl_args
*nuap
,
87 register_t
*retval
, int cmd
, int dir
, int len
);
90 osf1_sys_ioctl(struct lwp
*l
, const struct osf1_sys_ioctl_args
*uap
, register_t
*retval
)
92 struct sys_ioctl_args a
;
93 int op
, dir
, group
, cmd
, len
;
99 dir
= op
& OSF1_IOC_DIRMASK
;
100 group
= OSF1_IOCGROUP(op
);
101 cmd
= OSF1_IOCCMD(op
);
102 len
= OSF1_IOCPARM_LEN(op
);
136 "OSF/1 IOCTL: group = %c, cmd = %d, len = %d, dir = %s\n",
137 group
, cmd
, len
, dirstr
);
140 SCARG(&a
, fd
) = SCARG(uap
, fd
);
141 SCARG(&a
, com
) = SCARG(uap
, com
) & 0xffffffff; /* XXX */
142 SCARG(&a
, data
) = SCARG(uap
, data
);
145 return osf1_ioctl_f(l
, &a
, retval
, cmd
, dir
, len
);
147 return osf1_ioctl_i(l
, &a
, retval
, cmd
, dir
, len
);
149 return osf1_ioctl_t(l
, &a
, retval
, cmd
, dir
, len
);
156 osf1_ioctl_f(struct lwp
*l
, const struct sys_ioctl_args
*uap
, register_t
*retval
, int cmd
, int dir
, int len
)
160 case 1: /* OSF/1 FIOCLEX */
161 case 2: /* OSF/1 FIONCLEX */
162 case 123: /* OSF/1 FIOGETOWN */
163 case 124: /* OSF/1 FIOSETOWN */
164 case 125: /* OSF/1 FIOASYNC */
165 case 126: /* OSF/1 FIONBIO */
166 case 127: /* OSF/1 FIONREAD */
167 /* same as in NetBSD */
174 return sys_ioctl(l
, uap
, retval
);
178 osf1_ioctl_i(struct lwp
*l
, const struct sys_ioctl_args
*uap
, register_t
*retval
, int cmd
, int dir
, int len
)
182 case 12: /* OSF/1 SIOCSIFADDR */
183 case 14: /* OSF/1 SIOCSIFDSTADDR */
184 case 16: /* OSF/1 SIOCSIFFLAGS (XXX) */
185 case 17: /* OSF/1 SIOCGIFFLAGS (XXX) */
186 case 19: /* OSF/1 SIOCSIFBRDADDR */
187 case 22: /* OSF/1 SIOCSIFNETMASK */
188 case 23: /* OSF/1 SIOCGIFMETRIC */
189 case 24: /* OSF/1 SIOCSIFMETRIC */
190 case 25: /* OSF/1 SIOCDIFADDR */
191 case 33: /* OSF/1 SIOCGIFADDR */
192 case 34: /* OSF/1 SIOCGIFDSTADDR */
193 case 35: /* OSF/1 SIOCGIFBRDADDR */
194 case 37: /* OSF/1 SIOCGIFNETMASK */
195 /* same as in NetBSD */
202 return sys_ioctl(l
, uap
, retval
);
206 osf1_ioctl_t(struct lwp
*l
, const struct sys_ioctl_args
*uap
, register_t
*retval
, int cmd
, int dir
, int len
)
211 case 8: /* OSF/1 COMPAT_43 TIOCGETP (XXX) */
212 case 9: /* OSF/1 COMPAT_43 TIOCSETP (XXX) */
214 case 19: /* OSF/1 TIOCGETA (XXX) */
215 case 20: /* OSF/1 TIOCSETA (XXX) */
216 case 21: /* OSF/1 TIOCSETAW (XXX) */
217 case 22: /* OSF/1 TIOCSETAF (XXX) */
218 case 26: /* OSF/1 TIOCGETD (XXX) */
219 case 27: /* OSF/1 TIOCSETD (XXX) */
220 case 97: /* OSF/1 TIOCSCTTY */
221 case 103: /* OSF/1 TIOCSWINSZ */
222 case 104: /* OSF/1 TIOCGWINSZ */
223 /* same as in NetBSD */
230 return sys_ioctl(l
, uap
, retval
);