diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2005-02-16 16:18:52 -0500 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2005-10-29 14:30:34 -0400 |
commit | b6e203d84da8298b903a0ebcad1a8170f3959b4f (patch) | |
tree | d8972816c700aff00ea3fcacf64e188705c63ddb /arch/mips | |
parent | a4f23e3dfc0931b988f70e38a876bc760400af7b (diff) |
Use generic compat_sys_wait4 to implement 32-bit wait4(2).
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips')
-rw-r--r-- | arch/mips/kernel/linux32.c | 73 | ||||
-rw-r--r-- | arch/mips/kernel/scall64-n32.S | 2 | ||||
-rw-r--r-- | arch/mips/kernel/scall64-o32.S | 2 |
3 files changed, 3 insertions, 74 deletions
diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c index ece4564919d8..dfb448c015e1 100644 --- a/arch/mips/kernel/linux32.c +++ b/arch/mips/kernel/linux32.c | |||
@@ -215,81 +215,10 @@ sys32_readdir(unsigned int fd, void * dirent32, unsigned int count) | |||
215 | return(n); | 215 | return(n); |
216 | } | 216 | } |
217 | 217 | ||
218 | struct rusage32 { | ||
219 | struct compat_timeval ru_utime; | ||
220 | struct compat_timeval ru_stime; | ||
221 | int ru_maxrss; | ||
222 | int ru_ixrss; | ||
223 | int ru_idrss; | ||
224 | int ru_isrss; | ||
225 | int ru_minflt; | ||
226 | int ru_majflt; | ||
227 | int ru_nswap; | ||
228 | int ru_inblock; | ||
229 | int ru_oublock; | ||
230 | int ru_msgsnd; | ||
231 | int ru_msgrcv; | ||
232 | int ru_nsignals; | ||
233 | int ru_nvcsw; | ||
234 | int ru_nivcsw; | ||
235 | }; | ||
236 | |||
237 | static int | ||
238 | put_rusage (struct rusage32 *ru, struct rusage *r) | ||
239 | { | ||
240 | int err; | ||
241 | |||
242 | if (!access_ok(VERIFY_WRITE, ru, sizeof *ru)) | ||
243 | return -EFAULT; | ||
244 | |||
245 | err = __put_user (r->ru_utime.tv_sec, &ru->ru_utime.tv_sec); | ||
246 | err |= __put_user (r->ru_utime.tv_usec, &ru->ru_utime.tv_usec); | ||
247 | err |= __put_user (r->ru_stime.tv_sec, &ru->ru_stime.tv_sec); | ||
248 | err |= __put_user (r->ru_stime.tv_usec, &ru->ru_stime.tv_usec); | ||
249 | err |= __put_user (r->ru_maxrss, &ru->ru_maxrss); | ||
250 | err |= __put_user (r->ru_ixrss, &ru->ru_ixrss); | ||
251 | err |= __put_user (r->ru_idrss, &ru->ru_idrss); | ||
252 | err |= __put_user (r->ru_isrss, &ru->ru_isrss); | ||
253 | err |= __put_user (r->ru_minflt, &ru->ru_minflt); | ||
254 | err |= __put_user (r->ru_majflt, &ru->ru_majflt); | ||
255 | err |= __put_user (r->ru_nswap, &ru->ru_nswap); | ||
256 | err |= __put_user (r->ru_inblock, &ru->ru_inblock); | ||
257 | err |= __put_user (r->ru_oublock, &ru->ru_oublock); | ||
258 | err |= __put_user (r->ru_msgsnd, &ru->ru_msgsnd); | ||
259 | err |= __put_user (r->ru_msgrcv, &ru->ru_msgrcv); | ||
260 | err |= __put_user (r->ru_nsignals, &ru->ru_nsignals); | ||
261 | err |= __put_user (r->ru_nvcsw, &ru->ru_nvcsw); | ||
262 | err |= __put_user (r->ru_nivcsw, &ru->ru_nivcsw); | ||
263 | |||
264 | return err; | ||
265 | } | ||
266 | |||
267 | asmlinkage int | ||
268 | sys32_wait4(compat_pid_t pid, unsigned int * stat_addr, int options, | ||
269 | struct rusage32 * ru) | ||
270 | { | ||
271 | if (!ru) | ||
272 | return sys_wait4(pid, stat_addr, options, NULL); | ||
273 | else { | ||
274 | struct rusage r; | ||
275 | int ret; | ||
276 | unsigned int status; | ||
277 | mm_segment_t old_fs = get_fs(); | ||
278 | |||
279 | set_fs(KERNEL_DS); | ||
280 | ret = sys_wait4(pid, stat_addr ? &status : NULL, options, &r); | ||
281 | set_fs(old_fs); | ||
282 | if (put_rusage (ru, &r)) return -EFAULT; | ||
283 | if (stat_addr && put_user (status, stat_addr)) | ||
284 | return -EFAULT; | ||
285 | return ret; | ||
286 | } | ||
287 | } | ||
288 | |||
289 | asmlinkage int | 218 | asmlinkage int |
290 | sys32_waitpid(compat_pid_t pid, unsigned int *stat_addr, int options) | 219 | sys32_waitpid(compat_pid_t pid, unsigned int *stat_addr, int options) |
291 | { | 220 | { |
292 | return sys32_wait4(pid, stat_addr, options, NULL); | 221 | return compat_sys_wait4(pid, stat_addr, options, NULL); |
293 | } | 222 | } |
294 | 223 | ||
295 | struct sysinfo32 { | 224 | struct sysinfo32 { |
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S index e52049c87bc3..3a56056d8125 100644 --- a/arch/mips/kernel/scall64-n32.S +++ b/arch/mips/kernel/scall64-n32.S | |||
@@ -176,7 +176,7 @@ EXPORT(sysn32_call_table) | |||
176 | PTR sys_fork | 176 | PTR sys_fork |
177 | PTR sys32_execve | 177 | PTR sys32_execve |
178 | PTR sys_exit | 178 | PTR sys_exit |
179 | PTR sys32_wait4 | 179 | PTR compat_sys_wait4 |
180 | PTR sys_kill /* 6060 */ | 180 | PTR sys_kill /* 6060 */ |
181 | PTR sys32_newuname | 181 | PTR sys32_newuname |
182 | PTR sys_semget | 182 | PTR sys_semget |
diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S index 739f3998d76b..271b2cb14da0 100644 --- a/arch/mips/kernel/scall64-o32.S +++ b/arch/mips/kernel/scall64-o32.S | |||
@@ -316,7 +316,7 @@ sys_call_table: | |||
316 | PTR sys_vhangup | 316 | PTR sys_vhangup |
317 | PTR sys_ni_syscall /* was sys_idle */ | 317 | PTR sys_ni_syscall /* was sys_idle */ |
318 | PTR sys_ni_syscall /* sys_vm86 */ | 318 | PTR sys_ni_syscall /* sys_vm86 */ |
319 | PTR sys32_wait4 | 319 | PTR compat_sys_wait4 |
320 | PTR sys_swapoff /* 4115 */ | 320 | PTR sys_swapoff /* 4115 */ |
321 | PTR sys32_sysinfo | 321 | PTR sys32_sysinfo |
322 | PTR sys32_ipc | 322 | PTR sys32_ipc |