Add generic sys_ipc wrapper
Christoph Hellwig [Wed, 10 Mar 2010 23:21:18 +0000 (15:21 -0800)]
Add a generic implementation of the ipc demultiplexer syscall.  Except for
s390 and sparc64 all implementations of the sys_ipc are nearly identical.

There are slight differences in the types of the parameters, where mips
and powerpc as the only 64-bit architectures with sys_ipc use unsigned
long for the "third" argument as it gets casted to a pointer later, while
it traditionally is an "int" like most other paramters.  frv goes even
further and uses unsigned long for all parameters execept for "ptr" which
is a pointer type everywhere.  The change from int to unsigned long for
"third" and back to "int" for the others on frv should be fine due to the
in-register calling conventions for syscalls (we already had a similar
issue with the generic sys_ptrace), but I'd prefer to have the arch
maintainers looks over this in details.

Except for that h8300, m68k and m68knommu lack an impplementation of the
semtimedop sub call which this patch adds, and various architectures have
gets used - at least on i386 it seems superflous as the compat code on
x86-64 and ia64 doesn't even bother to implement it.

[akpm@linux-foundation.org: add sys_ipc to sys_ni.c]
Signed-off-by: Christoph Hellwig <hch@lst.de>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mundt <lethal@linux-sh.org>
Cc: Jeff Dike <jdike@addtoit.com>
Cc: Hirokazu Takata <takata@linux-m32r.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@elte.hu>
Reviewed-by: H. Peter Anvin <hpa@zytor.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: "Luck, Tony" <tony.luck@intel.com>
Cc: James Morris <jmorris@namei.org>
Cc: Andreas Schwab <schwab@linux-m68k.org>
Acked-by: Jesper Nilsson <jesper.nilsson@axis.com>
Acked-by: Russell King <rmk+kernel@arm.linux.org.uk>
Acked-by: David Howells <dhowells@redhat.com>
Acked-by: Kyle McMartin <kyle@mcmartin.ca>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

41 files changed:
arch/arm/include/asm/unistd.h
arch/arm/kernel/sys_arm.c
arch/arm/kernel/sys_oabi-compat.c
arch/cris/include/asm/unistd.h
arch/cris/kernel/sys_cris.c
arch/frv/include/asm/unistd.h
arch/frv/kernel/sys_frv.c
arch/h8300/include/asm/unistd.h
arch/h8300/kernel/sys_h8300.c
arch/m32r/include/asm/unistd.h
arch/m32r/kernel/sys_m32r.c
arch/m68k/include/asm/unistd.h
arch/m68k/kernel/sys_m68k.c
arch/m68knommu/kernel/sys_m68k.c
arch/mips/include/asm/unistd.h
arch/mips/kernel/syscall.c
arch/mn10300/include/asm/unistd.h
arch/mn10300/kernel/sys_mn10300.c
arch/powerpc/include/asm/syscalls.h
arch/powerpc/include/asm/unistd.h
arch/powerpc/kernel/syscalls.c
arch/s390/kernel/entry.h
arch/s390/kernel/sys_s390.c
arch/s390/kernel/syscalls.S
arch/sh/include/asm/syscalls.h
arch/sh/include/asm/unistd_32.h
arch/sh/include/asm/unistd_64.h
arch/sh/kernel/sys_sh.c
arch/sparc/include/asm/unistd.h
arch/sparc/kernel/sys_sparc_32.c
arch/sparc/kernel/sys_sparc_64.c
arch/sparc/kernel/systbls.h
arch/sparc/kernel/systbls_64.S
arch/um/sys-i386/syscalls.c
arch/x86/include/asm/syscalls.h
arch/x86/include/asm/unistd_32.h
arch/x86/kernel/sys_i386_32.c
include/linux/syscalls.h
ipc/Makefile
ipc/syscall.c [new file with mode: 0644]
kernel/sys_ni.c

index e6eeb2d..dd2bf53 100644 (file)
 
 #if !defined(CONFIG_AEABI) || defined(CONFIG_OABI_COMPAT)
 #define __ARCH_WANT_SYS_TIME
+#define __ARCH_WANT_SYS_IPC
 #define __ARCH_WANT_SYS_OLDUMOUNT
 #define __ARCH_WANT_SYS_ALARM
 #define __ARCH_WANT_SYS_UTIME
index a2e0e6f..4350f75 100644 (file)
 #include <linux/ipc.h>
 #include <linux/uaccess.h>
 
-#if !defined(CONFIG_AEABI) || defined(CONFIG_OABI_COMPAT)
-/*
- * sys_ipc() is the de-multiplexer for the SysV IPC calls..
- *
- * This is really horribly ugly.
- */
-asmlinkage int sys_ipc(uint call, int first, int second, int third,
-                      void __user *ptr, long fifth)
-{
-       int version, ret;
-
-       version = call >> 16; /* hack for backward compatibility */
-       call &= 0xffff;
-
-       switch (call) {
-       case SEMOP:
-               return sys_semtimedop (first, (struct sembuf __user *)ptr, second, NULL);
-       case SEMTIMEDOP:
-               return sys_semtimedop(first, (struct sembuf __user *)ptr, second,
-                                       (const struct timespec __user *)fifth);
-
-       case SEMGET:
-               return sys_semget (first, second, third);
-       case SEMCTL: {
-               union semun fourth;
-               if (!ptr)
-                       return -EINVAL;
-               if (get_user(fourth.__pad, (void __user * __user *) ptr))
-                       return -EFAULT;
-               return sys_semctl (first, second, third, fourth);
-       }
-
-       case MSGSND:
-               return sys_msgsnd(first, (struct msgbuf __user *) ptr, 
-                                 second, third);
-       case MSGRCV:
-               switch (version) {
-               case 0: {
-                       struct ipc_kludge tmp;
-                       if (!ptr)
-                               return -EINVAL;
-                       if (copy_from_user(&tmp,(struct ipc_kludge __user *)ptr,
-                                          sizeof (tmp)))
-                               return -EFAULT;
-                       return sys_msgrcv (first, tmp.msgp, second,
-                                          tmp.msgtyp, third);
-               }
-               default:
-                       return sys_msgrcv (first,
-                                          (struct msgbuf __user *) ptr,
-                                          second, fifth, third);
-               }
-       case MSGGET:
-               return sys_msgget ((key_t) first, second);
-       case MSGCTL:
-               return sys_msgctl(first, second, (struct msqid_ds __user *)ptr);
-
-       case SHMAT:
-               switch (version) {
-               default: {
-                       ulong raddr;
-                       ret = do_shmat(first, (char __user *)ptr, second, &raddr);
-                       if (ret)
-                               return ret;
-                       return put_user(raddr, (ulong __user *)third);
-               }
-               case 1: /* Of course, we don't support iBCS2! */
-                       return -EINVAL;
-               }
-       case SHMDT: 
-               return sys_shmdt ((char __user *)ptr);
-       case SHMGET:
-               return sys_shmget (first, second, third);
-       case SHMCTL:
-               return sys_shmctl (first, second,
-                                  (struct shmid_ds __user *) ptr);
-       default:
-               return -ENOSYS;
-       }
-}
-#endif
-
 /* Fork a new task - this creates a new program thread.
  * This is called indirectly via a small wrapper
  */
index d59a0cd..33ff678 100644 (file)
@@ -346,9 +346,6 @@ asmlinkage long sys_oabi_semop(int semid, struct oabi_sembuf __user *tsops,
        return sys_oabi_semtimedop(semid, tsops, nsops, NULL);
 }
 
