root/arch/sparc/kernel/sys_sparc.c

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

DEFINITIONS

This source file includes following definitions.
  1. sys_getpagesize
  2. sparc_pipe
  3. sys_ipc

   1 /* $Id: sys_sparc.c,v 1.6 1995/11/25 00:58:34 davem Exp $
   2  * linux/arch/sparc/kernel/sys_sparc.c
   3  *
   4  * This file contains various random system calls that
   5  * have a non-standard calling sequence on the Linux/sparc
   6  * platform.
   7  */
   8 
   9 #include <linux/errno.h>
  10 #include <linux/sched.h>
  11 #include <linux/mm.h>
  12 #include <linux/sem.h>
  13 #include <linux/msg.h>
  14 #include <linux/shm.h>
  15 #include <linux/stat.h>
  16 #include <linux/mman.h>
  17 
  18 #include <asm/segment.h>
  19 
  20 /* XXX Make this per-binary type, this way we can detect the type of
  21  * XXX a binary.  Every Sparc executable calls this very early on.
  22  */
  23 asmlinkage unsigned long sys_getpagesize(void)
     /* [previous][next][first][last][top][bottom][index][help] */
  24 {
  25         return PAGE_SIZE; /* Possibly older binaries want 8192 on sun4's? */
  26 }
  27 
  28 /*
  29  * sys_pipe() is the normal C calling standard for creating
  30  * a pipe. It's not the way unix tranditionally does this, though.
  31  */
  32 asmlinkage void sparc_pipe(struct pt_regs *regs)
     /* [previous][next][first][last][top][bottom][index][help] */
  33 {
  34         int fd[2];
  35         int error;
  36 
  37         error = do_pipe(fd);
  38         if (error) {
  39                 regs->u_regs[UREG_I0] = error;
  40         } else {
  41                 regs->u_regs[UREG_I0] = fd[0];
  42                 regs->u_regs[UREG_I1] = fd[1];
  43         }
  44 }
  45 
  46 /*
  47  * sys_ipc() is the de-multiplexer for the SysV IPC calls..
  48  *
  49  * This is really horribly ugly.
  50  */
  51 asmlinkage int sys_ipc (uint call, int first, int second, int third, void *ptr, long fifth)
     /* [previous][next][first][last][top][bottom][index][help] */
  52 {
  53         int version;
  54 
  55         version = call >> 16; /* hack for backward compatibility */
  56         call &= 0xffff;
  57 
  58         if (call <= SEMCTL)
  59                 switch (call) {
  60                 case SEMOP:
  61                         return sys_semop (first, (struct sembuf *)ptr, second);
  62                 case SEMGET:
  63                         return sys_semget (first, second, third);
  64                 case SEMCTL: {
  65                         union semun fourth;
  66                         int err;
  67                         if (!ptr)
  68                                 return -EINVAL;
  69                         if ((err = verify_area (VERIFY_READ, ptr, sizeof(long))))
  70                                 return err;
  71                         fourth.__pad = (void *) get_fs_long(ptr);
  72                         return sys_semctl (first, second, third, fourth);
  73                         }
  74                 default:
  75                         return -EINVAL;
  76                 }
  77         if (call <= MSGCTL) 
  78                 switch (call) {
  79                 case MSGSND:
  80                         return sys_msgsnd (first, (struct msgbuf *) ptr, 
  81                                            second, third);
  82                 case MSGRCV:
  83                         switch (version) {
  84                         case 0: {
  85                                 struct ipc_kludge tmp;
  86                                 int err;
  87                                 if (!ptr)
  88                                         return -EINVAL;
  89                                 if ((err = verify_area (VERIFY_READ, ptr, sizeof(tmp))))
  90                                         return err;
  91                                 memcpy_fromfs (&tmp,(struct ipc_kludge *) ptr,
  92                                                sizeof (tmp));
  93                                 return sys_msgrcv (first, tmp.msgp, second, tmp.msgtyp, third);
  94                                 }
  95                         case 1: default:
  96                                 return sys_msgrcv (first, (struct msgbuf *) ptr, second, fifth, third);
  97                         }
  98                 case MSGGET:
  99                         return sys_msgget ((key_t) first, second);
 100                 case MSGCTL:
 101                         return sys_msgctl (first, second, (struct msqid_ds *) ptr);
 102                 default:
 103                         return -EINVAL;
 104                 }
 105         if (call <= SHMCTL) 
 106                 switch (call) {
 107                 case SHMAT:
 108                         switch (version) {
 109                         case 0: default: {
 110                                 ulong raddr;
 111                                 int err;
 112                                 if ((err = verify_area(VERIFY_WRITE, (ulong*) third, sizeof(ulong))))
 113                                         return err;
 114                                 err = sys_shmat (first, (char *) ptr, second, &raddr);
 115                                 if (err)
 116                                         return err;
 117                                 put_fs_long (raddr, (ulong *) third);
 118                                 return 0;
 119                                 }
 120                         case 1: /* iBCS2 emulator entry point */
 121                                 if (get_fs() != get_ds())
 122                                         return -EINVAL;
 123                                 return sys_shmat (first, (char *) ptr, second, (ulong *) third);
 124                         }
 125                 case SHMDT: 
 126                         return sys_shmdt ((char *)ptr);
 127                 case SHMGET:
 128                         return sys_shmget (first, second, third);
 129                 case SHMCTL:
 130                         return sys_shmctl (first, second, (struct shmid_ds *) ptr);
 131                 default:
 132                         return -EINVAL;
 133                 }
 134         return -EINVAL;
 135 }

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