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/m68knommu/kernel/sys_m68k.c | |
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/m68knommu/kernel/sys_m68k.c')
-rw-r--r-- | arch/m68knommu/kernel/sys_m68k.c | 86 |
1 files changed, 0 insertions, 86 deletions
diff --git a/arch/m68knommu/kernel/sys_m68k.c b/arch/m68knommu/kernel/sys_m68k.c index 3e371cc9fd91..d65e9c4c930c 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 | */ | ||
35 | asmlinkage 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. */ |
117 | asmlinkage int | 31 | asmlinkage int |
118 | sys_cacheflush (unsigned long addr, int scope, int cache, unsigned long len) | 32 | sys_cacheflush (unsigned long addr, int scope, int cache, unsigned long len) |