-extern asmlinkage int sys_ipc(uint call, int first, int second, int third,
-                             void __user *ptr, long fifth);
-
 asmlinkage int sys_oabi_ipc(uint call, int first, int second, int third,
                            void __user *ptr, long fifth)
 {
index 8cffd22..f6fad83 100644 (file)
 #define __ARCH_WANT_STAT64
 #define __ARCH_WANT_SYS_ALARM
 #define __ARCH_WANT_SYS_GETHOSTNAME
+#define __ARCH_WANT_SYS_IPC
 #define __ARCH_WANT_SYS_PAUSE
 #define __ARCH_WANT_SYS_SGETMASK
 #define __ARCH_WANT_SYS_SIGNAL
index 22f9d6c..7aa036e 100644 (file)
@@ -33,81 +33,3 @@ sys_mmap2(unsigned long addr, unsigned long len, unsigned long prot,
        /* bug(?): 8Kb pages here */
         return sys_mmap_pgoff(addr, len, prot, flags, fd, pgoff);
 }
-
-/*
- * sys_ipc() is the de-multiplexer for the SysV IPC calls..
- *
- * This is really horribly ugly. (same as arch/i386)
- */
-
-asmlinkage int sys_ipc (uint call, int first, int second,
-                       int third, void __user *ptr, long fifth)
-{
-       int version, ret;
-
-       version = call >> 16; /* hack for backward compatibility */
-       call &= 0xffff;
-
-       switch (call) {
-       case SEMOP:
-               return sys_semtimedop (first, (struct sembuf __user *)ptr, second, NULL);
-       case SEMTIMEDOP:
-               return sys_semtimedop(first, (struct sembuf __user *)ptr, second,
-                                       (const struct timespec __user *)fifth);
-
-       case SEMGET:
-               return sys_semget (first, second, third);
-       case SEMCTL: {
-               union semun fourth;
-               if (!ptr)
-                       return -EINVAL;
-               if (get_user(fourth.__pad, (void * __user *) ptr))
-                       return -EFAULT;
-               return sys_semctl (first, second, third, fourth);
-       }
-
-       case MSGSND:
-               return sys_msgsnd (first, (struct msgbuf __user *) ptr, 
-                                  second, third);
-       case MSGRCV:
-               switch (version) {
-               case 0: {
-                       struct ipc_kludge tmp;
-                       if (!ptr)
-                               return -EINVAL;
-                       
-                       if (copy_from_user(&tmp,
-                                          (struct ipc_kludge __user *) ptr, 
-                                          sizeof (tmp)))
-                               return -EFAULT;
-                       return sys_msgrcv (first, tmp.msgp, second,
-                                          tmp.msgtyp, third);
-               }
-               default:
-                       return sys_msgrcv (first,
-                                          (struct msgbuf __user *) ptr,
-                                          second, fifth, third);
-               }
-       case MSGGET:
-               return sys_msgget ((key_t) first, second);
-       case MSGCTL:
-               return sys_msgctl (first, second, (struct msqid_ds __user *) ptr);
-
-       case SHMAT: {
-                ulong raddr;
-                ret = do_shmat (first, (char __user *) ptr, second, &raddr);
-                if (ret)
-                        return ret;
-                return put_user (raddr, (ulong __user *) third);
-        }
-       case SHMDT: 
-               return sys_shmdt ((char __user *)ptr);
-       case SHMGET:
-               return sys_shmget (first, second, third);
-       case SHMCTL:
-               return sys_shmctl (first, second,
-                                  (struct shmid_ds __user *) ptr);
-       default:
-               return -ENOSYS;
-       }
-}
index be6ef0f..b28da49 100644 (file)
 #define __ARCH_WANT_STAT64
 #define __ARCH_WANT_SYS_ALARM
 /* #define __ARCH_WANT_SYS_GETHOSTNAME */
+#define __ARCH_WANT_SYS_IPC
 #define __ARCH_WANT_SYS_PAUSE
 /* #define __ARCH_WANT_SYS_SGETMASK */
 /* #define __ARCH_WANT_SYS_SIGNAL */
index 1d3d4c9..9c49808 100644 (file)
@@ -42,92 +42,3 @@ asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
        return sys_mmap_pgoff(addr, len, prot, flags, fd,
                              pgoff >> (PAGE_SHIFT - 12));
 }
-
-/*
- * sys_ipc() is the de-multiplexer for the SysV IPC calls..
- *
- * This is really horribly ugly.
- */
-asmlinkage long sys_ipc(unsigned long call,
-                       unsigned long first,
-                       unsigned long second,
-                       unsigned long third,
-                       void __user *ptr,
-                       unsigned long fifth)
-{
-       int version, ret;
-
-       version = call >> 16; /* hack for backward compatibility */
-       call &= 0xffff;
-
-       switch (call) {
-       case SEMOP:
-               return sys_semtimedop(first, (struct sembuf __user *)ptr, second, NULL);
-       case SEMTIMEDOP:
-               return sys_semtimedop(first, (struct sembuf __user *)ptr, second,
-                                     (const struct timespec __user *)fifth);
-
-       case SEMGET:
-               return sys_semget (first, second, third);
-       case SEMCTL: {
-               union semun fourth;
-               if (!ptr)
-                       return -EINVAL;
-               if (get_user(fourth.__pad, (void * __user *) ptr))
-                       return -EFAULT;
-               return sys_semctl (first, second, third, fourth);
-       }
-
-       case MSGSND:
-               return sys_msgsnd (first, (struct msgbuf __user *) ptr,
-                                  second, third);
-       case MSGRCV:
-               switch (version) {
-               case 0: {
-                       struct ipc_kludge tmp;
-                       if (!ptr)
-                               return -EINVAL;
-
-                       if (copy_from_user(&tmp,
-                                          (struct ipc_kludge __user *) ptr,
-                                          sizeof (tmp)))
-                               return -EFAULT;
-                       return sys_msgrcv (first, tmp.msgp, second,
-                                          tmp.msgtyp, third);
-               }
-               default:
-                       return sys_msgrcv (first,
-                                          (struct msgbuf __user *) ptr,
-                                          second, fifth, third);
-               }
-       case MSGGET:
-               return sys_msgget ((key_t) first, second);
-       case MSGCTL:
-               return sys_msgctl (first, second, (struct msqid_ds __user *) ptr);
-
-       case SHMAT:
-               switch (version) {
-               default: {
-                       ulong raddr;
-                       ret = do_shmat (first, (char __user *) ptr, second, &raddr);
-                       if (ret)
-                               return ret;
-                       return put_user (raddr, (ulong __user *) third);
-               }
-               case 1: /* iBCS2 emulator entry point */
-                       if (!segment_eq(get_fs(), get_ds()))
-                               return -EINVAL;
-                       /* The "(ulong *) third" is valid _only_ because of the kernel segment thing */
-                       return do_shmat (first, (char __user *) ptr, second, (ulong *) third);
-               }
-       case SHMDT:
-               return sys_shmdt ((char __user *)ptr);
-       case SHMGET:
-               return sys_shmget (first, second, third);
-       case SHMCTL:
-               return sys_shmctl (first, second,
-                                  (struct shmid_ds __user *) ptr);
-       default:
-               return -ENOSYS;
-       }
-}
index 54dab47..50f2c5a 100644 (file)
 #define __ARCH_WANT_STAT64
 #define __ARCH_WANT_SYS_ALARM
 #define __ARCH_WANT_SYS_GETHOSTNAME
+#define __ARCH_WANT_SYS_IPC
 #define __ARCH_WANT_SYS_PAUSE
 #define __ARCH_WANT_SYS_SGETMASK
 #define __ARCH_WANT_SYS_SIGNAL
index 1f13fd6..f9b3f44 100644 (file)
 #include <asm/traps.h>
 #include <asm/unistd.h>
 
