root/arch/sparc/kernel/sunos_ioctl.c

/* [previous][next][first][last][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. sunos_ioctl

   1 /* $Id: sunos_ioctl.c,v 1.17 1996/02/10 04:29:20 davem Exp $
   2  * sunos_ioctl.c: The Linux Operating system: SunOS ioctl compatibility.
   3  * 
   4  * Copyright (C) 1995 Miguel de Icaza (miguel@nuclecu.unam.mx)
   5  * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
   6  */
   7 
   8 #include <asm/segment.h>
   9 
  10 #include <linux/sched.h>
  11 #include <linux/errno.h>
  12 #include <linux/string.h>
  13 #include <linux/termios.h>
  14 #include <linux/ioctl.h>
  15 #include <linux/route.h>
  16 #include <linux/sockios.h>
  17 #include <linux/if.h>
  18 #include <linux/if_arp.h>
  19 #include <linux/fs.h>
  20 #include <linux/mm.h>
  21 #include <asm/kbio.h>
  22 
  23 #if 0
  24 extern char sunkbd_type;
  25 extern char sunkbd_layout;
  26 #endif
  27 
  28 extern asmlinkage int sys_ioctl(unsigned int, unsigned int, unsigned long);
  29 extern asmlinkage int sys_setsid(void);
  30 
  31 asmlinkage int sunos_ioctl (int fd, unsigned long cmd, unsigned long arg)
     /* [previous][next][first][last][top][bottom][index][help] */
  32 {
  33         struct file *filp;
  34         int foo;
  35 
  36         if (fd >= NR_OPEN || !(filp = current->files->fd [fd]))
  37                 return -EBADF;
  38 
  39         /* First handle an easy compat. case for tty ldisc. */
  40         if(cmd == TIOCSETD) {
  41                 int *p, ntty = N_TTY, old_fs;
  42 
  43                 p = (int *) arg;
  44                 foo = verify_area(VERIFY_WRITE, p, sizeof(int));
  45                 if(foo) return foo;
  46                 if(*p == 2) {
  47                         old_fs = get_fs();
  48                         set_fs(KERNEL_DS);
  49                         foo = sys_ioctl(fd, cmd, (int) &ntty);
  50                         set_fs(old_fs);
  51                         return (foo == -EINVAL ? -EOPNOTSUPP : foo);
  52                 }
  53         }
  54 
  55         /* Binary compatability is good American knowhow fuckin' up. */
  56         if(cmd == TIOCNOTTY)
  57                 return sys_setsid();
  58 
  59         /* SunOS networking ioctls. */
  60         switch (cmd) {
  61         case _IOW('r', 10, struct rtentry):
  62                 return sys_ioctl(fd, SIOCADDRT, arg);
  63         case _IOW('r', 11, struct rtentry):
  64                 return sys_ioctl(fd, SIOCDELRT, arg);
  65         case _IOW('i', 12, struct ifreq):
  66                 return sys_ioctl(fd, SIOCSIFADDR, arg);
  67         case _IORW('i', 13, struct ifreq):
  68                 return sys_ioctl(fd, SIOCGIFADDR, arg);
  69         case _IOW('i', 14, struct ifreq):
  70                 return sys_ioctl(fd, SIOCSIFDSTADDR, arg);
  71         case _IORW('i', 15, struct ifreq):
  72                 return sys_ioctl(fd, SIOCGIFDSTADDR, arg);
  73         case _IOW('i', 16, struct ifreq):
  74                 return sys_ioctl(fd, SIOCSIFFLAGS, arg);
  75         case _IORW('i', 17, struct ifreq):
  76                 return sys_ioctl(fd, SIOCGIFFLAGS, arg);
  77         case _IOW('i', 18, struct ifreq):
  78                 return sys_ioctl(fd, SIOCSIFMEM, arg);
  79         case _IORW('i', 19, struct ifreq):
  80                 return sys_ioctl(fd, SIOCGIFMEM, arg);
  81         case _IORW('i', 20, struct ifconf):
  82                 return sys_ioctl(fd, SIOCGIFCONF, arg);
  83         case _IOW('i', 21, struct ifreq): /* SIOCSIFMTU */
  84                 return sys_ioctl(fd, SIOCSIFMTU, arg);
  85         case _IORW('i', 22, struct ifreq): /* SIOCGIFMTU */
  86                 return sys_ioctl(fd, SIOCGIFMTU, arg);
  87 
  88         case _IORW('i', 23, struct ifreq):
  89                 return sys_ioctl(fd, SIOCGIFBRDADDR, arg);
  90         case _IOW('i', 24, struct ifreq):
  91                 return sys_ioctl(fd, SIOCGIFBRDADDR, arg);
  92         case _IORW('i', 25, struct ifreq):
  93                 return sys_ioctl(fd, SIOCGIFNETMASK, arg);
  94         case _IOW('i', 26, struct ifreq):
  95                 return sys_ioctl(fd, SIOCSIFNETMASK, arg);
  96         case _IORW('i', 27, struct ifreq):
  97                 return sys_ioctl(fd, SIOCGIFMETRIC, arg);
  98         case _IOW('i', 28, struct ifreq):
  99                 return sys_ioctl(fd, SIOCSIFMETRIC, arg);
 100 
 101         case _IOW('i', 30, struct arpreq):
 102                 return sys_ioctl(fd, SIOCSARP, arg);
 103         case _IOW('i', 31, struct arpreq):
 104                 return sys_ioctl(fd, SIOCGARP, arg);
 105         case _IOW('i', 32, struct arpreq):
 106                 return sys_ioctl(fd, SIOCGARP, arg);
 107 
 108         case _IOW('i', 40, struct ifreq): /* SIOCUPPER */
 109         case _IOW('i', 41, struct ifreq): /* SIOCLOWER */
 110         case _IOW('i', 44, struct ifreq): /* SIOCSETSYNC */
 111         case _IOW('i', 45, struct ifreq): /* SIOCGETSYNC */
 112         case _IOW('i', 46, struct ifreq): /* SIOCSSDSTATS */
 113         case _IOW('i', 47, struct ifreq): /* SIOCSSESTATS */
 114         case _IOW('i', 48, struct ifreq): /* SIOCSPROMISC */
 115                 return -EOPNOTSUPP;
 116 
 117         case _IOW('i', 49, struct ifreq):
 118                 return sys_ioctl(fd, SIOCADDMULTI, arg);
 119         case _IOW('i', 50, struct ifreq):
 120                 return sys_ioctl(fd, SIOCDELMULTI, arg);
 121 
 122         /* FDDI interface ioctls, unsupported. */
 123                 
 124         case _IOW('i', 51, struct ifreq): /* SIOCFDRESET */
 125         case _IOW('i', 52, struct ifreq): /* SIOCFDSLEEP */
 126         case _IOW('i', 53, struct ifreq): /* SIOCSTRTFMWAR */
 127         case _IOW('i', 54, struct ifreq): /* SIOCLDNSTRTFW */
 128         case _IOW('i', 55, struct ifreq): /* SIOCGETFDSTAT */
 129         case _IOW('i', 56, struct ifreq): /* SIOCFDNMIINT */
 130         case _IOW('i', 57, struct ifreq): /* SIOCFDEXUSER */
 131         case _IOW('i', 58, struct ifreq): /* SIOCFDGNETMAP */
 132         case _IOW('i', 59, struct ifreq): /* SIOCFDGIOCTL */
 133                 printk("FDDI ioctl, returning EOPNOTSUPP\n");
 134                 return -EOPNOTSUPP;
 135         case _IOW('t', 125, int):
 136                 /* More stupid tty sunos ioctls, just
 137                  * say it worked.
 138                  */
 139                 return 0;
 140         /* Non posix grp */
 141         case _IOR('t', 119, int):
 142                 return -EIO;
 143         }
 144 
 145 #if 0
 146         if (cmd & 0xff00 == ('k' << 8)){
 147                 printk ("[[KBIO: %8.8x\n", (unsigned int) cmd);
 148         }
 149 #endif
 150 
 151         foo = sys_ioctl(fd, cmd, arg);
 152         /* so stupid... */
 153         return (foo == -EINVAL ? -EOPNOTSUPP : foo);
 154 }
 155 
 156 

/* [previous][next][first][last][top][bottom][index][help] */