]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
Add generic sys_ipc wrapper
authorChristoph Hellwig <hch@lst.de>
Wed, 10 Mar 2010 23:21:18 +0000 (15:21 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 12 Mar 2010 23:52:32 +0000 (15:52 -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 e6eeb2d29953d95145684a23198a9fd284629e78..dd2bf53000fe4cc06038e87f86587c6bc5e6c0f3 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 a2e0e6f2ea7ff3725a8cd9e6e63283e4696f8e99..4350f75e578c5815a8fe428aad512df27ca1e6e8 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 d59a0cd537f09c977db4aa3b75ebfe2676fb0e7b..33ff678e32f2ef0e55a80e85a77d5b236e1b41c0 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 8cffd22623fde4b1449debc44974740e22ba0ba5..f6fad83b3a8c58c9bc0f88f8c60575783394db28 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 22f9d6cd947fa4d802f9259ef4c7cf6e4b50ab0e..7aa036ec78ff8a39e97d0be7ce12b24d1eb521ee 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 be6ef0f5cd42bc74c7e62309acd12d89040d4270..b28da499e22a16d29c68c6dbccfa02475ce3a807 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 1d3d4c9e25218e13341ed77d3cc43e3e4f8586a6..9c4980825bbbd9202a5038bf32cd83a56b1cd05d 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 54dab47269547180d11054987b04ac055e2a7bda..50f2c5a365915a8d3e6487502ecd02055ec56088 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 1f13fd6e530941c440c75fe301c0fbddf0a7757b..f9b3f44da69fe655dc7f2f1c0b82c4ac0b55990d 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 cf701c93324937aa4f6803279baa6df0bcc1a4cb..76125777483ccda07d9d31d55c2f8f3b3201ea05 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 d3c865c5a6bab95d1a79a9ca078e5bafceb3a2c5..cf2e7279ce9bf593e0dc2f2f6b0e105d00a8e1d8 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 d801154310ea8fa4c9f64d278541ceb143d5ae47..60b15d0aa07290bfd2494423ecc4c331c33c3032 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 7b309e7b6cefff2ec8fe3215049930573be88469..77896692eb0a69f34609cb4809e221fc84fb4bd3 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 3e371cc9fd918862294de1cdd770b564d7ee8a0e..d65e9c4c930cdf59821ffc5f61031a9d4a05b51c 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 65c679ecbe6b24ef0709ac5876e0c2f39a529826..97fe472095f214cd7479e2fac9674826d79162ba 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 3f7f466190b481e62b7df738b10ef96477f1c059..257bf0141775e905a3734e77719c1d6c6952d585 100644 (file)
@@ -406,94 +406,6 @@ _sys_sysmips(nabi_no_regargs struct pt_regs regs)
        return -EINVAL;
 }
 
-/*
- * 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 ...
  */
index d13a56e99bad8832818d11bf6c62f3a66e76f393..9d056f5159292cceb0729f93df7022b2e2e31edd 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 bef69d6daf1519ffe6fca340d070089d0aaf52e1..815f1355fad44eb5d2fa14681bb3618d9efd4228 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 eb8eb400c664c3dc6d38fb14637752bb5454e0da..23bb74e7f946f0dc17d4c159cdeec9b729205af3 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 f6ca7617676673782eb9237b314805928daf05e7..c13821fe87419930a3d9ffeeb5434b6526ca1182 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 3370e62e43d4eabe6e20d6ce5c9c2aa9522fc5cd..5251221e7a5a60fa24ebe8b94073ebed729986ce 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 5de54d2af0b2e9dbe4db97560aa96756b7dd61e6..15fd68b196c089f2b881f74df55843deab43fb8b 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 b2563509b5a9d1fb01ad30d6e1f2e63d6db9dcc9..b8b78092ab7ca859c2a317e067839abc6ab3be14 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 2a24766567affd6e46ed5a87ddf8a8d448b289db..990ac8b321c83c54707404fcf66d1eff22d234d5 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 c1e2b8deb8375b70af79e9408be216b7545efc51..c1ce2862f7be50e14ba669c6e426faaa04d8c058 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 365744b05269c2f1e1e9c3456308d7d5cd6e6605..a48f65e2e4295807a4d6bada2a353afc8398335e 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 25de158aac3a84baa5e0c64033291b49b3b574f9..7709b2b8f752f55fd4ccb0ee3eb4b76a19805eff 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 71399cde03b52c3cca26612075d7ebae4e2c1a68..c18cfaa67fddf3299ed5db9db6b9710c03fae289 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 cb4b9bfd0d8770a014e0258acc95ba5f47072755..d0b3b01ac9d4316962ed744c71fa805e94d4d204 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 3a82e65d8db2072b9f4b3d9a2edb9faf55c263a7..ee995b7dae7e8d3f4509ed378761ac131266515a 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 cb1bef6f14b7240e3f87bb693b060fcbcb90a081..45410e939628191bdfe7f8a7dd36d6232de1b8dd 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 68312fe8da740fa967ea3f90bd1c6cd15a7cf8a4..2c331c37e74896c60b84109af062e407887f0d85 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 17614251fb6d8cb34cdc79722f1e3137b006c7a2..30ca2b1d3a17c5d49d8839c567d457674b69fe4e 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 d0aa8f125ee67ad85e9b7ee32d5a7c16c64cb9ad..70ca357393b86fb747895d1a11110324ccd1a4cf 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 86ab6a0623fdc78331f8459e861c22d062f99023..50f6a569f0d14bd82e668c98e9785528fe08c4f6 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 daa65d9aae9569c872be666aa8513392d0723b6f..45e64a17b86e273818f895d9dad3e3208fd5ed4b 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 7955e90c8341504253f7e93010cf90c58f1b3d95..8b5c348fdcf245210a7a941e984b33adf0aa818d 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
  */
index b60907e3b0d55ebca4390a82dab0b10151fa3936..fbb61ae70e06447ed2ce3906231963b02ba708c9 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 4e1955ea815dc5ff80c887e17b626e1ccac213e2..9075e172e52cacbcc4e5c0ba3d3ccb03d2a6d561 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 695384f12a7d803e15c7f2e4646ec4069dfe3ce6..70f2ea758ffec524715554e9e552edab4252ea9e 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);