diff options
author | Christoph Hellwig <hch@lst.de> | 2010-03-10 18:21:18 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-03-12 18:52:32 -0500 |
commit | baed7fc9b580bd3fb8252ff1d9b36eaf1f86b670 (patch) | |
tree | 38f23cd9888b92de3f73ed1f4ce48cd83e940e0e /arch/arm | |
parent | a4679373cf4ee0e7792dc56205365732b725c2c1 (diff) |
Add generic sys_ipc wrapper
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>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/include/asm/unistd.h | 1 | ||||
-rw-r--r-- | arch/arm/kernel/sys_arm.c | 82 | ||||
-rw-r--r-- | arch/arm/kernel/sys_oabi-compat.c | 3 |
3 files changed, 1 insertions, 85 deletions
diff --git a/arch/arm/include/asm/unistd.h b/arch/arm/include/asm/unistd.h index e6eeb2d29953..dd2bf53000fe 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 a2e0e6f2ea7f..4350f75e578c 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 | */ | ||
37 | asmlinkage 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 d59a0cd537f0..33ff678e32f2 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 | ||
349 | extern asmlinkage int sys_ipc(uint call, int first, int second, int third, | ||
350 | void __user *ptr, long fifth); | ||
351 | |||
352 | asmlinkage int sys_oabi_ipc(uint call, int first, int second, int third, | 349 | asmlinkage 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 | { |