root/arch/m68k/kernel/sys_m68k.c

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

DEFINITIONS

This source file includes following definitions.
  1. sys_pipe
  2. old_mmap
  3. old_select
  4. sys_ipc
  5. sys_ioperm

   1 /*
   2  * linux/arch/m68k/kernel/sys_m68k.c
   3  *
   4  * This file contains various random system calls that
   5  * have a non-standard calling sequence on the Linux/m68k
   6  * platform.
   7  */
   8 
   9 #include <linux/config.h>
  10 #include <linux/errno.h>
  11 #include <linux/sched.h>
  12 #include <linux/mm.h>
  13 #include <linux/sem.h>
  14 #include <linux/msg.h>
  15 #include <linux/shm.h>
  16 #include <linux/stat.h>
  17 #include <linux/mman.h>
  18 
  19 #include <asm/segment.h>
  20 
  21 /*
  22  * sys_pipe() is the normal C calling standard for creating
  23  * a pipe. It's not the way unix traditionally does this, though.
  24  */
  25 asmlinkage int sys_pipe(unsigned long * fildes)
     /* [previous][next][first][last][top][bottom][index][help] */
  26 {
  27         int fd[2];
  28         int error;
  29 
  30         error = verify_area(VERIFY_WRITE,fildes,8);
  31         if (error)
  32                 return error;
  33         error = do_pipe(fd);
  34         if (error)
  35                 return error;
  36         put_user(fd[0],0+fildes);
  37         put_user(fd[1],1+fildes);
  38         return 0;
  39 }
  40 
  41 /*
  42  * Perform the select(nd, in, out, ex, tv) and mmap() system
  43  * calls. Linux/m68k cloned Linux/i386, which didn't use to be able to
  44  * handle more than 4 system call parameters, so these system calls
  45  * used a memory block for parameter passing..
  46  */
  47 
  48 asmlinkage int old_mmap(unsigned long *buffer)
     /* [previous][next][first][last][top][bottom][index][help] */
  49 {
  50         int error;
  51         unsigned long flags;
  52         struct file * file = NULL;
  53 
  54         error = verify_area(VERIFY_READ, buffer, 6*sizeof(long));
  55         if (error)
  56                 return error;
  57         flags = get_user(buffer+3);
  58         if (!(flags & MAP_ANONYMOUS)) {
  59                 unsigned long fd = get_user(buffer+4);
  60                 if (fd >= NR_OPEN || !(file = current->files->fd[fd]))
  61                         return -EBADF;
  62         }
  63         flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
  64         return do_mmap(file, get_user(buffer), get_user(buffer+1),
  65                        get_user(buffer+2), flags, get_user(buffer+5));
  66 }
  67 
  68 
  69 extern asmlinkage int sys_select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
  70 
  71 asmlinkage int old_select(unsigned long *buffer)
     /* [previous][next][first][last][top][bottom][index][help] */
  72 {
  73         int n;
  74         fd_set *inp;
  75         fd_set *outp;
  76         fd_set *exp;
  77         struct timeval *tvp;
  78 
  79         n = verify_area(VERIFY_READ, buffer, 5*sizeof(unsigned long));
  80         if (n)
  81           return n;
  82 
  83         n = get_user(buffer);
  84         inp = (fd_set *) get_user(buffer+1);
  85         outp = (fd_set *) get_user(buffer+2);
  86         exp = (fd_set *) get_user(buffer+3);
  87         tvp = (struct timeval *) get_user(buffer+4);
  88         return sys_select(n, inp, outp, exp, tvp);
  89 }
  90 
  91 /*
  92  * sys_ipc() is the de-multiplexer for the SysV IPC calls..
  93  *
  94  * This is really horribly ugly.
  95  */
  96 asmlinkage int sys_ipc (uint call, int first, int second, int third, void *ptr, long fifth)
     /* [previous][next][first][last][top][bottom][index][help] */
  97 {
  98         int version;
  99 
 100         version = call >> 16; /* hack for backward compatibility */
 101         call &= 0xffff;
 102 
 103         if (call <= SEMCTL)
 104                 switch (call) {
 105                 case SEMOP:
 106                         return sys_semop (first, (struct sembuf *)ptr, second);
 107                 case SEMGET:
 108                         return sys_semget (first, second, third);
 109                 case SEMCTL: {
 110                         union semun fourth;
 111                         int err;
 112                         if (!ptr)
 113                                 return -EINVAL;
 114                         if ((err = verify_area (VERIFY_READ, ptr, sizeof(long))))
 115                                 return err;
 116                         fourth.__pad = get_user((void **)ptr);
 117                         return sys_semctl (first, second, third, fourth);
 118                         }
 119                 default:
 120                         return -EINVAL;
 121                 }
 122         if (call <= MSGCTL) 
 123                 switch (call) {
 124                 case MSGSND:
 125                         return sys_msgsnd (first, (struct msgbuf *) ptr, 
 126                                            second, third);
 127                 case MSGRCV:
 128                         switch (version) {
 129                         case 0: {
 130                                 struct ipc_kludge tmp;
 131                                 int err;
 132                                 if (!ptr)
 133                                         return -EINVAL;
 134                                 if ((err = verify_area (VERIFY_READ, ptr, sizeof(tmp))))
 135                                         return err;
 136                                 memcpy_fromfs (&tmp,(struct ipc_kludge *) ptr,
 137                                                sizeof (tmp));
 138                                 return sys_msgrcv (first, tmp.msgp, second, tmp.msgtyp, third);
 139                                 }
 140                         case 1: default:
 141                                 return sys_msgrcv (first, (struct msgbuf *) ptr, second, fifth, third);
 142                         }
 143                 case MSGGET:
 144                         return sys_msgget ((key_t) first, second);
 145                 case MSGCTL:
 146                         return sys_msgctl (first, second, (struct msqid_ds *) ptr);
 147                 default:
 148                         return -EINVAL;
 149                 }
 150         if (call <= SHMCTL) 
 151                 switch (call) {
 152                 case SHMAT:
 153                         switch (version) {
 154                         case 0: default: {
 155                                 ulong raddr;
 156                                 int err;
 157                                 if ((err = verify_area(VERIFY_WRITE, (ulong*) third, sizeof(ulong))))
 158                                         return err;
 159                                 err = sys_shmat (first, (char *) ptr, second, &raddr);
 160                                 if (err)
 161                                         return err;
 162                                 put_user (raddr, (ulong *) third);
 163                                 return 0;
 164                                 }
 165                         case 1: /* iBCS2 emulator entry point */
 166                                 if (get_fs() != get_ds())
 167                                         return -EINVAL;
 168                                 return sys_shmat (first, (char *) ptr, second, (ulong *) third);
 169                         }
 170                 case SHMDT: 
 171                         return sys_shmdt ((char *)ptr);
 172                 case SHMGET:
 173                         return sys_shmget (first, second, third);
 174                 case SHMCTL:
 175                         return sys_shmctl (first, second, (struct shmid_ds *) ptr);
 176                 default:
 177                         return -EINVAL;
 178                 }
 179         return -EINVAL;
 180 }
 181 
 182 asmlinkage int sys_ioperm(unsigned long from, unsigned long num, int on)
     /* [previous][next][first][last][top][bottom][index][help] */
 183 {
 184   return -ENOSYS;
 185 }

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