diff options
| author | Stephen Rothwell <sfr@canb.auug.org.au> | 2005-03-06 01:25:39 -0800 |
|---|---|---|
| committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-03-06 01:25:39 -0800 |
| commit | d121ff248f21667b96d927936c28843b8a451f8e (patch) | |
| tree | 70130ccd779696467f96cb25f6f2183fe32f253e /kernel | |
| parent | 5487472e4487e8650b72a41138eb3ce937f79e73 (diff) | |
[PATCH] Consolidate compat_sys_waitid
This patch does:
- consolidate the three implementations of compat_sys_waitid
(some were called sys32_waitid).
- adds sys_waitid syscall to ppc
- adds sys_waitid and compat_sys_waitid syscalls to ppc64
I have left PARISC and MIPS to their own devices (by request).
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/compat.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/kernel/compat.c b/kernel/compat.c index f14fbde52bb3..56ec374b660b 100644 --- a/kernel/compat.c +++ b/kernel/compat.c @@ -23,6 +23,7 @@ #include <linux/security.h> #include <asm/uaccess.h> +#include <asm/bug.h> int get_compat_timespec(struct timespec *ts, const struct compat_timespec __user *cts) { @@ -413,6 +414,36 @@ compat_sys_wait4(compat_pid_t pid, compat_uint_t __user *stat_addr, int options, } } +asmlinkage long compat_sys_waitid(int which, compat_pid_t pid, + struct compat_siginfo __user *uinfo, int options, + struct compat_rusage __user *uru) +{ + siginfo_t info; + struct rusage ru; + long ret; + mm_segment_t old_fs = get_fs(); + + memset(&info, 0, sizeof(info)); + + set_fs(KERNEL_DS); + ret = sys_waitid(which, pid, (siginfo_t __user *)&info, options, + uru ? (struct rusage __user *)&ru : NULL); + set_fs(old_fs); + + if ((ret < 0) || (info.si_signo == 0)) + return ret; + + if (uru) { + ret = put_compat_rusage(&ru, uru); + if (ret) + return ret; + } + + BUG_ON(info.si_code & __SI_MASK); + info.si_code |= __SI_CHLD; + return copy_siginfo_to_user32(uinfo, &info); +} + static int compat_get_user_cpu_mask(compat_ulong_t __user *user_mask_ptr, unsigned len, cpumask_t *new_mask) { |
