[PATCH] consolidate sys_shmat
authorStephen Rothwell <sfr@canb.auug.org.au>
Sun, 1 May 2005 15:59:12 +0000 (08:59 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Sun, 1 May 2005 15:59:12 +0000 (08:59 -0700)
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
17 files changed:
arch/alpha/kernel/osf_sys.c
arch/alpha/kernel/systbls.S
arch/arm/kernel/sys_arm.c
arch/ia64/kernel/entry.S
arch/ia64/kernel/sys_ia64.c
arch/mips/kernel/syscall.c
arch/parisc/kernel/sys_parisc.c
arch/parisc/kernel/syscall_table.S
arch/sh64/kernel/sys_sh64.c
arch/sh64/kernel/syscalls.S
arch/um/include/sysdep-x86_64/syscalls.h
arch/um/sys-x86_64/syscalls.c
arch/x86_64/kernel/sys_x86_64.c
include/asm-x86_64/unistd.h
include/linux/syscalls.h
ipc/shm.c
kernel/sys_ni.c

index b5d0fd2bb10a086908029150d6ac2f618822b6b7..64e450dddb49d55c3ddea43bb35371958f52369a 100644 (file)
@@ -457,22 +457,6 @@ osf_getdomainname(char __user *name, int namelen)
        return 0;
 }
 
-asmlinkage long
-osf_shmat(int shmid, void __user *shmaddr, int shmflg)
-{
-       unsigned long raddr;
-       long err;
-
-       err = do_shmat(shmid, shmaddr, shmflg, &raddr);
-
-       /*
-        * This works because all user-level addresses are
-        * non-negative longs!
-        */
-       return err ? err : (long)raddr;
-}
-
-
 /*
  * The following stuff should move into a header file should it ever
  * be labeled "officially supported."  Right now, there is just enough
index 3864b33562ee973643c7800e1129c1fa3239d2ed..0521208828763bf0ac9317d6d3063b80f9cccc8c 100644 (file)
@@ -227,7 +227,7 @@ sys_call_table:
        .quad sys_semop
        .quad osf_utsname
        .quad sys_lchown
-       .quad osf_shmat
+       .quad sys_shmat
        .quad sys_shmctl                        /* 210 */
        .quad sys_shmdt
        .quad sys_shmget
index 7ba6342cf93dde95d9f36f9a604d295394c09614..ef32577da304ba7f4c13a9c92d0f6a36631d3376 100644 (file)
@@ -227,18 +227,6 @@ asmlinkage int sys_ipc(uint call, int first, int second, int third,
        }
 }
 
-asmlinkage long sys_shmat(int shmid, char __user *shmaddr, int shmflg,
-                         unsigned long __user *addr)
-{
-       unsigned long ret;
-       long err;
-
-       err = do_shmat(shmid, shmaddr, shmflg, &ret);
-       if (err == 0)
-               err = put_user(ret, addr);
-       return err;
-}
-
 /* Fork a new task - this creates a new program thread.
  * This is called indirectly via a small wrapper
  */
index bd86fea49a0c4ffeb5bb085ce3882a0054dcb6ef..d3f093820bc7536771dbaebad74c4ea6a003e205 100644 (file)
@@ -1417,7 +1417,7 @@ sys_call_table:
        data8 sys_msgrcv
        data8 sys_msgctl
        data8 sys_shmget
-       data8 ia64_shmat
+       data8 sys_shmat
        data8 sys_shmdt                         // 1115
        data8 sys_shmctl
        data8 sys_syslog
index 3ac216e1c8bb0a3557a13477f4c2cc9c3d33eeb0..a8cf6d8a509cb07c780ccde59b8a71a30c437b46 100644 (file)
@@ -92,20 +92,6 @@ sys_getpagesize (void)
        return PAGE_SIZE;
 }
 
