aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Rothwell <sfr@canb.auug.org.au>2005-05-01 11:59:12 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-05-01 11:59:12 -0400
commit7d87e14c236d6c4cab66d87cf0bc1e0f0375d308 (patch)
tree0c0826cdc102286b541e3e56b59c81752d34c90d
parent434498d5323445b59167fd7aa5633b74ebbce901 (diff)
[PATCH] consolidate sys_shmat
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>
-rw-r--r--arch/alpha/kernel/osf_sys.c16
-rw-r--r--arch/alpha/kernel/systbls.S2
-rw-r--r--arch/arm/kernel/sys_arm.c12
-rw-r--r--arch/ia64/kernel/entry.S2
-rw-r--r--arch/ia64/kernel/sys_ia64.c14
-rw-r--r--arch/mips/kernel/syscall.c16
-rw-r--r--arch/parisc/kernel/sys_parisc.c11
-rw-r--r--arch/parisc/kernel/syscall_table.S2
-rw-r--r--arch/sh64/kernel/sys_sh64.c15
-rw-r--r--arch/sh64/kernel/syscalls.S2
-rw-r--r--arch/um/include/sysdep-x86_64/syscalls.h1
-rw-r--r--arch/um/sys-x86_64/syscalls.c8
-rw-r--r--arch/x86_64/kernel/sys_x86_64.c6
-rw-r--r--include/asm-x86_64/unistd.h2
-rw-r--r--include/linux/syscalls.h3
-rw-r--r--ipc/shm.c14
-rw-r--r--kernel/sys_ni.c1
17 files changed, 21 insertions, 106 deletions
diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c
index b5d0fd2bb10a..64e450dddb49 100644
--- a/arch/alpha/kernel/osf_sys.c
+++ b/arch/alpha/kernel/osf_sys.c
@@ -457,22 +457,6 @@ osf_getdomainname(char __user *name, int namelen)
457 return 0; 457 return 0;
458} 458}
459 459
460asmlinkage long
461osf_shmat(int shmid, void __user *shmaddr, int shmflg)
462{
463 unsigned long raddr;
464 long err;
465
466 err = do_shmat(shmid, shmaddr, shmflg, &raddr);
467
468 /*
469 * This works because all user-level addresses are
470 * non-negative longs!
471 */
472 return err ? err : (long)raddr;
473}
474
475
476/* 460/*
477 * The following stuff should move into a header file should it ever 461 * The following stuff should move into a header file should it ever
478 * be labeled "officially supported." Right now, there is just enough 462 * be labeled "officially supported." Right now, there is just enough
diff --git a/arch/alpha/kernel/systbls.S b/arch/alpha/kernel/systbls.S
index 3864b33562ee..052120882876 100644
--- a/arch/alpha/kernel/systbls.S
+++ b/arch/alpha/kernel/systbls.S
@@ -227,7 +227,7 @@ sys_call_table:
227 .quad sys_semop 227 .quad sys_semop
228 .quad osf_utsname 228 .quad osf_utsname
229 .quad sys_lchown 229 .quad sys_lchown
230 .quad osf_shmat 230 .quad sys_shmat
231 .quad sys_shmctl /* 210 */ 231 .quad sys_shmctl /* 210 */
232 .quad sys_shmdt 232 .quad sys_shmdt
233 .quad sys_shmget 233 .quad sys_shmget
diff --git a/arch/arm/kernel/sys_arm.c b/arch/arm/kernel/sys_arm.c
index 7ba6342cf93d..ef32577da304 100644
--- a/arch/arm/kernel/sys_arm.c
+++ b/arch/arm/kernel/sys_arm.c
@@ -227,18 +227,6 @@ asmlinkage int sys_ipc(uint call, int first, int second, int third,
227 } 227 }
228} 228}
229 229
230asmlinkage long sys_shmat(int shmid, char __user *shmaddr, int shmflg,
231 unsigned long __user *addr)
232{
233 unsigned long ret;
234 long err;
235
236 err = do_shmat(shmid, shmaddr, shmflg, &ret);
237 if (err == 0)
238 err = put_user(ret, addr);
239 return err;
240}
241
242/* Fork a new task - this creates a new program thread. 230/* Fork a new task - this creates a new program thread.
243 * This is called indirectly via a small wrapper 231 * This is called indirectly via a small wrapper
244 */ 232 */
diff --git a/arch/ia64/kernel/entry.S b/arch/ia64/kernel/entry.S
index bd86fea49a0c..d3f093820bc7 100644
--- a/arch/ia64/kernel/entry.S
+++ b/arch/ia64/kernel/entry.S
@@ -1417,7 +1417,7 @@ sys_call_table:
1417 data8 sys_msgrcv 1417 data8 sys_msgrcv
1418 data8 sys_msgctl 1418 data8 sys_msgctl
1419 data8 sys_shmget 1419 data8 sys_shmget
1420 data8 ia64_shmat 1420 data8 sys_shmat
1421 data8 sys_shmdt // 1115 1421 data8 sys_shmdt // 1115
1422 data8 sys_shmctl 1422 data8 sys_shmctl
1423 data8 sys_syslog 1423 data8 sys_syslog
diff --git a/arch/ia64/kernel/sys_ia64.c b/arch/ia64/kernel/sys_ia64.c
index 3ac216e1c8bb..a8cf6d8a509c 100644
--- a/arch/ia64/kernel/sys_ia64.c
+++ b/arch/ia64/kernel/sys_ia64.c
@@ -93,20 +93,6 @@ sys_getpagesize (void)
93} 93}
94 94
95asmlinkage unsigned long 95asmlinkage unsigned long
96ia64_shmat (int shmid, void __user *shmaddr, int shmflg)
97{
98 unsigned long raddr;
99 int retval;
100
101 retval = do_shmat(shmid, shmaddr, shmflg, &raddr);
102 if (retval < 0)
103 return retval;
104
105 force_successful_syscall_return();
106 return raddr;
107}
108
109asmlinkage unsigned long
110ia64_brk (unsigned long brk) 96ia64_brk (unsigned long brk)
111{ 97{
112 unsigned long rlim, retval, newbrk, oldbrk; 98 unsigned long rlim, retval, newbrk, oldbrk;
diff --git a/arch/mips/kernel/syscall.c b/arch/mips/kernel/syscall.c
index 598bfe7426a2..ae2a1312d4ef 100644
--- a/arch/mips/kernel/syscall.c
+++ b/arch/mips/kernel/syscall.c
@@ -374,22 +374,6 @@ asmlinkage int sys_ipc (uint call, int first, int second,
374} 374}
375 375
376/* 376/*
377 * Native ABI that is O32 or N64 version
378 */
379asmlinkage long sys_shmat(int shmid, char __user *shmaddr,
380 int shmflg, unsigned long *addr)
381{
382 unsigned long raddr;
383 int err;
384
385 err = do_shmat(shmid, shmaddr, shmflg, &raddr);
386 if (err)
387 return err;
388
389 return put_user(raddr, addr);
390}
391
392/*
393 * No implemented yet ... 377 * No implemented yet ...
394 */ 378 */
395asmlinkage int sys_cachectl(char *addr, int nbytes, int op) 379asmlinkage int sys_cachectl(char *addr, int nbytes, int op)
diff --git a/arch/parisc/kernel/sys_parisc.c b/arch/parisc/kernel/sys_parisc.c
index 7958cd8c8bf8..d15a1d53e101 100644
--- a/arch/parisc/kernel/sys_parisc.c
+++ b/arch/parisc/kernel/sys_parisc.c
@@ -161,17 +161,6 @@ asmlinkage unsigned long sys_mmap(unsigned long addr, unsigned long len,
161 } 161 }
162} 162}
163 163
164long sys_shmat_wrapper(int shmid, char __user *shmaddr, int shmflag)
165{
166 unsigned long raddr;
167 int r;
168
169 r = do_shmat(shmid, shmaddr, shmflag, &raddr);
170 if (r < 0)
171 return r;
172 return raddr;
173}
174
175/* Fucking broken ABI */ 164/* Fucking broken ABI */
176 165
177#ifdef CONFIG_64BIT 166#ifdef CONFIG_64BIT
diff --git a/arch/parisc/kernel/syscall_table.S b/arch/parisc/kernel/syscall_table.S
index 779b537100ec..dcfa4d3d0e7d 100644
--- a/arch/parisc/kernel/syscall_table.S
+++ b/arch/parisc/kernel/syscall_table.S
@@ -297,7 +297,7 @@
297 ENTRY_DIFF(msgrcv) 297 ENTRY_DIFF(msgrcv)
298 ENTRY_SAME(msgget) /* 190 */ 298 ENTRY_SAME(msgget) /* 190 */
299 ENTRY_SAME(msgctl) 299 ENTRY_SAME(msgctl)
300 ENTRY_SAME(shmat_wrapper) 300 ENTRY_SAME(shmat)
301 ENTRY_SAME(shmdt) 301 ENTRY_SAME(shmdt)
302 ENTRY_SAME(shmget) 302 ENTRY_SAME(shmget)
303 ENTRY_SAME(shmctl) /* 195 */ 303 ENTRY_SAME(shmctl) /* 195 */
diff --git a/arch/sh64/kernel/sys_sh64.c b/arch/sh64/kernel/sys_sh64.c
index 4546845b9caf..58ff7d522d81 100644
--- a/arch/sh64/kernel/sys_sh64.c
+++ b/arch/sh64/kernel/sys_sh64.c
@@ -283,18 +283,3 @@ asmlinkage int sys_uname(struct old_utsname * name)
283 up_read(&uts_sem); 283 up_read(&uts_sem);
284 return err?-EFAULT:0; 284 return err?-EFAULT:0;
285} 285}
286
287/* Copy from mips version */
288asmlinkage long sys_shmatcall(int shmid, char __user *shmaddr,
289 int shmflg)
290{
291 unsigned long raddr;
292 int err;
293
294 err = do_shmat(shmid, shmaddr, shmflg, &raddr);
295 if (err)
296 return err;
297
298 err = raddr;
299 return err;
300}
diff --git a/arch/sh64/kernel/syscalls.S b/arch/sh64/kernel/syscalls.S
index 8ed417df3dc6..6aabc63e4518 100644
--- a/arch/sh64/kernel/syscalls.S
+++ b/arch/sh64/kernel/syscalls.S
@@ -268,7 +268,7 @@ sys_call_table:
268 .long sys_msgrcv 268 .long sys_msgrcv
269 .long sys_msgget 269 .long sys_msgget
270 .long sys_msgctl 270 .long sys_msgctl
271 .long sys_shmatcall 271 .long sys_shmat
272 .long sys_shmdt /* 245 */ 272 .long sys_shmdt /* 245 */
273 .long sys_shmget 273 .long sys_shmget
274 .long sys_shmctl 274 .long sys_shmctl
diff --git a/arch/um/include/sysdep-x86_64/syscalls.h b/arch/um/include/sysdep-x86_64/syscalls.h
index b56b335c3514..67923cca5691 100644
--- a/arch/um/include/sysdep-x86_64/syscalls.h
+++ b/arch/um/include/sysdep-x86_64/syscalls.h
@@ -26,7 +26,6 @@ extern syscall_handler_t *ia32_sys_call_table[];
26extern long old_mmap(unsigned long addr, unsigned long len, 26extern long old_mmap(unsigned long addr, unsigned long len,
27 unsigned long prot, unsigned long flags, 27 unsigned long prot, unsigned long flags,
28 unsigned long fd, unsigned long pgoff); 28 unsigned long fd, unsigned long pgoff);
29extern syscall_handler_t wrap_sys_shmat;
30extern syscall_handler_t sys_modify_ldt; 29extern syscall_handler_t sys_modify_ldt;
31extern syscall_handler_t sys_arch_prctl; 30extern syscall_handler_t sys_arch_prctl;
32 31
diff --git a/arch/um/sys-x86_64/syscalls.c b/arch/um/sys-x86_64/syscalls.c
index 15768c96ceb4..ab4b0abf8af3 100644
--- a/arch/um/sys-x86_64/syscalls.c
+++ b/arch/um/sys-x86_64/syscalls.c
@@ -14,14 +14,6 @@
14#include "asm/prctl.h" /* XXX This should get the constants from libc */ 14#include "asm/prctl.h" /* XXX This should get the constants from libc */
15#include "choose-mode.h" 15#include "choose-mode.h"
16 16
17/* XXX: copied from x86-64: arch/x86_64/kernel/sys_x86_64.c */
18asmlinkage long wrap_sys_shmat(int shmid, char __user *shmaddr, int shmflg)
19{
20 unsigned long raddr;
21
22 return do_shmat(shmid, shmaddr, shmflg, &raddr) ?: (long) raddr;
23}
24
25asmlinkage long sys_uname64(struct new_utsname __user * name) 17asmlinkage long sys_uname64(struct new_utsname __user * name)
26{ 18{
27 int err; 19 int err;
diff --git a/arch/x86_64/kernel/sys_x86_64.c b/arch/x86_64/kernel/sys_x86_64.c
index 477d8be57d64..dbebd5ccba6b 100644
--- a/arch/x86_64/kernel/sys_x86_64.c
+++ b/arch/x86_64/kernel/sys_x86_64.c
@@ -152,12 +152,6 @@ asmlinkage long sys_uname(struct new_utsname __user * name)
152 return err ? -EFAULT : 0; 152 return err ? -EFAULT : 0;
153} 153}
154 154
155asmlinkage long wrap_sys_shmat(int shmid, char __user *shmaddr, int shmflg)
156{
157 unsigned long raddr;
158 return do_shmat(shmid,shmaddr,shmflg,&raddr) ?: (long)raddr;
159}
160
161asmlinkage long sys_time64(long __user * tloc) 155asmlinkage long sys_time64(long __user * tloc)
162{ 156{
163 struct timeval now; 157 struct timeval now;
diff --git a/include/asm-x86_64/unistd.h b/include/asm-x86_64/unistd.h
index 3d65d240dc95..3c9af6fd4332 100644
--- a/include/asm-x86_64/unistd.h
+++ b/include/asm-x86_64/unistd.h
@@ -76,7 +76,7 @@ __SYSCALL(__NR_madvise, sys_madvise)
76#define __NR_shmget 29 76#define __NR_shmget 29
77__SYSCALL(__NR_shmget, sys_shmget) 77__SYSCALL(__NR_shmget, sys_shmget)
78#define __NR_shmat 30 78#define __NR_shmat 30
79__SYSCALL(__NR_shmat, wrap_sys_shmat) 79__SYSCALL(__NR_shmat, sys_shmat)
80#define __NR_shmctl 31 80#define __NR_shmctl 31
81__SYSCALL(__NR_shmctl, sys_shmctl) 81__SYSCALL(__NR_shmctl, sys_shmctl)
82 82
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 757cd9be7743..c39f6f72cbbc 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -456,8 +456,7 @@ asmlinkage long sys_semctl(int semid, int semnum, int cmd, union semun arg);
456asmlinkage long sys_semtimedop(int semid, struct sembuf __user *sops, 456asmlinkage long sys_semtimedop(int semid, struct sembuf __user *sops,
457 unsigned nsops, 457 unsigned nsops,
458 const struct timespec __user *timeout); 458 const struct timespec __user *timeout);
459asmlinkage long sys_shmat(int shmid, char __user *shmaddr, 459asmlinkage long sys_shmat(int shmid, char __user *shmaddr, int shmflg);
460 int shmflg, unsigned long __user *addr);
461asmlinkage long sys_shmget(key_t key, size_t size, int flag); 460asmlinkage long sys_shmget(key_t key, size_t size, int flag);
462asmlinkage long sys_shmdt(char __user *shmaddr); 461asmlinkage long sys_shmdt(char __user *shmaddr);
463asmlinkage long sys_shmctl(int shmid, int cmd, struct shmid_ds __user *buf); 462asmlinkage long sys_shmctl(int shmid, int cmd, struct shmid_ds __user *buf);
diff --git a/ipc/shm.c b/ipc/shm.c
index 06cd5c91056f..cce022435dbc 100644
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -28,6 +28,8 @@
28#include <linux/security.h> 28#include <linux/security.h>
29#include <linux/syscalls.h> 29#include <linux/syscalls.h>
30#include <linux/audit.h> 30#include <linux/audit.h>
31#include <linux/ptrace.h>
32
31#include <asm/uaccess.h> 33#include <asm/uaccess.h>
32 34
33#include "util.h" 35#include "util.h"
@@ -771,6 +773,18 @@ out:
771 return err; 773 return err;
772} 774}
773 775
776asmlinkage long sys_shmat(int shmid, char __user *shmaddr, int shmflg)
777{
778 unsigned long ret;
779 long err;
780
781 err = do_shmat(shmid, shmaddr, shmflg, &ret);
782 if (err)
783 return err;
784 force_successful_syscall_return();
785 return (long)ret;
786}
787
774/* 788/*
775 * detach and kill segment if marked destroyed. 789 * detach and kill segment if marked destroyed.
776 * The work is done in shm_close. 790 * The work is done in shm_close.
diff --git a/kernel/sys_ni.c b/kernel/sys_ni.c
index 1802a311dd3f..0dda70ed1f98 100644
--- a/kernel/sys_ni.c
+++ b/kernel/sys_ni.c
@@ -52,6 +52,7 @@ cond_syscall(sys_msgsnd);
52cond_syscall(sys_msgrcv); 52cond_syscall(sys_msgrcv);
53cond_syscall(sys_msgctl); 53cond_syscall(sys_msgctl);
54cond_syscall(sys_shmget); 54cond_syscall(sys_shmget);
55cond_syscall(sys_shmat);
55cond_syscall(sys_shmdt); 56cond_syscall(sys_shmdt);
56cond_syscall(sys_shmctl); 57cond_syscall(sys_shmctl);
57cond_syscall(sys_mq_open); 58cond_syscall(sys_mq_open);