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/kernel/sys_s390.c | |
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/kernel/sys_s390.c')
-rw-r--r-- | arch/s390/kernel/sys_s390.c | 76 |
1 files changed, 12 insertions, 64 deletions
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 |