-asmlinkage unsigned long
-ia64_shmat (int shmid, void __user *shmaddr, int shmflg)
-{
-       unsigned long raddr;
-       int retval;
-
-       retval = do_shmat(shmid, shmaddr, shmflg, &raddr);
-       if (retval < 0)
-               return retval;
-
-       force_successful_syscall_return();
-       return raddr;
-}
-
 asmlinkage unsigned long
 ia64_brk (unsigned long brk)
 {
index 598bfe7426a252acfc25467f5e5f73942afe101e..ae2a1312d4efe1e06f98fa999b1029fbffa8517a 100644 (file)
@@ -373,22 +373,6 @@ asmlinkage int sys_ipc (uint call, int first, int second,
        }
 }
 
-/*
- * Native ABI that is O32 or N64 version
- */
-asmlinkage long sys_shmat(int shmid, char __user *shmaddr,
-                          int shmflg, unsigned long *addr)
-{
-       unsigned long raddr;
-       int err;
-
-       err = do_shmat(shmid, shmaddr, shmflg, &raddr);
-       if (err)
-               return err;
-
-       return put_user(raddr, addr);
-}
-
 /*
  * No implemented yet ...
  */
index 7958cd8c8bf8029b4390eca31ee2fd3b295a9c11..d15a1d53e101eed9713644f0ee4e9e7ae2f37d59 100644 (file)
@@ -161,17 +161,6 @@ asmlinkage unsigned long sys_mmap(unsigned long addr, unsigned long len,
        }
 }
 
-long sys_shmat_wrapper(int shmid, char __user *shmaddr, int shmflag)
-{
-       unsigned long raddr;
-       int r;
-
-       r = do_shmat(shmid, shmaddr, shmflag, &raddr);
-       if (r < 0)
-               return r;
-       return raddr;
-}
-
 /* Fucking broken ABI */
 
 #ifdef CONFIG_64BIT
index 779b537100ecff3a3a604de4ce968740636ef200..dcfa4d3d0e7d2502bb29e7c7a7f126e2067bd718 100644 (file)
        ENTRY_DIFF(msgrcv)
        ENTRY_SAME(msgget)              /* 190 */
        ENTRY_SAME(msgctl)
-       ENTRY_SAME(shmat_wrapper)
+       ENTRY_SAME(shmat)
        ENTRY_SAME(shmdt)
        ENTRY_SAME(shmget)
        ENTRY_SAME(shmctl)              /* 195 */
index 4546845b9caf47c4a50db5851e794f66f6648538..58ff7d522d81e0181950954f98608d6594bb3bd3 100644 (file)
@@ -283,18 +283,3 @@ asmlinkage int sys_uname(struct old_utsname * name)
        up_read(&uts_sem);
        return err?-EFAULT:0;
 }
-
-/* Copy from mips version */
-asmlinkage long sys_shmatcall(int shmid, char __user *shmaddr,
-               int shmflg)
-{
-       unsigned long raddr;
-       int err;
-
-       err = do_shmat(shmid, shmaddr, shmflg, &raddr);
-       if (err)
-               return err;
-
-       err = raddr;
-       return err;
-}
index 8ed417df3dc64023d6be6eee549d1797feacbb7b..6aabc63e451841ead9ebb431b332d5a4a65d9ae5 100644 (file)
@@ -268,7 +268,7 @@ sys_call_table:
        .long sys_msgrcv
        .long sys_msgget
        .long sys_msgctl
-       .long sys_shmatcall
+       .long sys_shmat
        .long sys_shmdt                 /* 245 */
        .long sys_shmget
        .long sys_shmctl
index b56b335c35148d3bd12ce8c210b46cc2461ee88c..67923cca5691952194da13faa048c94c16f560e2 100644 (file)
@@ -26,7 +26,6 @@ extern syscall_handler_t *ia32_sys_call_table[];
 extern long old_mmap(unsigned long addr, unsigned long len,
                     unsigned long prot, unsigned long flags,
                     unsigned long fd, unsigned long pgoff);
-extern syscall_handler_t wrap_sys_shmat;
 extern syscall_handler_t sys_modify_ldt;
 extern syscall_handler_t sys_arch_prctl;
 