-/*
- * sys_ipc() is the de-multiplexer for the SysV IPC calls..
- *
- * This is really horribly ugly.
- */
-asmlinkage int sys_ipc (uint call, int first, int second,
-                       int third, void *ptr, long fifth)
-{
-       int version, ret;
-
-       version = call >> 16; /* hack for backward compatibility */
-       call &= 0xffff;
-
-       if (call <= SEMCTL)
-               switch (call) {
-               case SEMOP:
-                       return sys_semop (first, (struct sembuf *)ptr, second);
-               case SEMGET:
-                       return sys_semget (first, second, third);
-               case SEMCTL: {
-                       union semun fourth;
-                       if (!ptr)
-                               return -EINVAL;
-                       if (get_user(fourth.__pad, (void **) ptr))
-                               return -EFAULT;
-                       return sys_semctl (first, second, third, fourth);
-                       }
-               default:
-                       return -EINVAL;
-               }
-       if (call <= MSGCTL) 
-               switch (call) {
-               case MSGSND:
-                       return sys_msgsnd (first, (struct msgbuf *) ptr, 
-                                         second, third);
-               case MSGRCV:
-                       switch (version) {
-                       case 0: {
-                               struct ipc_kludge tmp;
-                               if (!ptr)
-                                       return -EINVAL;
-                               if (copy_from_user (&tmp,
-                                                   (struct ipc_kludge *)ptr,
-                                                   sizeof (tmp)))
-                                       return -EFAULT;
-                               return sys_msgrcv (first, tmp.msgp, second,
-                                                  tmp.msgtyp, third);
-                               }
-                       default:
-                               return sys_msgrcv (first,
-                                                  (struct msgbuf *) ptr,
-                                                  second, fifth, third);
-                       }
-               case MSGGET:
-                       return sys_msgget ((key_t) first, second);
-               case MSGCTL:
-                       return sys_msgctl (first, second,
-                                          (struct msqid_ds *) ptr);
-               default:
-                       return -EINVAL;
-               }
-       if (call <= SHMCTL) 
-               switch (call) {
-               case SHMAT:
-                       switch (version) {
-                       default: {
-                               ulong raddr;
-                               ret = do_shmat (first, (char *) ptr,
-                                                second, &raddr);
-                               if (ret)
-                                       return ret;
-                               return put_user (raddr, (ulong *) third);
-                       }
-                       }
-               case SHMDT: 
-                       return sys_shmdt ((char *)ptr);
-               case SHMGET:
-                       return sys_shmget (first, second, third);
-               case SHMCTL:
-                       return sys_shmctl (first, second,
-                                          (struct shmid_ds *) ptr);
-               default:
-                       return -EINVAL;
-               }
-
-       return -EINVAL;
-}
-
 /* sys_cacheflush -- no support.  */
 asmlinkage int
 sys_cacheflush (unsigned long addr, int scope, int cache, unsigned long len)
index cf701c9..7612577 100644 (file)
 #define __ARCH_WANT_STAT64
 #define __ARCH_WANT_SYS_ALARM
 #define __ARCH_WANT_SYS_GETHOSTNAME
+#define __ARCH_WANT_SYS_IPC
 #define __ARCH_WANT_SYS_PAUSE
 #define __ARCH_WANT_SYS_TIME
 #define __ARCH_WANT_SYS_UTIME
index d3c865c..cf2e727 100644 (file)
@@ -76,87 +76,6 @@ asmlinkage int sys_tas(int __user *addr)
        return oldval;
 }
 
-/*
- * sys_ipc() is the de-multiplexer for the SysV IPC calls..
- *
- * This is really horribly ugly.
- */
-asmlinkage int sys_ipc(uint call, int first, int second,
-                      int third, void __user *ptr, long fifth)
-{
-       int version, ret;
-
-       version = call >> 16; /* hack for backward compatibility */
-       call &= 0xffff;
-
-       switch (call) {
-       case SEMOP:
-               return sys_semtimedop(first, (struct sembuf __user *)ptr,
-                                     second, NULL);
-       case SEMTIMEDOP:
-               return sys_semtimedop(first, (struct sembuf __user *)ptr,
-                                     second, (const struct timespec __user *)fifth);
-       case SEMGET:
-               return sys_semget (first, second, third);
-       case SEMCTL: {
-               union semun fourth;
-               if (!ptr)
-                       return -EINVAL;
-               if (get_user(fourth.__pad, (void __user * __user *) ptr))
-                       return -EFAULT;
-               return sys_semctl (first, second, third, fourth);
-               }
-
-       case MSGSND:
-               return sys_msgsnd (first, (struct msgbuf __user *) ptr,
-                                  second, third);
-       case MSGRCV:
-               switch (version) {
-               case 0: {
-                       struct ipc_kludge tmp;
-                       if (!ptr)
-                               return -EINVAL;
-
-                       if (copy_from_user(&tmp,
-                                          (struct ipc_kludge __user *) ptr,
-                                          sizeof (tmp)))
-                               return -EFAULT;
-                       return sys_msgrcv (first, tmp.msgp, second,
-                                          tmp.msgtyp, third);
-                       }
-               default:
-                       return sys_msgrcv (first,
-                                          (struct msgbuf __user *) ptr,
-                                          second, fifth, third);
-               }
-       case MSGGET:
-               return sys_msgget ((key_t) first, second);
-       case MSGCTL:
-               return sys_msgctl (first, second,
-                                  (struct msqid_ds __user *) ptr);
-       case SHMAT: {
-               ulong raddr;
-
-               if (!access_ok(VERIFY_WRITE, (ulong __user *) third,
-                                     sizeof(ulong)))
-                       return -EFAULT;
-               ret = do_shmat (first, (char __user *) ptr, second, &raddr);
-               if (ret)
-                       return ret;
-               return put_user (raddr, (ulong __user *) third);
-               }
-       case SHMDT:
-               return sys_shmdt ((char __user *)ptr);
-       case SHMGET:
-               return sys_shmget (first, second, third);
-       case SHMCTL:
-               return sys_shmctl (first, second,
-                                  (struct shmid_ds __user *) ptr);
-       default:
-               return -ENOSYS;
-       }
-}
-
 asmlinkage int sys_uname(struct old_utsname __user * name)
 {
        int err;
index d801154..60b15d0 100644 (file)
 #define __ARCH_WANT_STAT64
 #define __ARCH_WANT_SYS_ALARM
 #define __ARCH_WANT_SYS_GETHOSTNAME
+#define __ARCH_WANT_SYS_IPC
 #define __ARCH_WANT_SYS_PAUSE
 #define __ARCH_WANT_SYS_SGETMASK
 #define __ARCH_WANT_SYS_SIGNAL
index 7b309e7..7789669 100644 (file)
@@ -46,87 +46,6 @@ asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
        return sys_mmap_pgoff(addr, len, prot, flags, fd, pgoff);
 }
 
