aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/include/asm/unistd.h1
-rw-r--r--arch/arm/kernel/sys_arm.c82
-rw-r--r--arch/arm/kernel/sys_oabi-compat.c3
-rw-r--r--arch/cris/include/asm/unistd.h1
-rw-r--r--arch/cris/kernel/sys_cris.c78
-rw-r--r--arch/frv/include/asm/unistd.h1
-rw-r--r--arch/frv/kernel/sys_frv.c89
-rw-r--r--arch/h8300/include/asm/unistd.h1
-rw-r--r--arch/h8300/kernel/sys_h8300.c88
-rw-r--r--arch/m32r/include/asm/unistd.h1
-rw-r--r--arch/m32r/kernel/sys_m32r.c81
-rw-r--r--arch/m68k/include/asm/unistd.h1
-rw-r--r--arch/m68k/kernel/sys_m68k.c81
-rw-r--r--arch/m68knommu/kernel/sys_m68k.c86
-rw-r--r--arch/mips/include/asm/unistd.h1
-rw-r--r--arch/mips/kernel/syscall.c88
-rw-r--r--arch/mn10300/include/asm/unistd.h1
-rw-r--r--arch/mn10300/kernel/sys_mn10300.c88
-rw-r--r--arch/powerpc/include/asm/syscalls.h2
-rw-r--r--arch/powerpc/include/asm/unistd.h1
-rw-r--r--arch/powerpc/kernel/syscalls.c94
-rw-r--r--arch/s390/kernel/entry.h2
-rw-r--r--arch/s390/kernel/sys_s390.c2
-rw-r--r--arch/s390/kernel/syscalls.S2
-rw-r--r--arch/sh/include/asm/syscalls.h2
-rw-r--r--arch/sh/include/asm/unistd_32.h1
-rw-r--r--arch/sh/include/asm/unistd_64.h1
-rw-r--r--arch/sh/kernel/sys_sh.c104
-rw-r--r--arch/sparc/include/asm/unistd.h4
-rw-r--r--arch/sparc/kernel/sys_sparc_32.c113
-rw-r--r--arch/sparc/kernel/sys_sparc_64.c2
-rw-r--r--arch/sparc/kernel/systbls.h2
-rw-r--r--arch/sparc/kernel/systbls_64.S2
-rw-r--r--arch/um/sys-i386/syscalls.c86
-rw-r--r--arch/x86/include/asm/syscalls.h1
-rw-r--r--arch/x86/include/asm/unistd_32.h1
-rw-r--r--arch/x86/kernel/sys_i386_32.c85
-rw-r--r--include/linux/syscalls.h2
-rw-r--r--ipc/Makefile2
-rw-r--r--ipc/syscall.c99
-rw-r--r--kernel/sys_ni.c1
41 files changed, 124 insertions, 1259 deletions
diff --git a/arch/arm/include/asm/unistd.h b/arch/arm/include/asm/unistd.h
index e6eeb2d2995..dd2bf53000f 100644
--- a/arch/arm/include/asm/unistd.h
+++ b/arch/arm/include/asm/unistd.h
@@ -448,6 +448,7 @@
448 448
449#if !defined(CONFIG_AEABI) || defined(CONFIG_OABI_COMPAT) 449#if !defined(CONFIG_AEABI) || defined(CONFIG_OABI_COMPAT)
450#define __ARCH_WANT_SYS_TIME 450#define __ARCH_WANT_SYS_TIME
451#define __ARCH_WANT_SYS_IPC
451#define __ARCH_WANT_SYS_OLDUMOUNT 452#define __ARCH_WANT_SYS_OLDUMOUNT
452#define __ARCH_WANT_SYS_ALARM 453#define __ARCH_WANT_SYS_ALARM
453#define __ARCH_WANT_SYS_UTIME 454#define __ARCH_WANT_SYS_UTIME
diff --git a/arch/arm/kernel/sys_arm.c b/arch/arm/kernel/sys_arm.c
index a2e0e6f2ea7..4350f75e578 100644
--- a/arch/arm/kernel/sys_arm.c
+++ b/arch/arm/kernel/sys_arm.c
@@ -28,88 +28,6 @@
28#include <linux/ipc.h> 28#include <linux/ipc.h>
29#include <linux/uaccess.h> 29#include <linux/uaccess.h>
30 30
31#if !defined(CONFIG_AEABI) || defined(CONFIG_OABI_COMPAT)
32/*
33 * sys_ipc() is the de-multiplexer for the SysV IPC calls..
34 *
35 * This is really horribly ugly.
36 */
37asmlinkage int sys_ipc(uint call, int first, int second, int third,
38 void __user *ptr, long fifth)
39{
40 int version, ret;
41
42 version = call >> 16; /* hack for backward compatibility */
43 call &= 0xffff;
44
45 switch (call) {
46 case SEMOP:
47 return sys_semtimedop (first, (struct sembuf __user *)ptr, second, NULL);
48 case SEMTIMEDOP:
49 return sys_semtimedop(first, (struct sembuf __user *)ptr, second,
50 (const struct timespec __user *)fifth);
51
52 case SEMGET:
53 return sys_semget (first, second, third);
54 case SEMCTL: {
55 union semun fourth;
56 if (!ptr)
57 return -EINVAL;
58 if (get_user(fourth.__pad, (void __user * __user *) ptr))
59 return -EFAULT;
60 return sys_semctl (first, second, third, fourth);
61 }
62
63 case MSGSND:
64 return sys_msgsnd(first, (struct msgbuf __user *) ptr,
65 second, third);
66 case MSGRCV:
67 switch (version) {
68 case 0: {
69 struct ipc_kludge tmp;
70 if (!ptr)
71 return -EINVAL;
72 if (copy_from_user(&tmp,(struct ipc_kludge __user *)ptr,
73 sizeof (tmp)))
74 return -EFAULT;
75 return sys_msgrcv (first, tmp.msgp, second,
76 tmp.msgtyp, third);
77 }
78 default:
79 return sys_msgrcv (first,
80 (struct msgbuf __user *) ptr,
81 second, fifth, third);
82 }
83 case MSGGET:
84 return sys_msgget ((key_t) first, second);
85 case MSGCTL:
86 return sys_msgctl(first, second, (struct msqid_ds __user *)ptr);
87
88 case SHMAT:
89 switch (version) {
90 default: {
91 ulong raddr;
92 ret = do_shmat(first, (char __user *)ptr, second, &raddr);
93 if (ret)
94 return ret;
95 return put_user(raddr, (ulong __user *)third);
96 }
97 case 1: /* Of course, we don't support iBCS2! */
98 return -EINVAL;
99 }
100 case SHMDT:
101 return sys_shmdt ((char __user *)ptr);
102 case SHMGET:
103 return sys_shmget (first, second, third);
104 case SHMCTL:
105 return sys_shmctl (first, second,
106 (struct shmid_ds __user *) ptr);
107 default:
108 return -ENOSYS;
109 }
110}
111#endif
112
113/* Fork a new task - this creates a new program thread. 31/* Fork a new task - this creates a new program thread.
114 * This is called indirectly via a small wrapper 32 * This is called indirectly via a small wrapper
115 */ 33 */
diff --git a/arch/arm/kernel/sys_oabi-compat.c b/arch/arm/kernel/sys_oabi-compat.c
index d59a0cd537f..33ff678e32f 100644
--- a/arch/arm/kernel/sys_oabi-compat.c
+++ b/arch/arm/kernel/sys_oabi-compat.c
@@ -346,9 +346,6 @@ asmlinkage long sys_oabi_semop(int semid, struct oabi_sembuf __user *tsops,
346 return sys_oabi_semtimedop(semid, tsops, nsops, NULL); 346 return sys_oabi_semtimedop(semid, tsops, nsops, NULL);
347} 347}
348 348
349extern asmlinkage int sys_ipc(uint call, int first, int second, int third,
350 void __user *ptr, long fifth);
351
352asmlinkage int sys_oabi_ipc(uint call, int first, int second, int third, 349asmlinkage int sys_oabi_ipc(uint call, int first, int second, int third,
353 void __user *ptr, long fifth) 350 void __user *ptr, long fifth)
354{ 351{
diff --git a/arch/cris/include/asm/unistd.h b/arch/cris/include/asm/unistd.h
index 8cffd22623f..f6fad83b3a8 100644
--- a/arch/cris/include/asm/unistd.h
+++ b/arch/cris/include/asm/unistd.h
@@ -352,6 +352,7 @@
352#define __ARCH_WANT_STAT64 352#define __ARCH_WANT_STAT64
353#define __ARCH_WANT_SYS_ALARM 353#define __ARCH_WANT_SYS_ALARM
354#define __ARCH_WANT_SYS_GETHOSTNAME 354#define __ARCH_WANT_SYS_GETHOSTNAME
355#define __ARCH_WANT_SYS_IPC
355#define __ARCH_WANT_SYS_PAUSE 356#define __ARCH_WANT_SYS_PAUSE
356#define __ARCH_WANT_SYS_SGETMASK 357#define __ARCH_WANT_SYS_SGETMASK
357#define __ARCH_WANT_SYS_SIGNAL 358#define __ARCH_WANT_SYS_SIGNAL
diff --git a/arch/cris/kernel/sys_cris.c b/arch/cris/kernel/sys_cris.c
index 22f9d6cd947..7aa036ec78f 100644
--- a/arch/cris/kernel/sys_cris.c
+++ b/arch/cris/kernel/sys_cris.c
@@ -33,81 +33,3 @@ sys_mmap2(unsigned long addr, unsigned long len, unsigned long prot,
33 /* bug(?): 8Kb pages here */ 33 /* bug(?): 8Kb pages here */
34 return sys_mmap_pgoff(addr, len, prot, flags, fd, pgoff); 34 return sys_mmap_pgoff(addr, len, prot, flags, fd, pgoff);
35} 35}
36
37/*
38 * sys_ipc() is the de-multiplexer for the SysV IPC calls..
39 *
40 * This is really horribly ugly. (same as arch/i386)
41 */
42
43asmlinkage int sys_ipc (uint call, int first, int second,
44 int third, void __user *ptr, long fifth)
45{
46 int version, ret;
47
48 version = call >> 16; /* hack for backward compatibility */
49 call &= 0xffff;
50
51 switch (call) {
52 case SEMOP:
53 return sys_semtimedop (first, (struct sembuf __user *)ptr, second, NULL);
54 case SEMTIMEDOP:
55 return sys_semtimedop(first, (struct sembuf __user *)ptr, second,
56 (const struct timespec __user *)fifth);
57
58 case SEMGET:
59 return sys_semget (first, second, third);
60 case SEMCTL: {
61 union semun fourth;
62 if (!ptr)
63 return -EINVAL;
64 if (get_user(fourth.__pad, (void * __user *) ptr))
65 return -EFAULT;
66 return sys_semctl (first, second, third, fourth);
67 }
68
69 case MSGSND:
70 return sys_msgsnd (first, (struct msgbuf __user *) ptr,
71 second, third);
72 case MSGRCV:
73 switch (version) {
74 case 0: {
75 struct ipc_kludge tmp;
76 if (!ptr)
77 return -EINVAL;
78
79 if (copy_from_user(&tmp,
80 (struct ipc_kludge __user *) ptr,
81 sizeof (tmp)))
82 return -EFAULT;
83 return sys_msgrcv (first, tmp.msgp, second,
84 tmp.msgtyp, third);
85 }
86 default:
87 return sys_msgrcv (first,
88 (struct msgbuf __user *) ptr,
89 second, fifth, third);
90 }
91 case MSGGET:
92 return sys_msgget ((key_t) first, second);
93 case MSGCTL:
94 return sys_msgctl (first, second, (struct msqid_ds __user *) ptr);
95
96 case SHMAT: {
97 ulong raddr;
98 ret = do_shmat (first, (char __user *) ptr, second, &raddr);
99 if (ret)
100 return ret;
101 return put_user (raddr, (ulong __user *) third);
102 }
103 case SHMDT:
104 return sys_shmdt ((char __user *)ptr);
105 case SHMGET:
106 return sys_shmget (first, second, third);
107 case SHMCTL:
108 return sys_shmctl (first, second,
109 (struct shmid_ds __user *) ptr);
110 default:
111 return -ENOSYS;
112 }
113}
diff --git a/arch/frv/include/asm/unistd.h b/arch/frv/include/asm/unistd.h
index be6ef0f5cd4..b28da499e22 100644
--- a/arch/frv/include/asm/unistd.h
+++ b/arch/frv/include/asm/unistd.h
@@ -354,6 +354,7 @@
354#define __ARCH_WANT_STAT64 354#define __ARCH_WANT_STAT64
355#define __ARCH_WANT_SYS_ALARM 355#define __ARCH_WANT_SYS_ALARM
356/* #define __ARCH_WANT_SYS_GETHOSTNAME */ 356/* #define __ARCH_WANT_SYS_GETHOSTNAME */
357#define __ARCH_WANT_SYS_IPC
357#define __ARCH_WANT_SYS_PAUSE 358#define __ARCH_WANT_SYS_PAUSE
358/* #define __ARCH_WANT_SYS_SGETMASK */ 359/* #define __ARCH_WANT_SYS_SGETMASK */
359/* #define __ARCH_WANT_SYS_SIGNAL */ 360/* #define __ARCH_WANT_SYS_SIGNAL */
diff --git a/arch/frv/kernel/sys_frv.c b/arch/frv/kernel/sys_frv.c
index 1d3d4c9e252..9c4980825bb 100644
--- a/arch/frv/kernel/sys_frv.c
+++ b/arch/frv/kernel/sys_frv.c
@@ -42,92 +42,3 @@ asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
42 return sys_mmap_pgoff(addr, len, prot, flags, fd, 42 return sys_mmap_pgoff(addr, len, prot, flags, fd,
43 pgoff >> (PAGE_SHIFT - 12)); 43 pgoff >> (PAGE_SHIFT - 12));
44} 44}
45
46/*
47 * sys_ipc() is the de-multiplexer for the SysV IPC calls..
48 *
49 * This is really horribly ugly.
50 */
51asmlinkage long sys_ipc(unsigned long call,
52 unsigned long first,
53 unsigned long second,
54 unsigned long third,
55 void __user *ptr,
56 unsigned long fifth)
57{
58 int version, ret;
59
60 version = call >> 16; /* hack for backward compatibility */
61 call &= 0xffff;
62
63 switch (call) {
64 case SEMOP:
65 return sys_semtimedop(first, (struct sembuf __user *)ptr, second, NULL);
66 case SEMTIMEDOP:
67 return sys_semtimedop(first, (struct sembuf __user *)ptr, second,
68 (const struct timespec __user *)fifth);
69
70 case SEMGET:
71 return sys_semget (first, second, third);
72 case SEMCTL: {
73 union semun fourth;
74 if (!ptr)
75 return -EINVAL;
76 if (get_user(fourth.__pad, (void * __user *) ptr))
77 return -EFAULT;
78 return sys_semctl (first, second, third, fourth);
79 }
80
81 case MSGSND:
82 return sys_msgsnd (first, (struct msgbuf __user *) ptr,
83 second, third);
84 case MSGRCV:
85 switch (version) {
86 case 0: {
87 struct ipc_kludge tmp;
88 if (!ptr)
89 return -EINVAL;
90
91 if (copy_from_user(&tmp,
92 (struct ipc_kludge __user *) ptr,
93 sizeof (tmp)))
94 return -EFAULT;
95 return sys_msgrcv (first, tmp.msgp, second,
96 tmp.msgtyp, third);
97 }
98 default:
99 return sys_msgrcv (first,
100 (struct msgbuf __user *) ptr,
101 second, fifth, third);
102 }
103 case MSGGET:
104 return sys_msgget ((key_t) first, second);
105 case MSGCTL:
106 return sys_msgctl (first, second, (struct msqid_ds __user *) ptr);
107
108 case SHMAT:
109 switch (version) {
110 default: {
111 ulong raddr;
112 ret = do_shmat (first, (char __user *) ptr, second, &raddr);
113 if (ret)
114 return ret;
115 return put_user (raddr, (ulong __user *) third);
116 }
117 case 1: /* iBCS2 emulator entry point */
118 if (!segment_eq(get_fs(), get_ds()))
119 return -EINVAL;
120 /* The "(ulong *) third" is valid _only_ because of the kernel segment thing */
121 return do_shmat (first, (char __user *) ptr, second, (ulong *) third);
122 }
123 case SHMDT:
124 return sys_shmdt ((char __user *)ptr);
125 case SHMGET:
126 return sys_shmget (first, second, third);
127 case SHMCTL:
128 return sys_shmctl (first, second,
129 (struct shmid_ds __user *) ptr);
130 default:
131 return -ENOSYS;
132 }
133}
diff --git a/arch/h8300/include/asm/unistd.h b/arch/h8300/include/asm/unistd.h
index 54dab472695..50f2c5a3659 100644
--- a/arch/h8300/include/asm/unistd.h
+++ b/arch/h8300/include/asm/unistd.h
@@ -336,6 +336,7 @@
336#define __ARCH_WANT_STAT64 336#define __ARCH_WANT_STAT64
337#define __ARCH_WANT_SYS_ALARM 337#define __ARCH_WANT_SYS_ALARM
338#define __ARCH_WANT_SYS_GETHOSTNAME 338#define __ARCH_WANT_SYS_GETHOSTNAME
339#define __ARCH_WANT_SYS_IPC
339#define __ARCH_WANT_SYS_PAUSE 340#define __ARCH_WANT_SYS_PAUSE
340#define __ARCH_WANT_SYS_SGETMASK 341#define __ARCH_WANT_SYS_SGETMASK
341#define __ARCH_WANT_SYS_SIGNAL 342#define __ARCH_WANT_SYS_SIGNAL
diff --git a/arch/h8300/kernel/sys_h8300.c b/arch/h8300/kernel/sys_h8300.c
index 1f13fd6e530..f9b3f44da69 100644
--- a/arch/h8300/kernel/sys_h8300.c
+++ b/arch/h8300/kernel/sys_h8300.c
@@ -26,94 +26,6 @@
26#include <asm/traps.h> 26#include <asm/traps.h>
27#include <asm/unistd.h> 27#include <asm/unistd.h>
28 28
29/*
30 * sys_ipc() is the de-multiplexer for the SysV IPC calls..
31 *
32 * This is really horribly ugly.
33 */
34asmlinkage int sys_ipc (uint call, int first, int second,
35 int third, void *ptr, long fifth)
36{
37 int version, ret;
38
39 version = call >> 16; /* hack for backward compatibility */
40 call &= 0xffff;
41
42 if (call <= SEMCTL)
43 switch (call) {
44 case SEMOP:
45 return sys_semop (first, (struct sembuf *)ptr, second);
46 case SEMGET:
47 return sys_semget (first, second, third);
48 case SEMCTL: {
49 union semun fourth;
50 if (!ptr)
51 return -EINVAL;
52 if (get_user(fourth.__pad, (void **) ptr))
53 return -EFAULT;
54 return sys_semctl (first, second, third, fourth);
55 }
56 default:
57 return -EINVAL;
58 }
59 if (call <= MSGCTL)
60 switch (call) {
61 case MSGSND:
62 return sys_msgsnd (first, (struct msgbuf *) ptr,
63 second, third);
64 case MSGRCV:
65 switch (version) {
66 case 0: {
67 struct ipc_kludge tmp;
68 if (!ptr)
69 return -EINVAL;
70 if (copy_from_user (&tmp,
71 (struct ipc_kludge *)ptr,
72 sizeof (tmp)))
73 return -EFAULT;
74 return sys_msgrcv (first, tmp.msgp, second,
75 tmp.msgtyp, third);
76 }
77 default:
78 return sys_msgrcv (first,
79 (struct msgbuf *) ptr,
80 second, fifth, third);
81 }
82 case MSGGET:
83 return sys_msgget ((key_t) first, second);
84 case MSGCTL:
85 return sys_msgctl (first, second,
86 (struct msqid_ds *) ptr);
87 default:
88 return -EINVAL;
89 }
90 if (call <= SHMCTL)
91 switch (call) {
92 case SHMAT:
93 switch (version) {
94 default: {
95 ulong raddr;
96 ret = do_shmat (first, (char *) ptr,
97 second, &raddr);
98 if (ret)
99 return ret;
100 return put_user (raddr, (ulong *) third);
101 }
102 }
103 case SHMDT:
104 return sys_shmdt ((char *)ptr);
105 case SHMGET:
106 return sys_shmget (first, second, third);
107 case SHMCTL:
108 return sys_shmctl (first, second,
109 (struct shmid_ds *) ptr);
110 default:
111 return -EINVAL;
112 }
113
114 return -EINVAL;
115}
116
117/* sys_cacheflush -- no support. */ 29/* sys_cacheflush -- no support. */
118asmlinkage int 30asmlinkage int
119sys_cacheflush (unsigned long addr, int scope, int cache, unsigned long len) 31sys_cacheflush (unsigned long addr, int scope, int cache, unsigned long len)
diff --git a/arch/m32r/include/asm/unistd.h b/arch/m32r/include/asm/unistd.h
index cf701c93324..76125777483 100644
--- a/arch/m32r/include/asm/unistd.h
+++ b/arch/m32r/include/asm/unistd.h
@@ -339,6 +339,7 @@
339#define __ARCH_WANT_STAT64 339#define __ARCH_WANT_STAT64
340#define __ARCH_WANT_SYS_ALARM 340#define __ARCH_WANT_SYS_ALARM
341#define __ARCH_WANT_SYS_GETHOSTNAME 341#define __ARCH_WANT_SYS_GETHOSTNAME
342#define __ARCH_WANT_SYS_IPC
342#define __ARCH_WANT_SYS_PAUSE 343#define __ARCH_WANT_SYS_PAUSE
343#define __ARCH_WANT_SYS_TIME 344#define __ARCH_WANT_SYS_TIME
344#define __ARCH_WANT_SYS_UTIME 345#define __ARCH_WANT_SYS_UTIME
diff --git a/arch/m32r/kernel/sys_m32r.c b/arch/m32r/kernel/sys_m32r.c
index d3c865c5a6b..cf2e7279ce9 100644
--- a/arch/m32r/kernel/sys_m32r.c
+++ b/arch/m32r/kernel/sys_m32r.c
@@ -76,87 +76,6 @@ asmlinkage int sys_tas(int __user *addr)
76 return oldval; 76 return oldval;
77} 77}
78 78
79/*
80 * sys_ipc() is the de-multiplexer for the SysV IPC calls..
81 *
82 * This is really horribly ugly.
83 */
84asmlinkage int sys_ipc(uint call, int first, int second,
85 int third, void __user *ptr, long fifth)
86{
87 int version, ret;
88
89 version = call >> 16; /* hack for backward compatibility */
90 call &= 0xffff;
91
92 switch (call) {
93 case SEMOP:
94 return sys_semtimedop(first, (struct sembuf __user *)ptr,
95 second, NULL);
96 case SEMTIMEDOP:
97 return sys_semtimedop(first, (struct sembuf __user *)ptr,
98 second, (const struct timespec __user *)fifth);
99 case SEMGET:
100 return sys_semget (first, second, third);
101 case SEMCTL: {
102 union semun fourth;
103 if (!ptr)
104 return -EINVAL;
105 if (get_user(fourth.__pad, (void __user * __user *) ptr))
106 return -EFAULT;
107 return sys_semctl (first, second, third, fourth);
108 }
109
110 case MSGSND:
111 return sys_msgsnd (first, (struct msgbuf __user *) ptr,
112 second, third);
113 case MSGRCV:
114 switch (version) {
115 case 0: {
116 struct ipc_kludge tmp;
117 if (!ptr)
118 return -EINVAL;
119
120 if (copy_from_user(&tmp,
121 (struct ipc_kludge __user *) ptr,
122 sizeof (tmp)))
123 return -EFAULT;
124 return sys_msgrcv (first, tmp.msgp, second,
125 tmp.msgtyp, third);
126 }
127 default:
128 return sys_msgrcv (first,
129 (struct msgbuf __user *) ptr,
130 second, fifth, third);
131 }
132 case MSGGET:
133 return sys_msgget ((key_t) first, second);
134 case MSGCTL:
135 return sys_msgctl (first, second,
136 (struct msqid_ds __user *) ptr);
137 case SHMAT: {
138 ulong raddr;
139
140 if (!access_ok(VERIFY_WRITE, (ulong __user *) third,
141 sizeof(ulong)))
142 return -EFAULT;
143 ret = do_shmat (first, (char __user *) ptr, second, &raddr);
144 if (ret)
145 return ret;
146 return put_user (raddr, (ulong __user *) third);
147 }
148 case SHMDT:
149 return sys_shmdt ((char __user *)ptr);
150 case SHMGET:
151 return sys_shmget (first, second, third);
152 case SHMCTL:
153 return sys_shmctl (first, second,
154 (struct shmid_ds __user *) ptr);
155 default:
156 return -ENOSYS;
157 }
158}
159
160asmlinkage int sys_uname(struct old_utsname __user * name) 79asmlinkage int sys_uname(struct old_utsname __user * name)
161{ 80{
162 int err; 81 int err;
diff --git a/arch/m68k/include/asm/unistd.h b/arch/m68k/include/asm/unistd.h
index d801154310e..60b15d0aa07 100644
--- a/arch/m68k/include/asm/unistd.h
+++ b/arch/m68k/include/asm/unistd.h
@@ -351,6 +351,7 @@
351#define __ARCH_WANT_STAT64 351#define __ARCH_WANT_STAT64
352#define __ARCH_WANT_SYS_ALARM 352#define __ARCH_WANT_SYS_ALARM
353#define __ARCH_WANT_SYS_GETHOSTNAME 353#define __ARCH_WANT_SYS_GETHOSTNAME
354#define __ARCH_WANT_SYS_IPC
354#define __ARCH_WANT_SYS_PAUSE 355#define __ARCH_WANT_SYS_PAUSE
355#define __ARCH_WANT_SYS_SGETMASK 356#define __ARCH_WANT_SYS_SGETMASK
356#define __ARCH_WANT_SYS_SIGNAL 357#define __ARCH_WANT_SYS_SIGNAL
diff --git a/arch/m68k/kernel/sys_m68k.c b/arch/m68k/kernel/sys_m68k.c
index 7b309e7b6ce..77896692eb0 100644
--- a/arch/m68k/kernel/sys_m68k.c
+++ b/arch/m68k/kernel/sys_m68k.c
@@ -46,87 +46,6 @@ asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
46 return sys_mmap_pgoff(addr, len, prot, flags, fd, pgoff); 46 return sys_mmap_pgoff(addr, len, prot, flags, fd, pgoff);
47} 47}
48 48
49/*
50 * sys_ipc() is the de-multiplexer for the SysV IPC calls..
51 *
52 * This is really horribly ugly.
53 */
54asmlinkage int sys_ipc (uint call, int first, int second,
55 int third, void __user *ptr, long fifth)
56{
57 int version, ret;
58
59 version = call >> 16; /* hack for backward compatibility */
60 call &= 0xffff;
61
62 if (call <= SEMCTL)
63 switch (call) {
64 case SEMOP:
65 return sys_semop (first, ptr, second);
66 case SEMGET:
67 return sys_semget (first, second, third);
68 case SEMCTL: {
69 union semun fourth;
70 if (!ptr)
71 return -EINVAL;
72 if (get_user(fourth.__pad, (void __user *__user *) ptr))
73 return -EFAULT;
74 return sys_semctl (first, second, third, fourth);
75 }
76 default:
77 return -ENOSYS;
78 }
79 if (call <= MSGCTL)
80 switch (call) {
81 case MSGSND:
82 return sys_msgsnd (first, ptr, second, third);
83 case MSGRCV:
84 switch (version) {
85 case 0: {
86 struct ipc_kludge tmp;
87 if (!ptr)
88 return -EINVAL;
89 if (copy_from_user (&tmp, ptr, sizeof (tmp)))
90 return -EFAULT;
91 return sys_msgrcv (first, tmp.msgp, second,
92 tmp.msgtyp, third);
93 }
94 default:
95 return sys_msgrcv (first, ptr,
96 second, fifth, third);
97 }
98 case MSGGET:
99 return sys_msgget ((key_t) first, second);
100 case MSGCTL:
101 return sys_msgctl (first, second, ptr);
102 default:
103 return -ENOSYS;
104 }
105 if (call <= SHMCTL)
106 switch (call) {
107 case SHMAT:
108 switch (version) {
109 default: {
110 ulong raddr;
111 ret = do_shmat (first, ptr, second, &raddr);
112 if (ret)
113 return ret;
114 return put_user (raddr, (ulong __user *) third);
115 }
116 }
117 case SHMDT:
118 return sys_shmdt (ptr);
119 case SHMGET:
120 return sys_shmget (first, second, third);
121 case SHMCTL:
122 return sys_shmctl (first, second, ptr);
123 default:
124 return -ENOSYS;
125 }
126
127 return -EINVAL;
128}
129
130/* Convert virtual (user) address VADDR to physical address PADDR */ 49/* Convert virtual (user) address VADDR to physical address PADDR */
131#define virt_to_phys_040(vaddr) \ 50#define virt_to_phys_040(vaddr) \
132({ \ 51({ \
diff --git a/arch/m68knommu/kernel/sys_m68k.c b/arch/m68knommu/kernel/sys_m68k.c
index 3e371cc9fd9..d65e9c4c930 100644
--- a/arch/m68knommu/kernel/sys_m68k.c
+++ b/arch/m68knommu/kernel/sys_m68k.c
@@ -27,92 +27,6 @@
27#include <asm/cacheflush.h> 27#include <asm/cacheflush.h>
28#include <asm/unistd.h> 28#include <asm/unistd.h>
29 29
30/*
31 * sys_ipc() is the de-multiplexer for the SysV IPC calls..
32 *
33 * This is really horribly ugly.
34 */
35asmlinkage int sys_ipc (uint call, int first, int second,
36 int third, void *ptr, long fifth)
37{
38 int version, ret;
39
40 version = call >> 16; /* hack for backward compatibility */
41 call &= 0xffff;
42
43 if (call <= SEMCTL)
44 switch (call) {
45 case SEMOP:
46 return sys_semop (first, (struct sembuf *)ptr, second);
47 case SEMGET:
48 return sys_semget (first, second, third);
49 case SEMCTL: {
50 union semun fourth;
51 if (!ptr)
52 return -EINVAL;
53 if (get_user(fourth.__pad, (void **) ptr))
54 return -EFAULT;
55 return sys_semctl (first, second, third, fourth);
56 }
57 default:
58 return -EINVAL;
59 }
60 if (call <= MSGCTL)
61 switch (call) {
62 case MSGSND:
63 return sys_msgsnd (first, (struct msgbuf *) ptr,
64 second, third);
65 case MSGRCV:
66 switch (version) {
67 case 0: {
68 struct ipc_kludge tmp;
69 if (!ptr)
70 return -EINVAL;
71 if (copy_from_user (&tmp,
72 (struct ipc_kludge *)ptr,
73 sizeof (tmp)))
74 return -EFAULT;
75 return sys_msgrcv (first, tmp.msgp, second,
76 tmp.msgtyp, third);
77 }
78 default:
79 return sys_msgrcv (first,
80 (struct msgbuf *) ptr,
81 second, fifth, third);
82 }
83 case MSGGET:
84 return sys_msgget ((key_t) first, second);
85 case MSGCTL:
86 return sys_msgctl (first, second,
87 (struct msqid_ds *) ptr);
88 default:
89 return -EINVAL;
90 }
91 if (call <= SHMCTL)
92 switch (call) {
93 case SHMAT:
94 switch (version) {
95 default: {
96 ulong raddr;
97 ret = do_shmat (first, ptr, second, &raddr);
98 if (ret)
99 return ret;
100 return put_user (raddr, (ulong __user *) third);
101 }
102 }
103 case SHMDT:
104 return sys_shmdt (ptr);
105 case SHMGET:
106 return sys_shmget (first, second, third);
107 case SHMCTL:
108 return sys_shmctl (first, second, ptr);
109 default:
110 return -ENOSYS;
111 }
112
113 return -EINVAL;
114}
115
116/* sys_cacheflush -- flush (part of) the processor cache. */ 30/* sys_cacheflush -- flush (part of) the processor cache. */
117asmlinkage int 31asmlinkage int
118sys_cacheflush (unsigned long addr, int scope, int cache, unsigned long len) 32sys_cacheflush (unsigned long addr, int scope, int cache, unsigned long len)
diff --git a/arch/mips/include/asm/unistd.h b/arch/mips/include/asm/unistd.h
index 65c679ecbe6..97fe472095f 100644
--- a/arch/mips/include/asm/unistd.h
+++ b/arch/mips/include/asm/unistd.h
@@ -1004,6 +1004,7 @@
1004#define __ARCH_WANT_OLD_READDIR 1004#define __ARCH_WANT_OLD_READDIR
1005#define __ARCH_WANT_SYS_ALARM 1005#define __ARCH_WANT_SYS_ALARM
1006#define __ARCH_WANT_SYS_GETHOSTNAME 1006#define __ARCH_WANT_SYS_GETHOSTNAME
1007#define __ARCH_WANT_SYS_IPC
1007#define __ARCH_WANT_SYS_PAUSE 1008#define __ARCH_WANT_SYS_PAUSE
1008#define __ARCH_WANT_SYS_SGETMASK 1009#define __ARCH_WANT_SYS_SGETMASK
1009#define __ARCH_WANT_SYS_UTIME 1010#define __ARCH_WANT_SYS_UTIME
diff --git a/arch/mips/kernel/syscall.c b/arch/mips/kernel/syscall.c
index 3f7f466190b..257bf014177 100644
--- a/arch/mips/kernel/syscall.c
+++ b/arch/mips/kernel/syscall.c
@@ -407,94 +407,6 @@ _sys_sysmips(nabi_no_regargs struct pt_regs regs)
407} 407}
408 408
409/* 409/*
410 * sys_ipc() is the de-multiplexer for the SysV IPC calls..
411 *
412 * This is really horribly ugly.
413 */
414SYSCALL_DEFINE6(ipc, unsigned int, call, int, first, int, second,
415 unsigned long, third, void __user *, ptr, long, fifth)
416{
417 int version, ret;
418
419 version = call >> 16; /* hack for backward compatibility */
420 call &= 0xffff;
421
422 switch (call) {
423 case SEMOP:
424 return sys_semtimedop(first, (struct sembuf __user *)ptr,
425 second, NULL);
426 case SEMTIMEDOP:
427 return sys_semtimedop(first, (struct sembuf __user *)ptr,
428 second,
429 (const struct timespec __user *)fifth);
430 case SEMGET:
431 return sys_semget(first, second, third);
432 case SEMCTL: {
433 union semun fourth;
434 if (!ptr)
435 return -EINVAL;
436 if (get_user(fourth.__pad, (void __user *__user *) ptr))
437 return -EFAULT;
438 return sys_semctl(first, second, third, fourth);
439 }
440
441 case MSGSND:
442 return sys_msgsnd(first, (struct msgbuf __user *) ptr,
443 second, third);
444 case MSGRCV:
445 switch (version) {
446 case 0: {
447 struct ipc_kludge tmp;
448 if (!ptr)
449 return -EINVAL;
450
451 if (copy_from_user(&tmp,
452 (struct ipc_kludge __user *) ptr,
453 sizeof(tmp)))
454 return -EFAULT;
455 return sys_msgrcv(first, tmp.msgp, second,
456 tmp.msgtyp, third);
457 }
458 default:
459 return sys_msgrcv(first,
460 (struct msgbuf __user *) ptr,
461 second, fifth, third);
462 }
463 case MSGGET:
464 return sys_msgget((key_t) first, second);
465 case MSGCTL:
466 return sys_msgctl(first, second,
467 (struct msqid_ds __user *) ptr);
468
469 case SHMAT:
470 switch (version) {
471 default: {
472 unsigned long raddr;
473 ret = do_shmat(first, (char __user *) ptr, second,
474 &raddr);
475 if (ret)
476 return ret;
477 return put_user(raddr, (unsigned long __user *) third);
478 }
479 case 1: /* iBCS2 emulator entry point */
480 if (!segment_eq(get_fs(), get_ds()))
481 return -EINVAL;
482 return do_shmat(first, (char __user *) ptr, second,
483 (unsigned long *) third);
484 }
485 case SHMDT:
486 return sys_shmdt((char __user *)ptr);
487 case SHMGET:
488 return sys_shmget(first, second, third);
489 case SHMCTL:
490 return sys_shmctl(first, second,
491 (struct shmid_ds __user *) ptr);
492 default:
493 return -ENOSYS;
494 }
495}
496
497/*
498 * No implemented yet ... 410 * No implemented yet ...
499 */ 411 */
500SYSCALL_DEFINE3(cachectl, char *, addr, int, nbytes, int, op) 412SYSCALL_DEFINE3(cachectl, char *, addr, int, nbytes, int, op)
diff --git a/arch/mn10300/include/asm/unistd.h b/arch/mn10300/include/asm/unistd.h
index d13a56e99ba..9d056f51592 100644
--- a/arch/mn10300/include/asm/unistd.h
+++ b/arch/mn10300/include/asm/unistd.h
@@ -363,6 +363,7 @@
363#define __ARCH_WANT_STAT64 363#define __ARCH_WANT_STAT64
364#define __ARCH_WANT_SYS_ALARM 364#define __ARCH_WANT_SYS_ALARM
365#define __ARCH_WANT_SYS_GETHOSTNAME 365#define __ARCH_WANT_SYS_GETHOSTNAME
366#define __ARCH_WANT_SYS_IPC
366#define __ARCH_WANT_SYS_PAUSE 367#define __ARCH_WANT_SYS_PAUSE
367#define __ARCH_WANT_SYS_SGETMASK 368#define __ARCH_WANT_SYS_SGETMASK
368#define __ARCH_WANT_SYS_SIGNAL 369#define __ARCH_WANT_SYS_SIGNAL
diff --git a/arch/mn10300/kernel/sys_mn10300.c b/arch/mn10300/kernel/sys_mn10300.c
index bef69d6daf1..815f1355fad 100644
--- a/arch/mn10300/kernel/sys_mn10300.c
+++ b/arch/mn10300/kernel/sys_mn10300.c
@@ -31,91 +31,3 @@ asmlinkage long old_mmap(unsigned long addr, unsigned long len,
31 return -EINVAL; 31 return -EINVAL;
32 return sys_mmap_pgoff(addr, len, prot, flags, fd, offset >> PAGE_SHIFT); 32 return sys_mmap_pgoff(addr, len, prot, flags, fd, offset >> PAGE_SHIFT);
33} 33}
34
35/*
36 * sys_ipc() is the de-multiplexer for the SysV IPC calls..
37 *
38 * This is really horribly ugly.
39 */
40asmlinkage long sys_ipc(uint call, int first, int second,
41 int third, void __user *ptr, long fifth)
42{
43 int version, ret;
44
45 version = call >> 16; /* hack for backward compatibility */
46 call &= 0xffff;
47
48 switch (call) {
49 case SEMOP:
50 return sys_semtimedop(first, (struct sembuf __user *)ptr,
51 second, NULL);
52 case SEMTIMEDOP:
53 return sys_semtimedop(first, (struct sembuf __user *)ptr,
54 second,
55 (const struct timespec __user *)fifth);
56 case SEMGET:
57 return sys_semget(first, second, third);
58 case SEMCTL: {
59 union semun fourth;
60 if (!ptr)
61 return -EINVAL;
62 if (get_user(fourth.__pad, (void __user * __user *) ptr))
63 return -EFAULT;
64 return sys_semctl(first, second, third, fourth);
65 }
66
67 case MSGSND:
68 return sys_msgsnd(first, (struct msgbuf __user *) ptr,
69 second, third);
70 case MSGRCV:
71 switch (version) {
72 case 0: {
73 struct ipc_kludge tmp;
74 if (!ptr)
75 return -EINVAL;
76
77 if (copy_from_user(&tmp,
78 (struct ipc_kludge __user *) ptr,
79 sizeof(tmp)))
80 return -EFAULT;
81 return sys_msgrcv(first, tmp.msgp, second,
82 tmp.msgtyp, third);
83 }
84 default:
85 return sys_msgrcv(first,
86 (struct msgbuf __user *) ptr,
87 second, fifth, third);
88 }
89 case MSGGET:
90 return sys_msgget((key_t) first, second);
91 case MSGCTL:
92 return sys_msgctl(first, second,
93 (struct msqid_ds __user *) ptr);
94
95 case SHMAT:
96 switch (version) {
97 default: {
98 ulong raddr;
99 ret = do_shmat(first, (char __user *) ptr, second,
100 &raddr);
101 if (ret)
102 return ret;
103 return put_user(raddr, (ulong *) third);
104 }
105 case 1: /* iBCS2 emulator entry point */
106 if (!segment_eq(get_fs(), get_ds()))
107 return -EINVAL;
108 return do_shmat(first, (char __user *) ptr, second,
109 (ulong *) third);
110 }
111 case SHMDT:
112 return sys_shmdt((char __user *)ptr);
113 case SHMGET:
114 return sys_shmget(first, second, third);
115 case SHMCTL:
116 return sys_shmctl(first, second,
117 (struct shmid_ds __user *) ptr);
118 default:
119 return -EINVAL;
120 }
121}
diff --git a/arch/powerpc/include/asm/syscalls.h b/arch/powerpc/include/asm/syscalls.h
index eb8eb400c66..23bb74e7f94 100644
--- a/arch/powerpc/include/asm/syscalls.h
+++ b/arch/powerpc/include/asm/syscalls.h
@@ -35,8 +35,6 @@ asmlinkage long sys_pipe2(int __user *fildes, int flags);
35asmlinkage long sys_rt_sigaction(int sig, 35asmlinkage long sys_rt_sigaction(int sig,
36 const struct sigaction __user *act, 36 const struct sigaction __user *act,
37 struct sigaction __user *oact, size_t sigsetsize); 37 struct sigaction __user *oact, size_t sigsetsize);
38asmlinkage int sys_ipc(uint call, int first, unsigned long second,
39 long third, void __user *ptr, long fifth);
40asmlinkage long ppc64_personality(unsigned long personality); 38asmlinkage long ppc64_personality(unsigned long personality);
41asmlinkage int ppc_rtas(struct rtas_args __user *uargs); 39asmlinkage int ppc_rtas(struct rtas_args __user *uargs);
42asmlinkage time_t sys64_time(time_t __user * tloc); 40asmlinkage time_t sys64_time(time_t __user * tloc);
diff --git a/arch/powerpc/include/asm/unistd.h b/arch/powerpc/include/asm/unistd.h
index f6ca7617676..c13821fe874 100644
--- a/arch/powerpc/include/asm/unistd.h
+++ b/arch/powerpc/include/asm/unistd.h
@@ -364,6 +364,7 @@
364#define __ARCH_WANT_STAT64 364#define __ARCH_WANT_STAT64
365#define __ARCH_WANT_SYS_ALARM 365#define __ARCH_WANT_SYS_ALARM
366#define __ARCH_WANT_SYS_GETHOSTNAME 366#define __ARCH_WANT_SYS_GETHOSTNAME
367#define __ARCH_WANT_SYS_IPC
367#define __ARCH_WANT_SYS_PAUSE 368#define __ARCH_WANT_SYS_PAUSE
368#define __ARCH_WANT_SYS_SGETMASK 369#define __ARCH_WANT_SYS_SGETMASK
369#define __ARCH_WANT_SYS_SIGNAL 370#define __ARCH_WANT_SYS_SIGNAL
diff --git a/arch/powerpc/kernel/syscalls.c b/arch/powerpc/kernel/syscalls.c
index 3370e62e43d..5251221e7a5 100644
--- a/arch/powerpc/kernel/syscalls.c
+++ b/arch/powerpc/kernel/syscalls.c
@@ -42,100 +42,6 @@
42#include <asm/time.h> 42#include <asm/time.h>
43#include <asm/unistd.h> 43#include <asm/unistd.h>
44 44
45/*
46 * sys_ipc() is the de-multiplexer for the SysV IPC calls..
47 *
48 * This is really horribly ugly.
49 */
50int sys_ipc(uint call, int first, unsigned long second, long third,
51 void __user *ptr, long fifth)
52{
53 int version, ret;
54
55 version = call >> 16; /* hack for backward compatibility */
56 call &= 0xffff;
57
58 ret = -ENOSYS;
59 switch (call) {
60 case SEMOP:
61 ret = sys_semtimedop(first, (struct sembuf __user *)ptr,
62 (unsigned)second, NULL);
63 break;
64 case SEMTIMEDOP:
65 ret = sys_semtimedop(first, (struct sembuf __user *)ptr,
66 (unsigned)second,
67 (const struct timespec __user *) fifth);
68 break;
69 case SEMGET:
70 ret = sys_semget (first, (int)second, third);
71 break;
72 case SEMCTL: {
73 union semun fourth;
74
75 ret = -EINVAL;
76 if (!ptr)
77 break;
78 if ((ret = get_user(fourth.__pad, (void __user * __user *)ptr)))
79 break;
80 ret = sys_semctl(first, (int)second, third, fourth);
81 break;
82 }
83 case MSGSND:
84 ret = sys_msgsnd(first, (struct msgbuf __user *)ptr,
85 (size_t)second, third);
86 break;
87 case MSGRCV:
88 switch (version) {
89 case 0: {
90 struct ipc_kludge tmp;
91
92 ret = -EINVAL;
93 if (!ptr)
94 break;
95 if ((ret = copy_from_user(&tmp,
96 (struct ipc_kludge __user *) ptr,
97 sizeof (tmp)) ? -EFAULT : 0))
98 break;
99 ret = sys_msgrcv(first, tmp.msgp, (size_t) second,
100 tmp.msgtyp, third);
101 break;
102 }
103 default:
104 ret = sys_msgrcv (first, (struct msgbuf __user *) ptr,
105 (size_t)second, fifth, third);
106 break;
107 }
108 break;
109 case MSGGET:
110 ret = sys_msgget((key_t)first, (int)second);
111 break;
112 case MSGCTL:
113 ret = sys_msgctl(first, (int)second,
114 (struct msqid_ds __user *)ptr);
115 break;
116 case SHMAT: {
117 ulong raddr;
118 ret = do_shmat(first, (char __user *)ptr, (int)second, &raddr);
119 if (ret)
120 break;
121 ret = put_user(raddr, (ulong __user *) third);
122 break;
123 }
124 case SHMDT:
125 ret = sys_shmdt((char __user *)ptr);
126 break;
127 case SHMGET:
128 ret = sys_shmget(first, (size_t)second, third);
129 break;
130 case SHMCTL:
131 ret = sys_shmctl(first, (int)second,
132 (struct shmid_ds __user *)ptr);
133 break;
134 }
135
136 return ret;
137}
138
139static inline unsigned long do_mmap2(unsigned long addr, size_t len, 45static inline unsigned long do_mmap2(unsigned long addr, size_t len,
140 unsigned long prot, unsigned long flags, 46 unsigned long prot, unsigned long flags,
141 unsigned long fd, unsigned long off, int shift) 47 unsigned long fd, unsigned long off, int shift)
diff --git a/arch/s390/kernel/entry.h b/arch/s390/kernel/entry.h
index 5de54d2af0b..15fd68b196c 100644
--- a/arch/s390/kernel/entry.h
+++ b/arch/s390/kernel/entry.h
@@ -30,7 +30,7 @@ struct fadvise64_64_args;
30struct old_sigaction; 30struct old_sigaction;
31 31
32long sys_mmap2(struct s390_mmap_arg_struct __user *arg); 32long sys_mmap2(struct s390_mmap_arg_struct __user *arg);
33long sys_ipc(uint call, int first, unsigned long second, 33long sys_s390_ipc(uint call, int first, unsigned long second,
34 unsigned long third, void __user *ptr); 34 unsigned long third, void __user *ptr);
35long sys_s390_newuname(struct new_utsname __user *name); 35long sys_s390_newuname(struct new_utsname __user *name);
36long sys_s390_personality(unsigned long personality); 36long sys_s390_personality(unsigned long personality);
diff --git a/arch/s390/kernel/sys_s390.c b/arch/s390/kernel/sys_s390.c
index b2563509b5a..b8b78092ab7 100644
--- a/arch/s390/kernel/sys_s390.c
+++ b/arch/s390/kernel/sys_s390.c
@@ -64,7 +64,7 @@ out:
64 * 64 *
65 * This is really horribly ugly. 65 * This is really horribly ugly.
66 */ 66 */
67SYSCALL_DEFINE5(ipc, uint, call, int, first, unsigned long, second, 67SYSCALL_DEFINE5(s390_ipc, uint, call, int, first, unsigned long, second,
68 unsigned long, third, void __user *, ptr) 68 unsigned long, third, void __user *, ptr)
69{ 69{
70 struct ipc_kludge tmp; 70 struct ipc_kludge tmp;
diff --git a/arch/s390/kernel/syscalls.S b/arch/s390/kernel/syscalls.S
index 2a24766567a..990ac8b321c 100644
--- a/arch/s390/kernel/syscalls.S
+++ b/arch/s390/kernel/syscalls.S
@@ -125,7 +125,7 @@ NI_SYSCALL /* vm86old for i386 */
125SYSCALL(sys_wait4,sys_wait4,compat_sys_wait4_wrapper) 125SYSCALL(sys_wait4,sys_wait4,compat_sys_wait4_wrapper)
126SYSCALL(sys_swapoff,sys_swapoff,sys32_swapoff_wrapper) /* 115 */ 126SYSCALL(sys_swapoff,sys_swapoff,sys32_swapoff_wrapper) /* 115 */
127SYSCALL(sys_sysinfo,sys_sysinfo,compat_sys_sysinfo_wrapper) 127SYSCALL(sys_sysinfo,sys_sysinfo,compat_sys_sysinfo_wrapper)
128SYSCALL(sys_ipc,sys_ipc,sys32_ipc_wrapper) 128SYSCALL(sys_s390_ipc,sys_s390_ipc,sys32_ipc_wrapper)
129SYSCALL(sys_fsync,sys_fsync,sys32_fsync_wrapper) 129SYSCALL(sys_fsync,sys_fsync,sys32_fsync_wrapper)
130SYSCALL(sys_sigreturn,sys_sigreturn,sys32_sigreturn) 130SYSCALL(sys_sigreturn,sys_sigreturn,sys32_sigreturn)
131SYSCALL(sys_clone,sys_clone,sys_clone_wrapper) /* 120 */ 131SYSCALL(sys_clone,sys_clone,sys_clone_wrapper) /* 120 */
diff --git a/arch/sh/include/asm/syscalls.h b/arch/sh/include/asm/syscalls.h
index c1e2b8deb83..c1ce2862f7b 100644
--- a/arch/sh/include/asm/syscalls.h
+++ b/arch/sh/include/asm/syscalls.h
@@ -11,8 +11,6 @@ asmlinkage int old_mmap(unsigned long addr, unsigned long len,
11asmlinkage long sys_mmap2(unsigned long addr, unsigned long len, 11asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
12 unsigned long prot, unsigned long flags, 12 unsigned long prot, unsigned long flags,
13 unsigned long fd, unsigned long pgoff); 13 unsigned long fd, unsigned long pgoff);
14asmlinkage int sys_ipc(uint call, int first, int second,
15 int third, void __user *ptr, long fifth);
16asmlinkage int sys_uname(struct old_utsname __user *name); 14asmlinkage int sys_uname(struct old_utsname __user *name);
17 15
18#ifdef CONFIG_SUPERH32 16#ifdef CONFIG_SUPERH32
diff --git a/arch/sh/include/asm/unistd_32.h b/arch/sh/include/asm/unistd_32.h
index 365744b0526..a48f65e2e42 100644
--- a/arch/sh/include/asm/unistd_32.h
+++ b/arch/sh/include/asm/unistd_32.h
@@ -358,6 +358,7 @@
358#define __ARCH_WANT_STAT64 358#define __ARCH_WANT_STAT64
359#define __ARCH_WANT_SYS_ALARM 359#define __ARCH_WANT_SYS_ALARM
360#define __ARCH_WANT_SYS_GETHOSTNAME 360#define __ARCH_WANT_SYS_GETHOSTNAME
361#define __ARCH_WANT_SYS_IPC
361#define __ARCH_WANT_SYS_PAUSE 362#define __ARCH_WANT_SYS_PAUSE
362#define __ARCH_WANT_SYS_SGETMASK 363#define __ARCH_WANT_SYS_SGETMASK
363#define __ARCH_WANT_SYS_SIGNAL 364#define __ARCH_WANT_SYS_SIGNAL
diff --git a/arch/sh/include/asm/unistd_64.h b/arch/sh/include/asm/unistd_64.h
index 25de158aac3..7709b2b8f75 100644
--- a/arch/sh/include/asm/unistd_64.h
+++ b/arch/sh/include/asm/unistd_64.h
@@ -398,6 +398,7 @@
398#define __ARCH_WANT_STAT64 398#define __ARCH_WANT_STAT64
399#define __ARCH_WANT_SYS_ALARM 399#define __ARCH_WANT_SYS_ALARM
400#define __ARCH_WANT_SYS_GETHOSTNAME 400#define __ARCH_WANT_SYS_GETHOSTNAME
401#define __ARCH_WANT_SYS_IPC
401#define __ARCH_WANT_SYS_PAUSE 402#define __ARCH_WANT_SYS_PAUSE
402#define __ARCH_WANT_SYS_SGETMASK 403#define __ARCH_WANT_SYS_SGETMASK
403#define __ARCH_WANT_SYS_SIGNAL 404#define __ARCH_WANT_SYS_SIGNAL
diff --git a/arch/sh/kernel/sys_sh.c b/arch/sh/kernel/sys_sh.c
index 71399cde03b..c18cfaa67fd 100644
--- a/arch/sh/kernel/sys_sh.c
+++ b/arch/sh/kernel/sys_sh.c
@@ -53,110 +53,6 @@ asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
53 return sys_mmap_pgoff(addr, len, prot, flags, fd, pgoff); 53 return sys_mmap_pgoff(addr, len, prot, flags, fd, pgoff);
54} 54}
55 55
56/*
57 * sys_ipc() is the de-multiplexer for the SysV IPC calls..
58 *
59 * This is really horribly ugly.
60 */
61asmlinkage int sys_ipc(uint call, int first, int second,
62 int third, void __user *ptr, long fifth)
63{
64 int version, ret;
65
66 version = call >> 16; /* hack for backward compatibility */
67 call &= 0xffff;
68
69 if (call <= SEMTIMEDOP)
70 switch (call) {
71 case SEMOP:
72 return sys_semtimedop(first,
73 (struct sembuf __user *)ptr,
74 second, NULL);
75 case SEMTIMEDOP:
76 return sys_semtimedop(first,
77 (struct sembuf __user *)ptr, second,
78 (const struct timespec __user *)fifth);
79 case SEMGET:
80 return sys_semget (first, second, third);
81 case SEMCTL: {
82 union semun fourth;
83 if (!ptr)
84 return -EINVAL;
85 if (get_user(fourth.__pad, (void __user * __user *) ptr))
86 return -EFAULT;
87 return sys_semctl (first, second, third, fourth);
88 }
89 default:
90 return -EINVAL;
91 }
92
93 if (call <= MSGCTL)
94 switch (call) {
95 case MSGSND:
96 return sys_msgsnd (first, (struct msgbuf __user *) ptr,
97 second, third);
98 case MSGRCV:
99 switch (version) {
100 case 0:
101 {
102 struct ipc_kludge tmp;
103
104 if (!ptr)
105 return -EINVAL;
106
107 if (copy_from_user(&tmp,
108 (struct ipc_kludge __user *) ptr,
109 sizeof (tmp)))
110 return -EFAULT;
111
112 return sys_msgrcv (first, tmp.msgp, second,
113 tmp.msgtyp, third);
114 }
115 default:
116 return sys_msgrcv (first,
117 (struct msgbuf __user *) ptr,
118 second, fifth, third);
119 }
120 case MSGGET:
121 return sys_msgget ((key_t) first, second);
122 case MSGCTL:
123 return sys_msgctl (first, second,
124 (struct msqid_ds __user *) ptr);
125 default:
126 return -EINVAL;
127 }
128 if (call <= SHMCTL)
129 switch (call) {
130 case SHMAT:
131 switch (version) {
132 default: {
133 ulong raddr;
134 ret = do_shmat (first, (char __user *) ptr,
135 second, &raddr);
136 if (ret)
137 return ret;
138 return put_user (raddr, (ulong __user *) third);
139 }
140 case 1: /* iBCS2 emulator entry point */
141 if (!segment_eq(get_fs(), get_ds()))
142 return -EINVAL;
143 return do_shmat (first, (char __user *) ptr,
144 second, (ulong *) third);
145 }
146 case SHMDT:
147 return sys_shmdt ((char __user *)ptr);
148 case SHMGET:
149 return sys_shmget (first, second, third);
150 case SHMCTL:
151 return sys_shmctl (first, second,
152 (struct shmid_ds __user *) ptr);
153 default:
154 return -EINVAL;
155 }
156
157 return -EINVAL;
158}
159
160/* sys_cacheflush -- flush (part of) the processor cache. */ 56/* sys_cacheflush -- flush (part of) the processor cache. */
161asmlinkage int sys_cacheflush(unsigned long addr, unsigned long len, int op) 57asmlinkage int sys_cacheflush(unsigned long addr, unsigned long len, int op)
162{ 58{
diff --git a/arch/sparc/include/asm/unistd.h b/arch/sparc/include/asm/unistd.h
index cb4b9bfd0d8..d0b3b01ac9d 100644
--- a/arch/sparc/include/asm/unistd.h
+++ b/arch/sparc/include/asm/unistd.h
@@ -432,7 +432,9 @@
432#define __ARCH_WANT_SYS_SIGPENDING 432#define __ARCH_WANT_SYS_SIGPENDING
433#define __ARCH_WANT_SYS_SIGPROCMASK 433#define __ARCH_WANT_SYS_SIGPROCMASK
434#define __ARCH_WANT_SYS_RT_SIGSUSPEND 434#define __ARCH_WANT_SYS_RT_SIGSUSPEND
435#ifndef __32bit_syscall_numbers__ 435#ifdef __32bit_syscall_numbers__
436#define __ARCH_WANT_SYS_IPC
437#else
436#define __ARCH_WANT_COMPAT_SYS_TIME 438#define __ARCH_WANT_COMPAT_SYS_TIME
437#define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND 439#define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND
438#endif 440#endif
diff --git a/arch/sparc/kernel/sys_sparc_32.c b/arch/sparc/kernel/sys_sparc_32.c
index 3a82e65d8db..ee995b7dae7 100644
--- a/arch/sparc/kernel/sys_sparc_32.c
+++ b/arch/sparc/kernel/sys_sparc_32.c
@@ -98,119 +98,6 @@ out:
98 return error; 98 return error;
99} 99}
100 100
101/*
102 * sys_ipc() is the de-multiplexer for the SysV IPC calls..
103 *
104 * This is really horribly ugly.
105 */
106
107asmlinkage int sys_ipc (uint call, int first, int second, int third, void __user *ptr, long fifth)
108{
109 int version, err;
110
111 version = call >> 16; /* hack for backward compatibility */
112 call &= 0xffff;
113
114 if (call <= SEMCTL)
115 switch (call) {
116 case SEMOP:
117 err = sys_semtimedop (first, (struct sembuf __user *)ptr, second, NULL);
118 goto out;
119 case SEMTIMEDOP:
120 err = sys_semtimedop (first, (struct sembuf __user *)ptr, second, (const struct timespec __user *) fifth);
121 goto out;
122 case SEMGET:
123 err = sys_semget (first, second, third);
124 goto out;
125 case SEMCTL: {
126 union semun fourth;
127 err = -EINVAL;
128 if (!ptr)
129 goto out;
130 err = -EFAULT;
131 if (get_user(fourth.__pad,
132 (void __user * __user *)ptr))
133 goto out;
134 err = sys_semctl (first, second, third, fourth);
135 goto out;
136 }
137 default:
138 err = -ENOSYS;
139 goto out;
140 }
141 if (call <= MSGCTL)
142 switch (call) {
143 case MSGSND:
144 err = sys_msgsnd (first, (struct msgbuf __user *) ptr,
145 second, third);
146 goto out;
147 case MSGRCV:
148 switch (version) {
149 case 0: {
150 struct ipc_kludge tmp;
151 err = -EINVAL;
152 if (!ptr)
153 goto out;
154 err = -EFAULT;
155 if (copy_from_user(&tmp, (struct ipc_kludge __user *) ptr, sizeof (tmp)))
156 goto out;
157 err = sys_msgrcv (first, tmp.msgp, second, tmp.msgtyp, third);
158 goto out;
159 }
160 case 1: default:
161 err = sys_msgrcv (first,
162 (struct msgbuf __user *) ptr,
163 second, fifth, third);
164 goto out;
165 }
166 case MSGGET:
167 err = sys_msgget ((key_t) first, second);
168 goto out;
169 case MSGCTL:
170 err = sys_msgctl (first, second, (struct msqid_ds __user *) ptr);
171 goto out;
172 default:
173 err = -ENOSYS;
174 goto out;
175 }
176 if (call <= SHMCTL)
177 switch (call) {
178 case SHMAT:
179 switch (version) {
180 case 0: default: {
181 ulong raddr;
182 err = do_shmat (first, (char __user *) ptr, second, &raddr);
183 if (err)
184 goto out;
185 err = -EFAULT;
186 if (put_user (raddr, (ulong __user *) third))
187 goto out;
188 err = 0;
189 goto out;
190 }
191 case 1: /* iBCS2 emulator entry point */
192 err = -EINVAL;
193 goto out;
194 }
195 case SHMDT:
196 err = sys_shmdt ((char __user *)ptr);
197 goto out;
198 case SHMGET:
199 err = sys_shmget (first, second, third);
200 goto out;
201 case SHMCTL:
202 err = sys_shmctl (first, second, (struct shmid_ds __user *) ptr);
203 goto out;
204 default:
205 err = -ENOSYS;
206 goto out;
207 }
208 else
209 err = -ENOSYS;
210out:
211 return err;
212}
213
214int sparc_mmap_check(unsigned long addr, unsigned long len) 101int sparc_mmap_check(unsigned long addr, unsigned long len)
215{ 102{
216 if (ARCH_SUN4C && 103 if (ARCH_SUN4C &&
diff --git a/arch/sparc/kernel/sys_sparc_64.c b/arch/sparc/kernel/sys_sparc_64.c
index cb1bef6f14b..45410e93962 100644
--- a/arch/sparc/kernel/sys_sparc_64.c
+++ b/arch/sparc/kernel/sys_sparc_64.c
@@ -426,7 +426,7 @@ out:
426 * This is really horribly ugly. 426 * This is really horribly ugly.
427 */ 427 */
428 428
429SYSCALL_DEFINE6(ipc, unsigned int, call, int, first, unsigned long, second, 429SYSCALL_DEFINE6(sparc_ipc, unsigned int, call, int, first, unsigned long, second,
430 unsigned long, third, void __user *, ptr, long, fifth) 430 unsigned long, third, void __user *, ptr, long, fifth)
431{ 431{
432 long err; 432 long err;
diff --git a/arch/sparc/kernel/systbls.h b/arch/sparc/kernel/systbls.h
index 68312fe8da7..2c331c37e74 100644
--- a/arch/sparc/kernel/systbls.h
+++ b/arch/sparc/kernel/systbls.h
@@ -10,7 +10,7 @@ struct new_utsname;
10 10
11extern asmlinkage unsigned long sys_getpagesize(void); 11extern asmlinkage unsigned long sys_getpagesize(void);
12extern asmlinkage long sparc_pipe(struct pt_regs *regs); 12extern asmlinkage long sparc_pipe(struct pt_regs *regs);
13extern asmlinkage long sys_ipc(unsigned int call, int first, 13extern asmlinkage long sys_sparc_ipc(unsigned int call, int first,
14 unsigned long second, 14 unsigned long second,
15 unsigned long third, 15 unsigned long third,
16 void __user *ptr, long fifth); 16 void __user *ptr, long fifth);
diff --git a/arch/sparc/kernel/systbls_64.S b/arch/sparc/kernel/systbls_64.S
index 17614251fb6..30ca2b1d3a1 100644
--- a/arch/sparc/kernel/systbls_64.S
+++ b/arch/sparc/kernel/systbls_64.S
@@ -136,7 +136,7 @@ sys_call_table:
136/*200*/ .word sys_ssetmask, sys_nis_syscall, sys_newlstat, sys_uselib, sys_nis_syscall 136/*200*/ .word sys_ssetmask, sys_nis_syscall, sys_newlstat, sys_uselib, sys_nis_syscall
137 .word sys_readahead, sys_socketcall, sys_syslog, sys_lookup_dcookie, sys_fadvise64 137 .word sys_readahead, sys_socketcall, sys_syslog, sys_lookup_dcookie, sys_fadvise64
138/*210*/ .word sys_fadvise64_64, sys_tgkill, sys_waitpid, sys_swapoff, sys_sysinfo 138/*210*/ .word sys_fadvise64_64, sys_tgkill, sys_waitpid, sys_swapoff, sys_sysinfo
139 .word sys_ipc, sys_nis_syscall, sys_clone, sys_ioprio_get, sys_adjtimex 139 .word sys_sparc_ipc, sys_nis_syscall, sys_clone, sys_ioprio_get, sys_adjtimex
140/*220*/ .word sys_nis_syscall, sys_ni_syscall, sys_delete_module, sys_ni_syscall, sys_getpgid 140/*220*/ .word sys_nis_syscall, sys_ni_syscall, sys_delete_module, sys_ni_syscall, sys_getpgid
141 .word sys_bdflush, sys_sysfs, sys_nis_syscall, sys_setfsuid, sys_setfsgid 141 .word sys_bdflush, sys_sysfs, sys_nis_syscall, sys_setfsuid, sys_setfsgid
142/*230*/ .word sys_select, sys_nis_syscall, sys_splice, sys_stime, sys_statfs64 142/*230*/ .word sys_select, sys_nis_syscall, sys_splice, sys_stime, sys_statfs64
diff --git a/arch/um/sys-i386/syscalls.c b/arch/um/sys-i386/syscalls.c
index d0aa8f125ee..70ca357393b 100644
--- a/arch/um/sys-i386/syscalls.c
+++ b/arch/um/sys-i386/syscalls.c
@@ -34,92 +34,6 @@ long sys_clone(unsigned long clone_flags, unsigned long newsp,
34 return ret; 34 return ret;
35} 35}
36 36
37/*
38 * sys_ipc() is the de-multiplexer for the SysV IPC calls..
39 *
40 * This is really horribly ugly.
41 */
42long sys_ipc (uint call, int first, int second,
43 int third, void __user *ptr, long fifth)
44{
45 int version, ret;
46
47 version = call >> 16; /* hack for backward compatibility */
48 call &= 0xffff;
49
50 switch (call) {
51 case SEMOP:
52 return sys_semtimedop(first, (struct sembuf __user *) ptr,
53 second, NULL);
54 case SEMTIMEDOP:
55 return sys_semtimedop(first, (struct sembuf __user *) ptr,
56 second,
57 (const struct timespec __user *) fifth);
58 case SEMGET:
59 return sys_semget (first, second, third);
60 case SEMCTL: {
61 union semun fourth;
62 if (!ptr)
63 return -EINVAL;
64 if (get_user(fourth.__pad, (void __user * __user *) ptr))
65 return -EFAULT;
66 return sys_semctl (first, second, third, fourth);
67 }
68
69 case MSGSND:
70 return sys_msgsnd (first, (struct msgbuf *) ptr,
71 second, third);
72 case MSGRCV:
73 switch (version) {
74 case 0: {
75 struct ipc_kludge tmp;
76 if (!ptr)
77 return -EINVAL;
78
79 if (copy_from_user(&tmp,
80 (struct ipc_kludge *) ptr,
81 sizeof (tmp)))
82 return -EFAULT;
83 return sys_msgrcv (first, tmp.msgp, second,
84 tmp.msgtyp, third);
85 }
86 default:
87 panic("msgrcv with version != 0");
88 return sys_msgrcv (first,
89 (struct msgbuf *) ptr,
90 second, fifth, third);
91 }
92 case MSGGET:
93 return sys_msgget ((key_t) first, second);
94 case MSGCTL:
95 return sys_msgctl (first, second, (struct msqid_ds *) ptr);
96
97 case SHMAT:
98 switch (version) {
99 default: {
100 ulong raddr;
101 ret = do_shmat (first, (char *) ptr, second, &raddr);
102 if (ret)
103 return ret;
104 return put_user (raddr, (ulong *) third);
105 }
106 case 1: /* iBCS2 emulator entry point */
107 if (!segment_eq(get_fs(), get_ds()))
108 return -EINVAL;
109 return do_shmat (first, (char *) ptr, second, (ulong *) third);
110 }
111 case SHMDT:
112 return sys_shmdt ((char *)ptr);
113 case SHMGET:
114 return sys_shmget (first, second, third);
115 case SHMCTL:
116 return sys_shmctl (first, second,
117 (struct shmid_ds *) ptr);
118 default:
119 return -ENOSYS;
120 }
121}
122
123long sys_sigaction(int sig, const struct old_sigaction __user *act, 37long sys_sigaction(int sig, const struct old_sigaction __user *act,
124 struct old_sigaction __user *oact) 38 struct old_sigaction __user *oact)
125{ 39{
diff --git a/arch/x86/include/asm/syscalls.h b/arch/x86/include/asm/syscalls.h
index 86ab6a0623f..50f6a569f0d 100644
--- a/arch/x86/include/asm/syscalls.h
+++ b/arch/x86/include/asm/syscalls.h
@@ -54,7 +54,6 @@ unsigned long sys_sigreturn(struct pt_regs *);
54struct oldold_utsname; 54struct oldold_utsname;
55struct old_utsname; 55struct old_utsname;
56 56
57asmlinkage int sys_ipc(uint, int, int, int, void __user *, long);
58asmlinkage int sys_uname(struct old_utsname __user *); 57asmlinkage int sys_uname(struct old_utsname __user *);
59asmlinkage int sys_olduname(struct oldold_utsname __user *); 58asmlinkage int sys_olduname(struct oldold_utsname __user *);
60 59
diff --git a/arch/x86/include/asm/unistd_32.h b/arch/x86/include/asm/unistd_32.h
index daa65d9aae9..45e64a17b86 100644
--- a/arch/x86/include/asm/unistd_32.h
+++ b/arch/x86/include/asm/unistd_32.h
@@ -354,6 +354,7 @@
354#define __ARCH_WANT_STAT64 354#define __ARCH_WANT_STAT64
355#define __ARCH_WANT_SYS_ALARM 355#define __ARCH_WANT_SYS_ALARM
356#define __ARCH_WANT_SYS_GETHOSTNAME 356#define __ARCH_WANT_SYS_GETHOSTNAME
357#define __ARCH_WANT_SYS_IPC
357#define __ARCH_WANT_SYS_PAUSE 358#define __ARCH_WANT_SYS_PAUSE
358#define __ARCH_WANT_SYS_SGETMASK 359#define __ARCH_WANT_SYS_SGETMASK
359#define __ARCH_WANT_SYS_SIGNAL 360#define __ARCH_WANT_SYS_SIGNAL
diff --git a/arch/x86/kernel/sys_i386_32.c b/arch/x86/kernel/sys_i386_32.c
index 7955e90c834..8b5c348fdcf 100644
--- a/arch/x86/kernel/sys_i386_32.c
+++ b/arch/x86/kernel/sys_i386_32.c
@@ -25,91 +25,6 @@
25#include <asm/syscalls.h> 25#include <asm/syscalls.h>
26 26
27/* 27/*
28 * sys_ipc() is the de-multiplexer for the SysV IPC calls..
29 *
30 * This is really horribly ugly.
31 */
32asmlinkage int sys_ipc(uint call, int first, int second,
33 int third, void __user *ptr, long fifth)
34{
35 int version, ret;
36
37 version = call >> 16; /* hack for backward compatibility */
38 call &= 0xffff;
39
40 switch (call) {
41 case SEMOP:
42 return sys_semtimedop(first, (struct sembuf __user *)ptr, second, NULL);
43 case SEMTIMEDOP:
44 return sys_semtimedop(first, (struct sembuf __user *)ptr, second,
45 (const struct timespec __user *)fifth);
46
47 case SEMGET:
48 return sys_semget(first, second, third);
49 case SEMCTL: {
50 union semun fourth;
51 if (!ptr)
52 return -EINVAL;
53 if (get_user(fourth.__pad, (void __user * __user *) ptr))
54 return -EFAULT;
55 return sys_semctl(first, second, third, fourth);
56 }
57
58 case MSGSND:
59 return sys_msgsnd(first, (struct msgbuf __user *) ptr,
60 second, third);
61 case MSGRCV:
62 switch (version) {
63 case 0: {
64 struct ipc_kludge tmp;
65 if (!ptr)
66 return -EINVAL;
67
68 if (copy_from_user(&tmp,
69 (struct ipc_kludge __user *) ptr,
70 sizeof(tmp)))
71 return -EFAULT;
72 return sys_msgrcv(first, tmp.msgp, second,
73 tmp.msgtyp, third);
74 }
75 default:
76 return sys_msgrcv(first,
77 (struct msgbuf __user *) ptr,
78 second, fifth, third);
79 }
80 case MSGGET:
81 return sys_msgget((key_t) first, second);
82 case MSGCTL:
83 return sys_msgctl(first, second, (struct msqid_ds __user *) ptr);
84
85 case SHMAT:
86 switch (version) {
87 default: {
88 ulong raddr;
89 ret = do_shmat(first, (char __user *) ptr, second, &raddr);
90 if (ret)
91 return ret;
92 return put_user(raddr, (ulong __user *) third);
93 }
94 case 1: /* iBCS2 emulator entry point */
95 if (!segment_eq(get_fs(), get_ds()))
96 return -EINVAL;
97 /* The "(ulong *) third" is valid _only_ because of the kernel segment thing */
98 return do_shmat(first, (char __user *) ptr, second, (ulong *) third);
99 }
100 case SHMDT:
101 return sys_shmdt((char __user *)ptr);
102 case SHMGET:
103 return sys_shmget(first, second, third);
104 case SHMCTL:
105 return sys_shmctl(first, second,
106 (struct shmid_ds __user *) ptr);
107 default:
108 return -ENOSYS;
109 }
110}
111
112/*
113 * Old cruft 28 * Old cruft
114 */ 29 */
115asmlinkage int sys_uname(struct old_utsname __user *name) 30asmlinkage int sys_uname(struct old_utsname __user *name)
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index b60907e3b0d..fbb61ae70e0 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -684,6 +684,8 @@ asmlinkage long sys_shmat(int shmid, char __user *shmaddr, int shmflg);
684asmlinkage long sys_shmget(key_t key, size_t size, int flag); 684asmlinkage long sys_shmget(key_t key, size_t size, int flag);
685asmlinkage long sys_shmdt(char __user *shmaddr); 685asmlinkage long sys_shmdt(char __user *shmaddr);
686asmlinkage long sys_shmctl(int shmid, int cmd, struct shmid_ds __user *buf); 686asmlinkage long sys_shmctl(int shmid, int cmd, struct shmid_ds __user *buf);
687asmlinkage long sys_ipc(unsigned int call, int first, int second,
688 unsigned long third, void __user *ptr, long fifth);
687 689
688asmlinkage long sys_mq_open(const char __user *name, int oflag, mode_t mode, struct mq_attr __user *attr); 690asmlinkage long sys_mq_open(const char __user *name, int oflag, mode_t mode, struct mq_attr __user *attr);
689asmlinkage long sys_mq_unlink(const char __user *name); 691asmlinkage long sys_mq_unlink(const char __user *name);
diff --git a/ipc/Makefile b/ipc/Makefile
index 4e1955ea815..9075e172e52 100644
--- a/ipc/Makefile
+++ b/ipc/Makefile
@@ -3,7 +3,7 @@
3# 3#
4 4
5obj-$(CONFIG_SYSVIPC_COMPAT) += compat.o 5obj-$(CONFIG_SYSVIPC_COMPAT) += compat.o
6obj-$(CONFIG_SYSVIPC) += util.o msgutil.o msg.o sem.o shm.o ipcns_notifier.o 6obj-$(CONFIG_SYSVIPC) += util.o msgutil.o msg.o sem.o shm.o ipcns_notifier.o syscall.o
7obj-$(CONFIG_SYSVIPC_SYSCTL) += ipc_sysctl.o 7obj-$(CONFIG_SYSVIPC_SYSCTL) += ipc_sysctl.o
8obj_mq-$(CONFIG_COMPAT) += compat_mq.o 8obj_mq-$(CONFIG_COMPAT) += compat_mq.o
9obj-$(CONFIG_POSIX_MQUEUE) += mqueue.o msgutil.o $(obj_mq-y) 9obj-$(CONFIG_POSIX_MQUEUE) += mqueue.o msgutil.o $(obj_mq-y)
diff --git a/ipc/syscall.c b/ipc/syscall.c
new file mode 100644
index 00000000000..355a3da9ec7
--- /dev/null
+++ b/ipc/syscall.c
@@ -0,0 +1,99 @@
1/*
2 * sys_ipc() is the old de-multiplexer for the SysV IPC calls.
3 *
4 * This is really horribly ugly, and new architectures should just wire up
5 * the individual syscalls instead.
6 */
7#include <linux/unistd.h>
8
9#ifdef __ARCH_WANT_SYS_IPC
10#include <linux/errno.h>
11#include <linux/ipc.h>
12#include <linux/shm.h>
13#include <linux/syscalls.h>
14#include <linux/uaccess.h>
15
16SYSCALL_DEFINE6(ipc, unsigned int, call, int, first, int, second,
17 unsigned long, third, void __user *, ptr, long, fifth)
18{
19 int version, ret;
20
21 version = call >> 16; /* hack for backward compatibility */
22 call &= 0xffff;
23
24 switch (call) {
25 case SEMOP:
26 return sys_semtimedop(first, (struct sembuf __user *)ptr,
27 second, NULL);
28 case SEMTIMEDOP:
29 return sys_semtimedop(first, (struct sembuf __user *)ptr,
30 second,
31 (const struct timespec __user *)fifth);
32
33 case SEMGET:
34 return sys_semget(first, second, third);
35 case SEMCTL: {
36 union semun fourth;
37 if (!ptr)
38 return -EINVAL;
39 if (get_user(fourth.__pad, (void __user * __user *) ptr))
40 return -EFAULT;
41 return sys_semctl(first, second, third, fourth);
42 }
43
44 case MSGSND:
45 return sys_msgsnd(first, (struct msgbuf __user *) ptr,
46 second, third);
47 case MSGRCV:
48 switch (version) {
49 case 0: {
50 struct ipc_kludge tmp;
51 if (!ptr)
52 return -EINVAL;
53
54 if (copy_from_user(&tmp,
55 (struct ipc_kludge __user *) ptr,
56 sizeof(tmp)))
57 return -EFAULT;
58 return sys_msgrcv(first, tmp.msgp, second,
59 tmp.msgtyp, third);
60 }
61 default:
62 return sys_msgrcv(first,
63 (struct msgbuf __user *) ptr,
64 second, fifth, third);
65 }
66 case MSGGET:
67 return sys_msgget((key_t) first, second);
68 case MSGCTL:
69 return sys_msgctl(first, second, (struct msqid_ds __user *)ptr);
70
71 case SHMAT:
72 switch (version) {
73 default: {
74 unsigned long raddr;
75 ret = do_shmat(first, (char __user *)ptr,
76 second, &raddr);
77 if (ret)
78 return ret;
79 return put_user(raddr, (unsigned long __user *) third);
80 }
81 case 1:
82 /*
83 * This was the entry point for kernel-originating calls
84 * from iBCS2 in 2.2 days.
85 */
86 return -EINVAL;
87 }
88 case SHMDT:
89 return sys_shmdt((char __user *)ptr);
90 case SHMGET:
91 return sys_shmget(first, second, third);
92 case SHMCTL:
93 return sys_shmctl(first, second,
94 (struct shmid_ds __user *) ptr);
95 default:
96 return -ENOSYS;
97 }
98}
99#endif
diff --git a/kernel/sys_ni.c b/kernel/sys_ni.c
index 695384f12a7..70f2ea758ff 100644
--- a/kernel/sys_ni.c
+++ b/kernel/sys_ni.c
@@ -126,6 +126,7 @@ cond_syscall(sys_setreuid16);
126cond_syscall(sys_setuid16); 126cond_syscall(sys_setuid16);
127cond_syscall(sys_vm86old); 127cond_syscall(sys_vm86old);
128cond_syscall(sys_vm86); 128cond_syscall(sys_vm86);
129cond_syscall(sys_ipc);
129cond_syscall(compat_sys_ipc); 130cond_syscall(compat_sys_ipc);
130cond_syscall(compat_sys_sysctl); 131cond_syscall(compat_sys_sysctl);
131cond_syscall(sys_flock); 132cond_syscall(sys_flock);