The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/compat/osf1/osf1_ioctl.c

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*      $NetBSD: osf1_ioctl.c,v 1.22 2007/12/20 23:03:03 dsl Exp $      */
    2 
    3 /*
    4  * Copyright (c) 1999 Christopher G. Demetriou.  All rights reserved.
    5  *
    6  * Redistribution and use in source and binary forms, with or without
    7  * modification, are permitted provided that the following conditions
    8  * are met:
    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
   20  *
   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.
   31  */
   32 
   33 /*
   34  * Copyright (c) 1994, 1995 Carnegie-Mellon University.
   35  * All rights reserved.
   36  *
   37  * Author: Chris G. Demetriou
   38  *
   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.
   44  *
   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.
   48  *
   49  * Carnegie Mellon requests users of this software to return to
   50  *
   51  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
   52  *  School of Computer Science
   53  *  Carnegie Mellon University
   54  *  Pittsburgh PA 15213-3890
   55  *
   56  * any improvements or extensions that they make and grant Carnegie the
   57  * rights to redistribute these changes.
   58  */
   59 
   60 #include <sys/cdefs.h>
   61 __KERNEL_RCSID(0, "$NetBSD: osf1_ioctl.c,v 1.22 2007/12/20 23:03:03 dsl Exp $");
   62 
   63 #if defined(_KERNEL_OPT)
   64 #include "opt_compat_43.h"
   65 #include "opt_syscall_debug.h"
   66 #endif
   67 
   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>
   74 
   75 #include <compat/osf1/osf1.h>
   76 #include <compat/osf1/osf1_syscallargs.h>
   77 
   78 #ifdef SYSCALL_DEBUG
   79 extern int scdebug;
   80 #endif
   81 
   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);
   88 
   89 int
   90 osf1_sys_ioctl(struct lwp *l, const struct osf1_sys_ioctl_args *uap, register_t *retval)
   91 {
   92         struct sys_ioctl_args a;
   93         int op, dir, group, cmd, len;
   94 #ifdef SYSCALL_DEBUG
   95         char *dirstr;
   96 #endif
   97 
   98         op = SCARG(uap, com);
   99         dir = op & OSF1_IOC_DIRMASK;
  100         group = OSF1_IOCGROUP(op);
  101         cmd = OSF1_IOCCMD(op);
  102         len = OSF1_IOCPARM_LEN(op);
  103 
  104         switch (dir) {
  105         case OSF1_IOC_VOID:
  106                 dir = IOC_VOID;
  107 #ifdef SYSCALL_DEBUG
  108                 dirstr = "none";
  109 #endif
  110                 break;
  111         case OSF1_IOC_OUT:
  112                 dir = IOC_OUT;
  113 #ifdef SYSCALL_DEBUG
  114                 dirstr = "out";
  115 #endif
  116                 break;
  117         case OSF1_IOC_IN:
  118                 dir = IOC_IN;
  119 #ifdef SYSCALL_DEBUG
  120                 dirstr = "in";
  121 #endif
  122                 break;
  123         case OSF1_IOC_INOUT:
  124                 dir = IOC_INOUT;
  125 #ifdef SYSCALL_DEBUG
  126                 dirstr = "in-out";
  127 #endif
  128                 break;
  129         default:
  130                 return (EINVAL);
  131                 break;
  132         }
  133 #ifdef SYSCALL_DEBUG
  134         if (scdebug)
  135                 printf(
  136                     "OSF/1 IOCTL: group = %c, cmd = %d, len = %d, dir = %s\n",
  137                     group, cmd, len, dirstr);
  138 #endif
  139 
  140         SCARG(&a, fd) = SCARG(uap, fd);
  141         SCARG(&a, com) = SCARG(uap, com) & 0xffffffff;          /* XXX */
  142         SCARG(&a, data) = SCARG(uap, data);
  143         switch (group) {
  144         case 'f':
  145                 return osf1_ioctl_f(l, &a, retval, cmd, dir, len);
  146         case 'i':
  147                 return osf1_ioctl_i(l, &a, retval, cmd, dir, len);
  148         case 't':
  149                 return osf1_ioctl_t(l, &a, retval, cmd, dir, len);
  150         default:
  151                 return (ENOTTY);
  152         }
  153 }
  154 
  155 static int
  156 osf1_ioctl_f(struct lwp *l, const struct sys_ioctl_args *uap, register_t *retval, int cmd, int dir, int len)
  157 {
  158 
  159         switch (cmd) {
  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 */
  168                 break;
  169 
  170         default:
  171                 return (ENOTTY);
  172         }
  173 
  174         return sys_ioctl(l, uap, retval);
  175 }
  176 
  177 static int
  178 osf1_ioctl_i(struct lwp *l, const struct sys_ioctl_args *uap, register_t *retval, int cmd, int dir, int len)
  179 {
  180 
  181         switch (cmd) {
  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 */
  196                 break;
  197 
  198         default:
  199                 return (ENOTTY);
  200         }
  201 
  202         return sys_ioctl(l, uap, retval);
  203 }
  204 
  205 static int
  206 osf1_ioctl_t(struct lwp *l, const struct sys_ioctl_args *uap, register_t *retval, int cmd, int dir, int len)
  207 {
  208 
  209         switch (cmd) {
  210 #ifdef COMPAT_43
  211         case 8:                         /* OSF/1 COMPAT_43 TIOCGETP (XXX) */
  212         case 9:                         /* OSF/1 COMPAT_43 TIOCSETP (XXX) */
  213 #endif
  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 */
  224                 break;
  225 
  226         default:
  227                 return (ENOTTY);
  228         }
  229 
  230         return sys_ioctl(l, uap, retval);
  231 }

Cache object: dffd906dc7f102c5e59677e903fd7c6e


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.