Annotation of sys/compat/osf1/osf1_ioctl.c, Revision 1.1
1.1 ! nbrk 1: /* $OpenBSD: osf1_ioctl.c,v 1.5 2002/03/14 01:26:50 millert Exp $ */
! 2: /* $NetBSD: osf1_ioctl.c,v 1.11 1999/05/05 01:51:33 cgd Exp $ */
! 3:
! 4: /*
! 5: * Copyright (c) 1999 Christopher G. Demetriou. All rights reserved.
! 6: *
! 7: * Redistribution and use in source and binary forms, with or without
! 8: * modification, are permitted provided that the following conditions
! 9: * are met:
! 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. All advertising materials mentioning features or use of this software
! 16: * must display the following acknowledgement:
! 17: * This product includes software developed by Christopher G. Demetriou
! 18: * for the NetBSD Project.
! 19: * 4. The name of the author may not be used to endorse or promote products
! 20: * derived from this software without specific prior written permission
! 21: *
! 22: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
! 23: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
! 24: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
! 25: * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
! 26: * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
! 27: * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
! 28: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
! 29: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
! 30: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
! 31: * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
! 32: */
! 33:
! 34: /*
! 35: * Copyright (c) 1994, 1995 Carnegie-Mellon University.
! 36: * All rights reserved.
! 37: *
! 38: * Author: Chris G. Demetriou
! 39: *
! 40: * Permission to use, copy, modify and distribute this software and
! 41: * its documentation is hereby granted, provided that both the copyright
! 42: * notice and this permission notice appear in all copies of the
! 43: * software, derivative works or modified versions, and any portions
! 44: * thereof, and that both notices appear in supporting documentation.
! 45: *
! 46: * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
! 47: * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
! 48: * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
! 49: *
! 50: * Carnegie Mellon requests users of this software to return to
! 51: *
! 52: * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
! 53: * School of Computer Science
! 54: * Carnegie Mellon University
! 55: * Pittsburgh PA 15213-3890
! 56: *
! 57: * any improvements or extensions that they make and grant Carnegie the
! 58: * rights to redistribute these changes.
! 59: */
! 60:
! 61: #include <sys/param.h>
! 62: #include <sys/systm.h>
! 63: #include <sys/ioctl.h>
! 64: #include <sys/termios.h>
! 65: #include <sys/mount.h>
! 66: #include <sys/syscallargs.h>
! 67:
! 68: #include <compat/osf1/osf1.h>
! 69: #include <compat/osf1/osf1_syscallargs.h>
! 70:
! 71: #ifdef SYSCALL_DEBUG
! 72: extern int scdebug;
! 73: #endif
! 74:
! 75: int osf1_ioctl_f(struct proc *p, struct sys_ioctl_args *nuap,
! 76: register_t *retval, int cmd, int dir, int len);
! 77: int osf1_ioctl_i(struct proc *p, struct sys_ioctl_args *nuap,
! 78: register_t *retval, int cmd, int dir, int len);
! 79: int osf1_ioctl_t(struct proc *p, struct sys_ioctl_args *nuap,
! 80: register_t *retval, int cmd, int dir, int len);
! 81: int osf1_ioctl_m(struct proc *p, struct sys_ioctl_args *nuap,
! 82: register_t *retval, int cmd, int dir, int len);
! 83:
! 84: int
! 85: osf1_sys_ioctl(p, v, retval)
! 86: struct proc *p;
! 87: void *v;
! 88: register_t *retval;
! 89: {
! 90: struct osf1_sys_ioctl_args *uap = v;
! 91: struct sys_ioctl_args a;
! 92: int op, dir, group, cmd, len;
! 93: #ifdef SYSCALL_DEBUG
! 94: char *dirstr;
! 95: #endif
! 96:
! 97: op = SCARG(uap, com);
! 98: dir = op & OSF1_IOC_DIRMASK;
! 99: group = OSF1_IOCGROUP(op);
! 100: cmd = OSF1_IOCCMD(op);
! 101: len = OSF1_IOCPARM_LEN(op);
! 102:
! 103: switch (dir) {
! 104: case OSF1_IOC_VOID:
! 105: dir = IOC_VOID;
! 106: #ifdef SYSCALL_DEBUG
! 107: dirstr = "none";
! 108: #endif
! 109: break;
! 110: case OSF1_IOC_OUT:
! 111: dir = IOC_OUT;
! 112: #ifdef SYSCALL_DEBUG
! 113: dirstr = "out";
! 114: #endif
! 115: break;
! 116: case OSF1_IOC_IN:
! 117: dir = IOC_IN;
! 118: #ifdef SYSCALL_DEBUG
! 119: dirstr = "in";
! 120: #endif
! 121: break;
! 122: case OSF1_IOC_INOUT:
! 123: dir = IOC_INOUT;
! 124: #ifdef SYSCALL_DEBUG
! 125: dirstr = "in-out";
! 126: #endif
! 127: break;
! 128: default:
! 129: return (EINVAL);
! 130: break;
! 131: }
! 132: #ifdef SYSCALL_DEBUG
! 133: if (scdebug)
! 134: printf(
! 135: "OSF/1 IOCTL: group = %c, cmd = %d, len = %d, dir = %s\n",
! 136: group, cmd, len, dirstr);
! 137: #endif
! 138:
! 139: SCARG(&a, fd) = SCARG(uap, fd);
! 140: SCARG(&a, com) = SCARG(uap, com) & 0xffffffff; /* XXX */
! 141: SCARG(&a, data) = SCARG(uap, data);
! 142: switch (group) {
! 143: case 'f':
! 144: return osf1_ioctl_f(p, &a, retval, cmd, dir, len);
! 145: case 'i':
! 146: return osf1_ioctl_i(p, &a, retval, cmd, dir, len);
! 147: case 't':
! 148: return osf1_ioctl_t(p, &a, retval, cmd, dir, len);
! 149: case 'm':
! 150: return osf1_ioctl_m(p, &a, retval, cmd, dir, len);
! 151: default:
! 152: return (ENOTTY);
! 153: }
! 154: }
! 155:
! 156: int
! 157: osf1_ioctl_f(p, uap, retval, cmd, dir, len)
! 158: struct proc *p;
! 159: struct sys_ioctl_args *uap;
! 160: register_t *retval;
! 161: int cmd;
! 162: int dir;
! 163: int len;
! 164: {
! 165:
! 166: switch (cmd) {
! 167: case 1: /* OSF/1 FIOCLEX */
! 168: case 2: /* OSF/1 FIONCLEX */
! 169: case 123: /* OSF/1 FIOGETOWN */
! 170: case 124: /* OSF/1 FIOSETOWN */
! 171: case 125: /* OSF/1 FIOASYNC */
! 172: case 126: /* OSF/1 FIONBIO */
! 173: case 127: /* OSF/1 FIONREAD */
! 174: /* same as in OpenBSD */
! 175: break;
! 176:
! 177: default:
! 178: return (ENOTTY);
! 179: }
! 180:
! 181: return sys_ioctl(p, uap, retval);
! 182: }
! 183:
! 184: /*
! 185: * Mag Tape ioctl's
! 186: */
! 187: int
! 188: osf1_ioctl_m(p, uap, retval, cmd, dir, len)
! 189: struct proc *p;
! 190: struct sys_ioctl_args *uap;
! 191: register_t *retval;
! 192: int cmd;
! 193: int dir;
! 194: int len;
! 195: {
! 196: switch (cmd) {
! 197: case 1: /* OSF/1 MTIOCTOP (XXX) */
! 198: case 2: /* OSF/1 MTIOCGET (XXX) */
! 199: /* same as in OpenBSD */
! 200: break;
! 201: default:
! 202: return (ENOTTY);
! 203: }
! 204:
! 205: return sys_ioctl(p, uap, retval);
! 206: }
! 207:
! 208: int
! 209: osf1_ioctl_i(p, uap, retval, cmd, dir, len)
! 210: struct proc *p;
! 211: struct sys_ioctl_args *uap;
! 212: register_t *retval;
! 213: int cmd;
! 214: int dir;
! 215: int len;
! 216: {
! 217:
! 218: switch (cmd) {
! 219: case 12: /* OSF/1 SIOCSIFADDR */
! 220: case 14: /* OSF/1 SIOCSIFDSTADDR */
! 221: case 16: /* OSF/1 SIOCSIFFLAGS (XXX) */
! 222: case 17: /* OSF/1 SIOCGIFFLAGS (XXX) */
! 223: case 19: /* OSF/1 SIOCSIFBRDADDR */
! 224: case 22: /* OSF/1 SIOCSIFNETMASK */
! 225: case 23: /* OSF/1 SIOCGIFMETRIC */
! 226: case 24: /* OSF/1 SIOCSIFMETRIC */
! 227: case 25: /* OSF/1 SIOCDIFADDR */
! 228: case 33: /* OSF/1 SIOCGIFADDR */
! 229: case 34: /* OSF/1 SIOCGIFDSTADDR */
! 230: case 35: /* OSF/1 SIOCGIFBRDADDR */
! 231: case 37: /* OSF/1 SIOCGIFNETMASK */
! 232: /* same as in OpenBSD */
! 233: break;
! 234:
! 235: default:
! 236: return (ENOTTY);
! 237: }
! 238:
! 239: return sys_ioctl(p, uap, retval);
! 240: }
! 241:
! 242: int
! 243: osf1_ioctl_t(p, uap, retval, cmd, dir, len)
! 244: struct proc *p;
! 245: struct sys_ioctl_args *uap;
! 246: register_t *retval;
! 247: int cmd;
! 248: int dir;
! 249: int len;
! 250: {
! 251:
! 252: switch (cmd) {
! 253: #ifdef COMPAT_43
! 254: case 8: /* OSF/1 COMPAT_43 TIOCGETP (XXX) */
! 255: case 9: /* OSF/1 COMPAT_43 TIOCSETP (XXX) */
! 256: #endif
! 257: case 19: /* OSF/1 TIOCGETA (XXX) */
! 258: case 20: /* OSF/1 TIOCSETA (XXX) */
! 259: case 21: /* OSF/1 TIOCSETAW (XXX) */
! 260: case 22: /* OSF/1 TIOCSETAF (XXX) */
! 261: case 26: /* OSF/1 TIOCGETD (XXX) */
! 262: case 27: /* OSF/1 TIOCSETD (XXX) */
! 263: case 97: /* OSF/1 TIOCSCTTY */
! 264: case 103: /* OSF/1 TIOCSWINSZ */
! 265: case 104: /* OSF/1 TIOCGWINSZ */
! 266: /* same as in OpenBSD */
! 267: break;
! 268:
! 269: default:
! 270: return (ENOTTY);
! 271: }
! 272:
! 273: return sys_ioctl(p, uap, retval);
! 274: }
CVSweb