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/um | |
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/um')
-rw-r--r-- | arch/um/sys-i386/syscalls.c | 86 |
1 files changed, 0 insertions, 86 deletions
diff --git a/arch/um/sys-i386/syscalls.c b/arch/um/sys-i386/syscalls.c index d0aa8f125ee6..70ca357393b8 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 | */ | ||
42 | long 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 | |||
123 | long sys_sigaction(int sig, const struct old_sigaction __user *act, | 37 | long sys_sigaction(int sig, const struct old_sigaction __user *act, |
124 | struct old_sigaction __user *oact) | 38 | struct old_sigaction __user *oact) |
125 | { | 39 | { |