-/*
- * sys_ipc() is the de-multiplexer for the SysV IPC calls..
- *
- * This is really horribly ugly.
- */
-asmlinkage int sys_ipc (uint call, int first, int second,
-                       int third, void __user *ptr, long fifth)
-{
-       int version, ret;
-
-       version = call >> 16; /* hack for backward compatibility */
-       call &= 0xffff;
-
-       if (call <= SEMCTL)
-               switch (call) {
-               case SEMOP:
-                       return sys_semop (first, ptr, second);
-               case SEMGET:
-                       return sys_semget (first, second, third);
-               case SEMCTL: {
-                       union semun fourth;
-                       if (!ptr)
-                               return -EINVAL;
-                       if (get_user(fourth.__pad, (void __user *__user *) ptr))
-                               return -EFAULT;
-                       return sys_semctl (first, second, third, fourth);
-                       }
-               default:
-                       return -ENOSYS;
-               }
-       if (call <= MSGCTL)
-               switch (call) {
-               case MSGSND:
-                       return sys_msgsnd (first, ptr, second, third);
-               case MSGRCV:
-                       switch (version) {
-                       case 0: {
-                               struct ipc_kludge tmp;
-                               if (!ptr)
-                                       return -EINVAL;
-                               if (copy_from_user (&tmp, ptr, sizeof (tmp)))
-                                       return -EFAULT;
-                               return sys_msgrcv (first, tmp.msgp, second,
-                                                  tmp.msgtyp, third);
-                               }
-                       default:
-                               return sys_msgrcv (first, ptr,
-                                                  second, fifth, third);
-                       }
-               case MSGGET:
-                       return sys_msgget ((key_t) first, second);
-               case MSGCTL:
-                       return sys_msgctl (first, second, ptr);
-               default:
-                       return -ENOSYS;
-               }
-       if (call <= SHMCTL)
-               switch (call) {
-               case SHMAT:
-                       switch (version) {
-                       default: {
-                               ulong raddr;
-                               ret = do_shmat (first, ptr, second, &raddr);
-                               if (ret)
-                                       return ret;
-                               return put_user (raddr, (ulong __user *) third);
-                       }
-                       }
-               case SHMDT:
-                       return sys_shmdt (ptr);
-               case SHMGET:
-                       return sys_shmget (first, second, third);
-               case SHMCTL:
-                       return sys_shmctl (first, second, ptr);
-               default:
-                       return -ENOSYS;
-               }
-
-       return -EINVAL;
-}
-
 /* Convert virtual (user) address VADDR to physical address PADDR */
 #define virt_to_phys_040(vaddr)                                                \
 ({                                                                     \
index 3e371cc..d65e9c4 100644 (file)
 #include <asm/cacheflush.h>
 #include <asm/unistd.h>
 
-/*
- * sys_ipc() is the de-multiplexer for the SysV IPC calls..
- *
- * This is really horribly ugly.
- */
-asmlinkage int sys_ipc (uint call, int first, int second,
-                       int third, void *ptr, long fifth)
-{
-       int version, ret;
-
-       version = call >> 16; /* hack for backward compatibility */
-       call &= 0xffff;
-
-       if (call <= SEMCTL)
-               switch (call) {
-               case SEMOP:
-                       return sys_semop (first, (struct sembuf *)ptr, second);
-               case SEMGET:
-                       return sys_semget (first, second, third);
-               case SEMCTL: {
-                       union semun fourth;
-                       if (!ptr)
-                               return -EINVAL;
-                       if (get_user(fourth.__pad, (void **) ptr))
-                               return -EFAULT;
-                       return sys_semctl (first, second, third, fourth);
-                       }
-               default:
-                       return -EINVAL;
-               }
-       if (call <= MSGCTL) 
-               switch (call) {
-               case MSGSND:
-                       return sys_msgsnd (first, (struct msgbuf *) ptr, 
-                                         second, third);
-               case MSGRCV:
-                       switch (version) {
-                       case 0: {
-                               struct ipc_kludge tmp;
-                               if (!ptr)
-                                       return -EINVAL;
-                               if (copy_from_user (&tmp,
-                                                   (struct ipc_kludge *)ptr,
-                                                   sizeof (tmp)))
-                                       return -EFAULT;
-                               return sys_msgrcv (first, tmp.msgp, second,
-                                                  tmp.msgtyp, third);
-                               }
-                       default:
-                               return sys_msgrcv (first,
-                                                  (struct msgbuf *) ptr,
-                                                  second, fifth, third);
-                       }
-               case MSGGET:
-                       return sys_msgget ((key_t) first, second);
-               case MSGCTL:
-                       return sys_msgctl (first, second,
-                                          (struct msqid_ds *) ptr);
-               default:
-                       return -EINVAL;
-               }
-       if (call <= SHMCTL)
-               switch (call) {
-               case SHMAT:
-                       switch (version) {
-                       default: {
-                               ulong raddr;
-                               ret = do_shmat (first, ptr, second, &raddr);
-                               if (ret)
-                                       return ret;
-                               return put_user (raddr, (ulong __user *) third);
-                       }
-                       }
-               case SHMDT:
-                       return sys_shmdt (ptr);
-               case SHMGET:
-                       return sys_shmget (first, second, third);
-               case SHMCTL:
-                       return sys_shmctl (first, second, ptr);
-               default:
-                       return -ENOSYS;
-               }
-
-       return -EINVAL;
-}
-
 /* sys_cacheflush -- flush (part of) the processor cache.  */
 asmlinkage int
 sys_cacheflush (unsigned long addr, int scope, int cache, unsigned long len)
index 65c679e..97fe472 100644 (file)
 #define __ARCH_WANT_OLD_READDIR
 #define __ARCH_WANT_SYS_ALARM
 #define __ARCH_WANT_SYS_GETHOSTNAME
+#define __ARCH_WANT_SYS_IPC
 #define __ARCH_WANT_SYS_PAUSE
 #define __ARCH_WANT_SYS_SGETMASK
 #define __ARCH_WANT_SYS_UTIME
index 3f7f466..257bf01 100644 (file)
@@ -407,94 +407,6 @@ _sys_sysmips(nabi_no_regargs struct pt_regs regs)
 }
 
 /*
- * sys_ipc() is the de-multiplexer for the SysV IPC calls..
- *
- * This is really horribly ugly.
- */
-SYSCALL_DEFINE6(ipc, unsigned int, call, int, first, int, second,
-       unsigned long, third, void __user *, ptr, long, fifth)
-{
-       int version, ret;
-
-       version = call >> 16; /* hack for backward compatibility */
-       call &= 0xffff;
-
-       switch (call) {
-       case SEMOP:
-               return sys_semtimedop(first, (struct sembuf __user *)ptr,
-                                     second, NULL);
-       case SEMTIMEDOP:
-               return sys_semtimedop(first, (struct sembuf __user *)ptr,
-                                     second,
-                                     (const struct timespec __user *)fifth);
-       case SEMGET:
-               return sys_semget(first, second, third);
-       case SEMCTL: {
-               union semun fourth;
-               if (!ptr)
-                       return -EINVAL;
-               if (get_user(fourth.__pad, (void __user *__user *) ptr))
-                       return -EFAULT;
-               return sys_semctl(first, second, third, fourth);
-       }
-
-       case MSGSND:
-               return sys_msgsnd(first, (struct msgbuf __user *) ptr,
-                                 second, third);
-       case MSGRCV:
-               switch (version) {
-               case 0: {
-                       struct ipc_kludge tmp;
-                       if (!ptr)
-                               return -EINVAL;
-
-                       if (copy_from_user(&tmp,
-                                          (struct ipc_kludge __user *) ptr,
-                                          sizeof(tmp)))
-                               return -EFAULT;
-                       return sys_msgrcv(first, tmp.msgp, second,
-                                         tmp.msgtyp, third);
-               }
-               default:
-                       return sys_msgrcv(first,
-                                         (struct msgbuf __user *) ptr,
-                                         second, fifth, third);
-               }
-       case MSGGET:
-               return sys_msgget((key_t) first, second);
-       case MSGCTL:
-               return sys_msgctl(first, second,
-                                 (struct msqid_ds __user *) ptr);
-
-       case SHMAT:
-               switch (version) {
-               default: {
-                       unsigned long raddr;
-                       ret = do_shmat(first, (char __user *) ptr, second,
-                                      &raddr);
-                       if (ret)
-                               return ret;
-                       return put_user(raddr, (unsigned long __user *) third);
-               }
-               case 1: /* iBCS2 emulator entry point */
-                       if (!segment_eq(get_fs(), get_ds()))
-                               return -EINVAL;
-                       return do_shmat(first, (char __user *) ptr, second,
-                                       (unsigned long *) third);
-               }
-       case SHMDT:
-               return sys_shmdt((char __user *)ptr);
-       case SHMGET:
-               return sys_shmget(first, second, third);
-       case SHMCTL:
-               return sys_shmctl(first, second,
-                                 (struct shmid_ds __user *) ptr);
-       default:
-               return -ENOSYS;
-       }
-}
-
-/*
  * No implemented yet ...
  */
 SYSCALL_DEFINE3(cachectl, char *, addr, int, nbytes, int, op)
index d13a56e..9d056f5 100644 (file)
 #define __ARCH_WANT_STAT64
 #define __ARCH_WANT_SYS_ALARM
 #define __ARCH_WANT_SYS_GETHOSTNAME
+#define __ARCH_WANT_SYS_IPC
 #define __ARCH_WANT_SYS_PAUSE
 #define __ARCH_WANT_SYS_SGETMASK
 #define __ARCH_WANT_SYS_SIGNAL
index bef69d6..815f135 100644 (file)
@@ -31,91 +31,3 @@ asmlinkage long old_mmap(unsigned long addr, unsigned long len,
                return -EINVAL;
        return sys_mmap_pgoff(addr, len, prot, flags, fd, offset >> PAGE_SHIFT);
 }
-
-/*
- * sys_ipc() is the de-multiplexer for the SysV IPC calls..
- *
- * This is really horribly ugly.
- */
-asmlinkage long sys_ipc(uint call, int first, int second,
-                       int third, void __user *ptr, long fifth)
-{
-       int version, ret;
-
-       version = call >> 16; /* hack for backward compatibility */
-       call &= 0xffff;
-
-       switch (call) {
-       case SEMOP:
-               return sys_semtimedop(first, (struct sembuf __user *)ptr,
-                                     second, NULL);
-       case SEMTIMEDOP:
-               return sys_semtimedop(first, (struct sembuf __user *)ptr,
-                                     second,
-                                     (const struct timespec __user *)fifth);
-       case SEMGET:
-               return sys_semget(first, second, third);
-       case SEMCTL: {
-               union semun fourth;
-               if (!ptr)
-                       return -EINVAL;
-               if (get_user(fourth.__pad, (void __user * __user *) ptr))
-                       return -EFAULT;
-               return sys_semctl(first, second, third, fourth);
-       }
-
-       case MSGSND:
-               return sys_msgsnd(first, (struct msgbuf __user *) ptr,
-                                 second, third);
-       case MSGRCV:
-               switch (version) {
-               case 0: {
-                       struct ipc_kludge tmp;
-                       if (!ptr)
-                               return -EINVAL;
-
-                       if (copy_from_user(&tmp,
-                                          (struct ipc_kludge __user *) ptr,
-                                          sizeof(tmp)))
-                               return -EFAULT;
-                       return sys_msgrcv(first, tmp.msgp, second,
-                                         tmp.msgtyp, third);
-               }
-               default:
-                       return sys_msgrcv(first,
-                                         (struct msgbuf __user *) ptr,
-                                          second, fifth, third);
-               }
-       case MSGGET:
-               return sys_msgget((key_t) first, second);
-       case MSGCTL:
-               return sys_msgctl(first, second,
-                                  (struct msqid_ds __user *) ptr);
-
-       case SHMAT:
-               switch (version) {
-               default: {
-                       ulong raddr;
-                       ret = do_shmat(first, (char __user *) ptr, second,
-                                      &raddr);
-                       if (ret)
-                               return ret;
-                       return put_user(raddr, (ulong *) third);
-               }
-               case 1: /* iBCS2 emulator entry point */
-                       if (!segment_eq(get_fs(), get_ds()))
-                               return -EINVAL;
-                       return do_shmat(first, (char __user *) ptr, second,
-                                       (ulong *) third);
-               }
-       case SHMDT:
-               return sys_shmdt((char __user *)ptr);
-       case SHMGET:
-               return sys_shmget(first, second, third);
-       case SHMCTL:
-               return sys_shmctl(first, second,
-                                 (struct shmid_ds __user *) ptr);
-       default:
-               return -EINVAL;
-       }
-}
index eb8eb40..23bb74e 100644 (file)
@@ -35,8 +35,6 @@ asmlinkage long sys_pipe2(int __user *fildes, int flags);
 asmlinkage long sys_rt_sigaction(int sig,
                const struct sigaction __user *act,
                struct sigaction __user *oact, size_t sigsetsize);
-asmlinkage int sys_ipc(uint call, int first, unsigned long second,
-               long third, void __user *ptr, long fifth);
 asmlinkage long ppc64_personality(unsigned long personality);
 asmlinkage int ppc_rtas(struct rtas_args __user *uargs);
 asmlinkage time_t sys64_time(time_t __user * tloc);
index f6ca761..c13821f 100644 (file)
 #define __ARCH_WANT_STAT64
 #define __ARCH_WANT_SYS_ALARM
 #define __ARCH_WANT_SYS_GETHOSTNAME
+#define __ARCH_WANT_SYS_IPC
 #define __ARCH_WANT_SYS_PAUSE
 #define __ARCH_WANT_SYS_SGETMASK
 #define __ARCH_WANT_SYS_SIGNAL
index 3370e62..5251221 100644 (file)
 #include <asm/time.h>
 #include <asm/unistd.h>
 
-/*
- * sys_ipc() is the de-multiplexer for the SysV IPC calls..
- *
- * This is really horribly ugly.
- */
-int sys_ipc(uint call, int first, unsigned long second, long third,
-           void __user *ptr, long fifth)
-{
-       int version, ret;
-
-       version = call >> 16; /* hack for backward compatibility */
-       call &= 0xffff;
-
-       ret = -ENOSYS;
-       switch (call) {
-       case SEMOP:
-               ret = sys_semtimedop(first, (struct sembuf __user *)ptr,
-                                     (unsigned)second, NULL);
-               break;
-       case SEMTIMEDOP:
-               ret = sys_semtimedop(first, (struct sembuf __user *)ptr,
-                                     (unsigned)second,
-                                     (const struct timespec __user *) fifth);
-               break;
-       case SEMGET:
-               ret = sys_semget (first, (int)second, third);
-               break;
-       case SEMCTL: {
-               union semun fourth;
-
-               ret = -EINVAL;
-               if (!ptr)
-                       break;
-               if ((ret = get_user(fourth.__pad, (void __user * __user *)ptr)))
-                       break;
-               ret = sys_semctl(first, (int)second, third, fourth);
-               break;
-       }
-       case MSGSND:
-               ret = sys_msgsnd(first, (struct msgbuf __user *)ptr,
-                                (size_t)second, third);
-               break;
-       case MSGRCV:
-               switch (version) {
-               case 0: {
-                       struct ipc_kludge tmp;
-
-                       ret = -EINVAL;
-                       if (!ptr)
-                               break;
-                       if ((ret = copy_from_user(&tmp,
-                                               (struct ipc_kludge __user *) ptr,
-                                               sizeof (tmp)) ? -EFAULT : 0))
-                               break;
-                       ret = sys_msgrcv(first, tmp.msgp, (size_t) second,
-                                         tmp.msgtyp, third);
-                       break;
-               }
-               default:
-                       ret = sys_msgrcv (first, (struct msgbuf __user *) ptr,
-                                         (size_t)second, fifth, third);
-                       break;
-               }
-               break;
-       case MSGGET:
-               ret = sys_msgget((key_t)first, (int)second);
-               break;
-       case MSGCTL:
-               ret = sys_msgctl(first, (int)second,
-                                 (struct msqid_ds __user *)ptr);
-               break;
-       case SHMAT: {
-               ulong raddr;
-               ret = do_shmat(first, (char __user *)ptr, (int)second, &raddr);
-               if (ret)
-                       break;
-               ret = put_user(raddr, (ulong __user *) third);
-               break;
-       }
-       case SHMDT:
-               ret = sys_shmdt((char __user *)ptr);
-               break;
-       case SHMGET:
-               ret = sys_shmget(first, (size_t)second, third);
-               break;
-       case SHMCTL:
-               ret = sys_shmctl(first, (int)second,
-                                (struct shmid_ds __user *)ptr);
-               break;
-       }
-
-       return ret;
-}
-
 static inline unsigned long do_mmap2(unsigned long addr, size_t len,
                        unsigned long prot, unsigned long flags,
                        unsigned long fd, unsigned long off, int shift)
index 5de54d2..15fd68b 100644 (file)
@@ -30,7 +30,7 @@ struct fadvise64_64_args;
 struct old_sigaction;
 
 long sys_mmap2(struct s390_mmap_arg_struct __user  *arg);
-long sys_ipc(uint call, int first, unsigned long second,
+long sys_s390_ipc(uint call, int first, unsigned long second,
             unsigned long third, void __user *ptr);
 long sys_s390_newuname(struct new_utsname __user *name);
 long sys_s390_personality(unsigned long personality);
index b256350..b8b7809 100644 (file)
@@ -64,7 +64,7 @@ out:
  *
  * This is really horribly ugly.
  */
-SYSCALL_DEFINE5(ipc, uint, call, int, first, unsigned long, second,
+SYSCALL_DEFINE5(s390_ipc, uint, call, int, first, unsigned long, second,
                unsigned long, third, void __user *, ptr)
 {
         struct ipc_kludge tmp;
index 2a24766..990ac8b 100644 (file)
@@ -125,7 +125,7 @@ NI_SYSCALL                                                  /* vm86old for i386 */
 SYSCALL(sys_wait4,sys_wait4,compat_sys_wait4_wrapper)
 SYSCALL(sys_swapoff,sys_swapoff,sys32_swapoff_wrapper)         /* 115 */
 SYSCALL(sys_sysinfo,sys_sysinfo,compat_sys_sysinfo_wrapper)
-SYSCALL(sys_ipc,sys_ipc,sys32_ipc_wrapper)
+SYSCALL(sys_s390_ipc,sys_s390_ipc,sys32_ipc_wrapper)
 SYSCALL(sys_fsync,sys_fsync,sys32_fsync_wrapper)
 SYSCALL(sys_sigreturn,sys_sigreturn,sys32_sigreturn)
 SYSCALL(sys_clone,sys_clone,sys_clone_wrapper)                 /* 120 */
index c1e2b8d..c1ce286 100644 (file)
@@ -11,8 +11,6 @@ asmlinkage int old_mmap(unsigned long addr, unsigned long len,
 asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
                          unsigned long prot, unsigned long flags,
                          unsigned long fd, unsigned long pgoff);
-asmlinkage int sys_ipc(uint call, int first, int second,
-                      int third, void __user *ptr, long fifth);
 asmlinkage int sys_uname(struct old_utsname __user *name);
 
 #ifdef CONFIG_SUPERH32
index 365744b..a48f65e 100644 (file)
 #define __ARCH_WANT_STAT64
 #define __ARCH_WANT_SYS_ALARM
 #define __ARCH_WANT_SYS_GETHOSTNAME
+#define __ARCH_WANT_SYS_IPC
 #define __ARCH_WANT_SYS_PAUSE
 #define __ARCH_WANT_SYS_SGETMASK
 #define __ARCH_WANT_SYS_SIGNAL
index 25de158..7709b2b 100644 (file)
 #define __ARCH_WANT_STAT64
 #define __ARCH_WANT_SYS_ALARM
 #define __ARCH_WANT_SYS_GETHOSTNAME
+#define __ARCH_WANT_SYS_IPC
 #define __ARCH_WANT_SYS_PAUSE
 #define __ARCH_WANT_SYS_SGETMASK
 #define __ARCH_WANT_SYS_SIGNAL
index 71399cd..c18cfaa 100644 (file)
@@ -53,110 +53,6 @@ asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
        return sys_mmap_pgoff(addr, len, prot, flags, fd, pgoff);
 }
 
-/*
- * sys_ipc() is the de-multiplexer for the SysV IPC calls..
- *
- * This is really horribly ugly.
- */
-asmlinkage int sys_ipc(uint call, int first, int second,
-                      int third, void __user *ptr, long fifth)
-{
-       int version, ret;
-
-       version = call >> 16; /* hack for backward compatibility */
-       call &= 0xffff;
-
-       if (call <= SEMTIMEDOP)
-               switch (call) {
-               case SEMOP:
-                       return sys_semtimedop(first,
-                                             (struct sembuf __user *)ptr,
-                                             second, NULL);
-               case SEMTIMEDOP:
-                       return sys_semtimedop(first,
-                               (struct sembuf __user *)ptr, second,
-                               (const struct timespec __user *)fifth);
-               case SEMGET:
-                       return sys_semget (first, second, third);
-               case SEMCTL: {
-                       union semun fourth;
-                       if (!ptr)
-                               return -EINVAL;
-                       if (get_user(fourth.__pad, (void __user * __user *) ptr))
-                               return -EFAULT;
-                       return sys_semctl (first, second, third, fourth);
-                       }
-               default:
-                       return -EINVAL;
-               }
-
-       if (call <= MSGCTL)
-               switch (call) {
-               case MSGSND:
-                       return sys_msgsnd (first, (struct msgbuf __user *) ptr,
-                                         second, third);
-               case MSGRCV:
-                       switch (version) {
-                       case 0:
-                       {
-                               struct ipc_kludge tmp;
-
-                               if (!ptr)
-                                       return -EINVAL;
-
-                               if (copy_from_user(&tmp,
-                                       (struct ipc_kludge __user *) ptr,
-                                                  sizeof (tmp)))
-                                       return -EFAULT;
-
-                               return sys_msgrcv (first, tmp.msgp, second,
-                                                  tmp.msgtyp, third);
-                       }
-                       default:
-                               return sys_msgrcv (first,
-                                                  (struct msgbuf __user *) ptr,
-                                                  second, fifth, third);
-                       }
-               case MSGGET:
-                       return sys_msgget ((key_t) first, second);
-               case MSGCTL:
-                       return sys_msgctl (first, second,
-                                          (struct msqid_ds __user *) ptr);
-               default:
-                       return -EINVAL;
-               }
-       if (call <= SHMCTL)
-               switch (call) {
-               case SHMAT:
-                       switch (version) {
-                       default: {
-                               ulong raddr;
-                               ret = do_shmat (first, (char __user *) ptr,
-                                                second, &raddr);
-                               if (ret)
-                                       return ret;
-                               return put_user (raddr, (ulong __user *) third);
-                       }
-                       case 1: /* iBCS2 emulator entry point */
-                               if (!segment_eq(get_fs(), get_ds()))
-                                       return -EINVAL;
-                               return do_shmat (first, (char __user *) ptr,
-                                                 second, (ulong *) third);
-                       }
-               case SHMDT:
-                       return sys_shmdt ((char __user *)ptr);
-               case SHMGET:
-                       return sys_shmget (first, second, third);
-               case SHMCTL:
-                       return sys_shmctl (first, second,
-                                          (struct shmid_ds __user *) ptr);
-               default:
-                       return -EINVAL;
-               }
-
-       return -EINVAL;
-}
-
 /* sys_cacheflush -- flush (part of) the processor cache.  */
 asmlinkage int sys_cacheflush(unsigned long addr, unsigned long len, int op)
 {
index cb4b9bf..d0b3b01 100644 (file)
 #define __ARCH_WANT_SYS_SIGPENDING
 #define __ARCH_WANT_SYS_SIGPROCMASK
 #define __ARCH_WANT_SYS_RT_SIGSUSPEND
-#ifndef __32bit_syscall_numbers__
+#ifdef __32bit_syscall_numbers__
+#define __ARCH_WANT_SYS_IPC
+#else
 #define __ARCH_WANT_COMPAT_SYS_TIME
 #define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND
 #endif
index 3a82e65..ee995b7 100644 (file)
@@ -98,119 +98,6 @@ out:
        return error;
 }
 
-/*
- * sys_ipc() is the de-multiplexer for the SysV IPC calls..
- *
- * This is really horribly ugly.
- */
-
-asmlinkage int sys_ipc (uint call, int first, int second, int third, void __user *ptr, long fifth)
-{
-       int version, err;
-
-       version = call >> 16; /* hack for backward compatibility */
-       call &= 0xffff;
-
-       if (call <= SEMCTL)
-               switch (call) {
-               case SEMOP:
-                       err = sys_semtimedop (first, (struct sembuf __user *)ptr, second, NULL);
-                       goto out;
-               case SEMTIMEDOP:
-                       err = sys_semtimedop (first, (struct sembuf __user *)ptr, second, (const struct timespec __user *) fifth);
-                       goto out;
-               case SEMGET:
-                       err = sys_semget (first, second, third);
-                       goto out;
-               case SEMCTL: {
-                       union semun fourth;
-                       err = -EINVAL;
-                       if (!ptr)
-                               goto out;
-                       err = -EFAULT;
-                       if (get_user(fourth.__pad,
-                                    (void __user * __user *)ptr))
-                               goto out;
-                       err = sys_semctl (first, second, third, fourth);
-                       goto out;
-                       }
-               default:
-                       err = -ENOSYS;
-                       goto out;
-               }
-       if (call <= MSGCTL) 
-               switch (call) {
-               case MSGSND:
-                       err = sys_msgsnd (first, (struct msgbuf __user *) ptr, 
-                                         second, third);
-                       goto out;
-               case MSGRCV:
-                       switch (version) {
-                       case 0: {
-                               struct ipc_kludge tmp;
-                               err = -EINVAL;
-                               if (!ptr)
-                                       goto out;
-                               err = -EFAULT;
-                               if (copy_from_user(&tmp, (struct ipc_kludge __user *) ptr, sizeof (tmp)))
-                                       goto out;
-                               err = sys_msgrcv (first, tmp.msgp, second, tmp.msgtyp, third);
-                               goto out;
-                               }
-                       case 1: default:
-                               err = sys_msgrcv (first,
-                                                 (struct msgbuf __user *) ptr,
-                                                 second, fifth, third);
-                               goto out;
-                       }
-               case MSGGET:
-                       err = sys_msgget ((key_t) first, second);
-                       goto out;
-               case MSGCTL:
-                       err = sys_msgctl (first, second, (struct msqid_ds __user *) ptr);
-                       goto out;
-               default:
-                       err = -ENOSYS;
-                       goto out;
-               }
-       if (call <= SHMCTL) 
-               switch (call) {
-               case SHMAT:
-                       switch (version) {
-                       case 0: default: {
-                               ulong raddr;
-                               err = do_shmat (first, (char __user *) ptr, second, &raddr);
-                               if (err)
-                                       goto out;
-                               err = -EFAULT;
-                               if (put_user (raddr, (ulong __user *) third))
-                                       goto out;
-                               err = 0;
-                               goto out;
-                               }
-                       case 1: /* iBCS2 emulator entry point */
-                               err = -EINVAL;
-                               goto out;
-                       }
-               case SHMDT: 
-                       err = sys_shmdt ((char __user *)ptr);
-                       goto out;
-               case SHMGET:
-                       err = sys_shmget (first, second, third);
-                       goto out;
-               case SHMCTL:
-                       err = sys_shmctl (first, second, (struct shmid_ds __user *) ptr);
-                       goto out;
-               default:
-                       err = -ENOSYS;
-                       goto out;
-               }
-       else
-               err = -ENOSYS;
-out:
-       return err;
-}
-
 int sparc_mmap_check(unsigned long addr, unsigned long len)
 {
        if (ARCH_SUN4C &&
index cb1bef6..45410e9 100644 (file)
@@ -426,7 +426,7 @@ out:
  * This is really horribly ugly.
  */
 
-SYSCALL_DEFINE6(ipc, unsigned int, call, int, first, unsigned long, second,
+SYSCALL_DEFINE6(sparc_ipc, unsigned int, call, int, first, unsigned long, second,
                unsigned long, third, void __user *, ptr, long, fifth)
 {
        long err;
index 68312fe..2c331c3 100644 (file)
@@ -10,7 +10,7 @@ struct new_utsname;
 
 extern asmlinkage unsigned long sys_getpagesize(void);
 extern asmlinkage long sparc_pipe(struct pt_regs *regs);
-extern asmlinkage long sys_ipc(unsigned int call, int first,
+extern asmlinkage long sys_sparc_ipc(unsigned int call, int first,
                               unsigned long second,
                               unsigned long third,
                               void __user *ptr, long fifth);
index 1761425..30ca2b1 100644 (file)
@@ -136,7 +136,7 @@ sys_call_table:
 /*200*/        .word sys_ssetmask, sys_nis_syscall, sys_newlstat, sys_uselib, sys_nis_syscall
        .word sys_readahead, sys_socketcall, sys_syslog, sys_lookup_dcookie, sys_fadvise64
 /*210*/        .word sys_fadvise64_64, sys_tgkill, sys_waitpid, sys_swapoff, sys_sysinfo
-       .word sys_ipc, sys_nis_syscall, sys_clone, sys_ioprio_get, sys_adjtimex
+       .word sys_sparc_ipc, sys_nis_syscall, sys_clone, sys_ioprio_get, sys_adjtimex
 /*220*/        .word sys_nis_syscall, sys_ni_syscall, sys_delete_module, sys_ni_syscall, sys_getpgid
        .word sys_bdflush, sys_sysfs, sys_nis_syscall, sys_setfsuid, sys_setfsgid
 /*230*/        .word sys_select, sys_nis_syscall, sys_splice, sys_stime, sys_statfs64
index d0aa8f1..70ca357 100644 (file)
@@ -34,92 +34,6 @@ long sys_clone(unsigned long clone_flags, unsigned long newsp,
        return ret;
 }
 
-/*
- * sys_ipc() is the de-multiplexer for the SysV IPC calls..
- *
- * This is really horribly ugly.
- */
-long sys_ipc (uint call, int first, int second,
-            int third, void __user *ptr, long fifth)
-{
-       int version, ret;
-
-       version = call >> 16; /* hack for backward compatibility */
-       call &= 0xffff;
-
-       switch (call) {
-       case SEMOP:
-               return sys_semtimedop(first, (struct sembuf __user *) ptr,
-                                     second, NULL);
-       case SEMTIMEDOP:
-               return sys_semtimedop(first, (struct sembuf __user *) ptr,
-                                     second,
-                                     (const struct timespec __user *) fifth);
-       case SEMGET:
-               return sys_semget (first, second, third);
-       case SEMCTL: {
-               union semun fourth;
-               if (!ptr)
-                       return -EINVAL;
-               if (get_user(fourth.__pad, (void __user * __user *) ptr))
-                       return -EFAULT;
-               return sys_semctl (first, second, third, fourth);
-       }
-
-       case MSGSND:
-               return sys_msgsnd (first, (struct msgbuf *) ptr,
-                                  second, third);
-       case MSGRCV:
-               switch (version) {
-               case 0: {
-                       struct ipc_kludge tmp;
-                       if (!ptr)
-                               return -EINVAL;
-
-                       if (copy_from_user(&tmp,
-                                          (struct ipc_kludge *) ptr,
-                                          sizeof (tmp)))
-                               return -EFAULT;
-                       return sys_msgrcv (first, tmp.msgp, second,
-                                          tmp.msgtyp, third);
-               }
-               default:
-                       panic("msgrcv with version != 0");
-                       return sys_msgrcv (first,
-                                          (struct msgbuf *) ptr,
-                                          second, fifth, third);
-               }
-       case MSGGET:
-               return sys_msgget ((key_t) first, second);
-       case MSGCTL:
-               return sys_msgctl (first, second, (struct msqid_ds *) ptr);
-
-       case SHMAT:
-               switch (version) {
-               default: {
-                       ulong raddr;
-                       ret = do_shmat (first, (char *) ptr, second, &raddr);
-                       if (ret)
-                               return ret;
-                       return put_user (raddr, (ulong *) third);
-               }
-               case 1: /* iBCS2 emulator entry point */
-                       if (!segment_eq(get_fs(), get_ds()))
-                               return -EINVAL;
-                       return do_shmat (first, (char *) ptr, second, (ulong *) third);
-               }
-       case SHMDT:
-               return sys_shmdt ((char *)ptr);
-       case SHMGET:
-               return sys_shmget (first, second, third);
-       case SHMCTL:
-               return sys_shmctl (first, second,
-                                  (struct shmid_ds *) ptr);
-       default:
-               return -ENOSYS;
-       }
-}
-
 long sys_sigaction(int sig, const struct old_sigaction __user *act,
                         struct old_sigaction __user *oact)
 {
index 86ab6a0..50f6a56 100644 (file)
@@ -54,7 +54,6 @@ unsigned long sys_sigreturn(struct pt_regs *);
 struct oldold_utsname;
 struct old_utsname;
 
-asmlinkage int sys_ipc(uint, int, int, int, void __user *, long);
 asmlinkage int sys_uname(struct old_utsname __user *);
 asmlinkage int sys_olduname(struct oldold_utsname __user *);
 
index daa65d9..45e64a1 100644 (file)
 #define __ARCH_WANT_STAT64
 #define __ARCH_WANT_SYS_ALARM
 #define __ARCH_WANT_SYS_GETHOSTNAME
+#define __ARCH_WANT_SYS_IPC
 #define __ARCH_WANT_SYS_PAUSE
 #define __ARCH_WANT_SYS_SGETMASK
 #define __ARCH_WANT_SYS_SIGNAL
index 7955e90..8b5c348 100644 (file)
 #include <asm/syscalls.h>
 
 /*
- * sys_ipc() is the de-multiplexer for the SysV IPC calls..
- *
- * This is really horribly ugly.
- */
-asmlinkage int sys_ipc(uint call, int first, int second,
-                       int third, void __user *ptr, long fifth)
-{
-       int version, ret;
-
-       version = call >> 16; /* hack for backward compatibility */
-       call &= 0xffff;
-
-       switch (call) {
-       case SEMOP:
-               return sys_semtimedop(first, (struct sembuf __user *)ptr, second, NULL);
-       case SEMTIMEDOP:
-               return sys_semtimedop(first, (struct sembuf __user *)ptr, second,
-                                       (const struct timespec __user *)fifth);
-
-       case SEMGET:
-               return sys_semget(first, second, third);
-       case SEMCTL: {
-               union semun fourth;
-               if (!ptr)
-                       return -EINVAL;
-               if (get_user(fourth.__pad, (void __user * __user *) ptr))
-                       return -EFAULT;
-               return sys_semctl(first, second, third, fourth);
-       }
-
-       case MSGSND:
-               return sys_msgsnd(first, (struct msgbuf __user *) ptr,
-                                  second, third);
-       case MSGRCV:
-               switch (version) {
-               case 0: {
-                       struct ipc_kludge tmp;
-                       if (!ptr)
-                               return -EINVAL;
-
-                       if (copy_from_user(&tmp,
-                                          (struct ipc_kludge __user *) ptr,
-                                          sizeof(tmp)))
-                               return -EFAULT;
-                       return sys_msgrcv(first, tmp.msgp, second,
-                                          tmp.msgtyp, third);
-               }
-               default:
-                       return sys_msgrcv(first,
-                                          (struct msgbuf __user *) ptr,
-                                          second, fifth, third);
-               }
-       case MSGGET:
-               return sys_msgget((key_t) first, second);
-       case MSGCTL:
-               return sys_msgctl(first, second, (struct msqid_ds __user *) ptr);
-
-       case SHMAT:
-               switch (version) {
-               default: {
-                       ulong raddr;
-                       ret = do_shmat(first, (char __user *) ptr, second, &raddr);
-                       if (ret)
-                               return ret;
-                       return put_user(raddr, (ulong __user *) third);
-               }
-               case 1: /* iBCS2 emulator entry point */
-                       if (!segment_eq(get_fs(), get_ds()))
-                               return -EINVAL;
-                       /* The "(ulong *) third" is valid _only_ because of the kernel segment thing */
-                       return do_shmat(first, (char __user *) ptr, second, (ulong *) third);
-               }
-       case SHMDT:
-               return sys_shmdt((char __user *)ptr);
-       case SHMGET:
-               return sys_shmget(first, second, third);
-       case SHMCTL:
-               return sys_shmctl(first, second,
-                                  (struct shmid_ds __user *) ptr);
-       default:
-               return -ENOSYS;
-       }
-}
-
-/*
  * Old cruft
  */
 asmlinkage int sys_uname(struct old_utsname __user *name)
index b60907e..fbb61ae 100644 (file)
@@ -684,6 +684,8 @@ asmlinkage long sys_shmat(int shmid, char __user *shmaddr, int shmflg);
 asmlinkage long sys_shmget(key_t key, size_t size, int flag);
 asmlinkage long sys_shmdt(char __user *shmaddr);
 asmlinkage long sys_shmctl(int shmid, int cmd, struct shmid_ds __user *buf);
+asmlinkage long sys_ipc(unsigned int call, int first, int second,
+               unsigned long third, void __user *ptr, long fifth);
 
 asmlinkage long sys_mq_open(const char __user *name, int oflag, mode_t mode, struct mq_attr __user *attr);
 asmlinkage long sys_mq_unlink(const char __user *name);
index 4e1955e..9075e17 100644 (file)
@@ -3,7 +3,7 @@
 #
 
 obj-$(CONFIG_SYSVIPC_COMPAT) += compat.o
-obj-$(CONFIG_SYSVIPC) += util.o msgutil.o msg.o sem.o shm.o ipcns_notifier.o
+obj-$(CONFIG_SYSVIPC) += util.o msgutil.o msg.o sem.o shm.o ipcns_notifier.o syscall.o
 obj-$(CONFIG_SYSVIPC_SYSCTL) += ipc_sysctl.o
 obj_mq-$(CONFIG_COMPAT) += compat_mq.o
 obj-$(CONFIG_POSIX_MQUEUE) += mqueue.o msgutil.o $(obj_mq-y)
diff --git a/ipc/syscall.c b/ipc/syscall.c
new file mode 100644 (file)
index 0000000..355a3da
--- /dev/null
@@ -0,0 +1,99 @@
+/*
+ * sys_ipc() is the old de-multiplexer for the SysV IPC calls.
+ *
+ * This is really horribly ugly, and new architectures should just wire up
+ * the individual syscalls instead.
+ */
+#include <linux/unistd.h>
+
+#ifdef __ARCH_WANT_SYS_IPC
+#include <linux/errno.h>
+#include <linux/ipc.h>
+#include <linux/shm.h>
+#include <linux/syscalls.h>
+#include <linux/uaccess.h>
+
+SYSCALL_DEFINE6(ipc, unsigned int, call, int, first, int, second,
+               unsigned long, third, void __user *, ptr, long, fifth)
+{
+       int version, ret;
+
+       version = call >> 16; /* hack for backward compatibility */
+       call &= 0xffff;
+
+       switch (call) {
+       case SEMOP:
+               return sys_semtimedop(first, (struct sembuf __user *)ptr,
+                                     second, NULL);
+       case SEMTIMEDOP:
+               return sys_semtimedop(first, (struct sembuf __user *)ptr,
+                                     second,
+                                     (const struct timespec __user *)fifth);
+
+       case SEMGET:
+               return sys_semget(first, second, third);
+       case SEMCTL: {
+               union semun fourth;
+               if (!ptr)
+                       return -EINVAL;
+               if (get_user(fourth.__pad, (void __user * __user *) ptr))
+                       return -EFAULT;
+               return sys_semctl(first, second, third, fourth);
+       }
+
+       case MSGSND:
+               return sys_msgsnd(first, (struct msgbuf __user *) ptr,
+                                 second, third);
+       case MSGRCV:
+               switch (version) {
+               case 0: {
+                       struct ipc_kludge tmp;
+                       if (!ptr)
+                               return -EINVAL;
+
+                       if (copy_from_user(&tmp,
+                                          (struct ipc_kludge __user *) ptr,
+                                          sizeof(tmp)))
+                               return -EFAULT;
+                       return sys_msgrcv(first, tmp.msgp, second,
+                                          tmp.msgtyp, third);
+               }
+               default:
+                       return sys_msgrcv(first,
+                                          (struct msgbuf __user *) ptr,
+                                          second, fifth, third);
+               }
+       case MSGGET:
+               return sys_msgget((key_t) first, second);
+       case MSGCTL:
+               return sys_msgctl(first, second, (struct msqid_ds __user *)ptr);
+
+       case SHMAT:
+               switch (version) {
+               default: {
+                       unsigned long raddr;
+                       ret = do_shmat(first, (char __user *)ptr,
+                                      second, &raddr);
+                       if (ret)
+                               return ret;
+                       return put_user(raddr, (unsigned long __user *) third);
+               }
+               case 1:
+                       /*
+                        * This was the entry point for kernel-originating calls
+                        * from iBCS2 in 2.2 days.
+                        */
+                       return -EINVAL;
+               }
+       case SHMDT:
+               return sys_shmdt((char __user *)ptr);
+       case SHMGET:
+               return sys_shmget(first, second, third);
+       case SHMCTL:
+               return sys_shmctl(first, second,
+                                  (struct shmid_ds __user *) ptr);
+       default:
+               return -ENOSYS;
+       }
+}
+#endif
index 695384f..70f2ea7 100644 (file)
@@ -126,6 +126,7 @@ cond_syscall(sys_setreuid16);
 cond_syscall(sys_setuid16);
 cond_syscall(sys_vm86old);
 cond_syscall(sys_vm86);
+cond_syscall(sys_ipc);
 cond_syscall(compat_sys_ipc);
 cond_syscall(compat_sys_sysctl);
 cond_syscall(sys_flock);