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/m68k/kernel | |
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/m68k/kernel')
-rw-r--r-- | arch/m68k/kernel/sys_m68k.c | 81 |
1 files changed, 0 insertions, 81 deletions
diff --git a/arch/m68k/kernel/sys_m68k.c b/arch/m68k/kernel/sys_m68k.c index 7b309e7b6cef..77896692eb0a 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 | */ | ||
54 | asmlinkage 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 | ({ \ |