aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/kernel/linux32.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2005-02-16 16:18:52 -0500
committerRalf Baechle <ralf@linux-mips.org>2005-10-29 14:30:34 -0400
commitb6e203d84da8298b903a0ebcad1a8170f3959b4f (patch)
treed8972816c700aff00ea3fcacf64e188705c63ddb /arch/mips/kernel/linux32.c
parenta4f23e3dfc0931b988f70e38a876bc760400af7b (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/kernel/linux32.c')
-rw-r--r--arch/mips/kernel/linux32.c73
1 files changed, 1 insertions, 72 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
218struct 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
237static int
238put_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
267asmlinkage int
268sys32_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
289asmlinkage int 218asmlinkage int
290sys32_waitpid(compat_pid_t pid, unsigned int *stat_addr, int options) 219sys32_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
295struct sysinfo32 { 224struct sysinfo32 {