diff options
author | Heiko Carstens <heiko.carstens@de.ibm.com> | 2011-12-27 05:27:21 -0500 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2011-12-27 05:27:13 -0500 |
commit | 3a3954ceae756ed2a5d53b45c67db6dde3c0c126 (patch) | |
tree | efbd3a8e942432454deb32bb713bfd2b1e5cff22 /arch/s390 | |
parent | 2389aef47efe32bd4ad2b7d47f157766d3680caa (diff) |
[S390] ipc: call generic sys_ipc demultiplexer
Call generic IPC demultiplexer instead of having a nearly identical
s390 variant. Also make sure that native and compat handling now have
the same behaviour.
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390')
-rw-r--r-- | arch/s390/include/asm/unistd.h | 1 | ||||
-rw-r--r-- | arch/s390/kernel/compat_linux.c | 3 | ||||
-rw-r--r-- | arch/s390/kernel/sys_s390.c | 76 |
3 files changed, 13 insertions, 67 deletions
diff --git a/arch/s390/include/asm/unistd.h b/arch/s390/include/asm/unistd.h index 58de4c91c333..8a8008fe7b8f 100644 --- a/arch/s390/include/asm/unistd.h +++ b/arch/s390/include/asm/unistd.h | |||
@@ -398,6 +398,7 @@ | |||
398 | #define __ARCH_WANT_SYS_SIGNAL | 398 | #define __ARCH_WANT_SYS_SIGNAL |
399 | #define __ARCH_WANT_SYS_UTIME | 399 | #define __ARCH_WANT_SYS_UTIME |
400 | #define __ARCH_WANT_SYS_SOCKETCALL | 400 | #define __ARCH_WANT_SYS_SOCKETCALL |
401 | #define __ARCH_WANT_SYS_IPC | ||
401 | #define __ARCH_WANT_SYS_FADVISE64 | 402 | #define __ARCH_WANT_SYS_FADVISE64 |
402 | #define __ARCH_WANT_SYS_GETPGRP | 403 | #define __ARCH_WANT_SYS_GETPGRP |
403 | #define __ARCH_WANT_SYS_LLSEEK | 404 | #define __ARCH_WANT_SYS_LLSEEK |
diff --git a/arch/s390/kernel/compat_linux.c b/arch/s390/kernel/compat_linux.c index 84a982898448..ab64bdbab2ae 100644 --- a/arch/s390/kernel/compat_linux.c +++ b/arch/s390/kernel/compat_linux.c | |||
@@ -278,9 +278,6 @@ asmlinkage long sys32_ipc(u32 call, int first, int second, int third, u32 ptr) | |||
278 | { | 278 | { |
279 | if (call >> 16) /* hack for backward compatibility */ | 279 | if (call >> 16) /* hack for backward compatibility */ |
280 | return -EINVAL; | 280 | return -EINVAL; |
281 | |||
282 | call &= 0xffff; | ||
283 | |||
284 | switch (call) { | 281 | switch (call) { |
285 | case SEMTIMEDOP: | 282 | case SEMTIMEDOP: |
286 | return compat_sys_semtimedop(first, compat_ptr(ptr), | 283 | return compat_sys_semtimedop(first, compat_ptr(ptr), |
diff --git a/arch/s390/kernel/sys_s390.c b/arch/s390/kernel/sys_s390.c index 476081440df9..78ea1948ff51 100644 --- a/arch/s390/kernel/sys_s390.c +++ b/arch/s390/kernel/sys_s390.c | |||
@@ -60,74 +60,22 @@ out: | |||
60 | } | 60 | } |
61 | 61 | ||
62 | /* | 62 | /* |
63 | * sys_ipc() is the de-multiplexer for the SysV IPC calls.. | 63 | * sys_ipc() is the de-multiplexer for the SysV IPC calls. |
64 | * | ||
65 | * This is really horribly ugly. | ||
66 | */ | 64 | */ |
67 | SYSCALL_DEFINE5(s390_ipc, uint, call, int, first, unsigned long, second, | 65 | SYSCALL_DEFINE5(s390_ipc, uint, call, int, first, unsigned long, second, |
68 | unsigned long, third, void __user *, ptr) | 66 | unsigned long, third, void __user *, ptr) |
69 | { | 67 | { |
70 | struct ipc_kludge tmp; | 68 | if (call >> 16) |
71 | int ret; | 69 | return -EINVAL; |
72 | 70 | /* The s390 sys_ipc variant has only five parameters instead of six | |
73 | switch (call) { | 71 | * like the generic variant. The only difference is the handling of |
74 | case SEMOP: | 72 | * the SEMTIMEDOP subcall where on s390 the third parameter is used |
75 | return sys_semtimedop(first, (struct sembuf __user *)ptr, | 73 | * as a pointer to a struct timespec where the generic variant uses |
76 | (unsigned)second, NULL); | 74 | * the fifth parameter. |
77 | case SEMTIMEDOP: | 75 | * Therefore we can call the generic variant by simply passing the |
78 | return sys_semtimedop(first, (struct sembuf __user *)ptr, | 76 | * third parameter also as fifth parameter. |
79 | (unsigned)second, | 77 | */ |
80 | (const struct timespec __user *) third); | 78 | return sys_ipc(call, first, second, third, ptr, third); |
81 | case SEMGET: | ||
82 | return sys_semget(first, (int)second, third); | ||
83 | case SEMCTL: { | ||
84 | union semun fourth; | ||
85 | if (!ptr) | ||
86 | return -EINVAL; | ||
87 | if (get_user(fourth.__pad, (void __user * __user *) ptr)) | ||
88 | return -EFAULT; | ||
89 | return sys_semctl(first, (int)second, third, fourth); | ||
90 | } | ||
91 | case MSGSND: | ||
92 | return sys_msgsnd (first, (struct msgbuf __user *) ptr, | ||
93 | (size_t)second, third); | ||
94 | break; | ||
95 | case MSGRCV: | ||
96 | if (!ptr) | ||
97 | return -EINVAL; | ||
98 | if (copy_from_user (&tmp, (struct ipc_kludge __user *) ptr, | ||
99 | sizeof (struct ipc_kludge))) | ||
100 | return -EFAULT; | ||
101 | return sys_msgrcv (first, tmp.msgp, | ||
102 | (size_t)second, tmp.msgtyp, third); | ||
103 | case MSGGET: | ||
104 | return sys_msgget((key_t)first, (int)second); | ||
105 | case MSGCTL: | ||
106 | return sys_msgctl(first, (int)second, | ||
107 | (struct msqid_ds __user *)ptr); | ||
108 | |||
109 | case SHMAT: { | ||
110 | ulong raddr; | ||
111 | ret = do_shmat(first, (char __user *)ptr, | ||
112 | (int)second, &raddr); | ||
113 | if (ret) | ||
114 | return ret; | ||
115 | return put_user (raddr, (ulong __user *) third); | ||
116 | break; | ||
117 | } | ||
118 | case SHMDT: | ||
119 | return sys_shmdt ((char __user *)ptr); | ||
120 | case SHMGET: | ||
121 | return sys_shmget(first, (size_t)second, third); | ||
122 | case SHMCTL: | ||
123 | return sys_shmctl(first, (int)second, | ||
124 | (struct shmid_ds __user *) ptr); | ||
125 | default: | ||
126 | return -ENOSYS; | ||
127 | |||
128 | } | ||
129 | |||
130 | return -EINVAL; | ||
131 | } | 79 | } |
132 | 80 | ||
133 | #ifdef CONFIG_64BIT | 81 | #ifdef CONFIG_64BIT |