index 15768c96ceb4b176382d378767954c09f06ae89f..ab4b0abf8af3fe528881a2f6a95429d6469d8f57 100644 (file)
 #include "asm/prctl.h" /* XXX This should get the constants from libc */
 #include "choose-mode.h"
 
-/* XXX: copied from x86-64: arch/x86_64/kernel/sys_x86_64.c */
-asmlinkage long wrap_sys_shmat(int shmid, char __user *shmaddr, int shmflg)
-{
-       unsigned long raddr;
-
-       return do_shmat(shmid, shmaddr, shmflg, &raddr) ?: (long) raddr;
-}
-
 asmlinkage long sys_uname64(struct new_utsname __user * name)
 {
        int err;
index 477d8be57d64f037178962e4c0d8a3952e3d9519..dbebd5ccba6b067531c0f7425d2bd17ef08c2bfd 100644 (file)
@@ -152,12 +152,6 @@ asmlinkage long sys_uname(struct new_utsname __user * name)
        return err ? -EFAULT : 0;
 }
 
-asmlinkage long wrap_sys_shmat(int shmid, char __user *shmaddr, int shmflg)
-{
-       unsigned long raddr;
-       return do_shmat(shmid,shmaddr,shmflg,&raddr) ?: (long)raddr;
-}
-
 asmlinkage long sys_time64(long __user * tloc)
 {
        struct timeval now; 
index 3d65d240dc954b7b40b874c2dfe866b5c744da87..3c9af6fd433216fdfd26b60619dc6d3b9ce903b8 100644 (file)
@@ -76,7 +76,7 @@ __SYSCALL(__NR_madvise, sys_madvise)
 #define __NR_shmget                             29
 __SYSCALL(__NR_shmget, sys_shmget)
 #define __NR_shmat                              30
-__SYSCALL(__NR_shmat, wrap_sys_shmat)
+__SYSCALL(__NR_shmat, sys_shmat)
 #define __NR_shmctl                             31
 __SYSCALL(__NR_shmctl, sys_shmctl)
 
index 757cd9be7743c481607bdd5ff8fbee001b02da4d..c39f6f72cbbc3f0a53ae8e8a31b0749e2c8ea747 100644 (file)
@@ -456,8 +456,7 @@ asmlinkage long sys_semctl(int semid, int semnum, int cmd, union semun arg);
 asmlinkage long sys_semtimedop(int semid, struct sembuf __user *sops,
                                unsigned nsops,
                                const struct timespec __user *timeout);
-asmlinkage long sys_shmat(int shmid, char __user *shmaddr,
-                               int shmflg, unsigned long __user *addr);
+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);
index 06cd5c91056f56af458a069aba6bb609bcf46989..cce022435dbc95ff562b28cd073b2d239206af52 100644 (file)
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -28,6 +28,8 @@
 #include <linux/security.h>
 #include <linux/syscalls.h>
 #include <linux/audit.h>
+#include <linux/ptrace.h>
+
 #include <asm/uaccess.h>
 
 #include "util.h"
@@ -771,6 +773,18 @@ out:
        return err;
 }
 
+asmlinkage long sys_shmat(int shmid, char __user *shmaddr, int shmflg)
+{
+       unsigned long ret;
+       long err;
+
+       err = do_shmat(shmid, shmaddr, shmflg, &ret);
+       if (err)
+               return err;
+       force_successful_syscall_return();
+       return (long)ret;
+}
+
 /*
  * detach and kill segment if marked destroyed.
  * The work is done in shm_close.
index 1802a311dd3f8f575f3f7f79057ffcfbe82ba94a..0dda70ed1f983a7caaaf3434244f1ef1852918ae 100644 (file)
@@ -52,6 +52,7 @@ cond_syscall(sys_msgsnd);
 cond_syscall(sys_msgrcv);
 cond_syscall(sys_msgctl);
 cond_syscall(sys_shmget);
+cond_syscall(sys_shmat);
 cond_syscall(sys_shmdt);
 cond_syscall(sys_shmctl);
 cond_syscall(sys_mq_open);