diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2013-02-24 01:41:39 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2013-03-03 22:58:46 -0500 |
commit | 7d197ed4a68e76000070979563051e08bf6fc0aa (patch) | |
tree | ad74a62a2808db635a954c571d8b9a59bb4cf43c /fs/signalfd.c | |
parent | 2cf0966683430b6468f36ca20515a33ca7f2403c (diff) | |
download | linux-7d197ed4a68e76000070979563051e08bf6fc0aa.tar.gz linux-7d197ed4a68e76000070979563051e08bf6fc0aa.tar.bz2 linux-7d197ed4a68e76000070979563051e08bf6fc0aa.zip |
switch signalfd{,4}() to COMPAT_SYSCALL_DEFINE
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/signalfd.c')
-rw-r--r-- | fs/signalfd.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/fs/signalfd.c b/fs/signalfd.c index b53486961735..424b7b65321f 100644 --- a/fs/signalfd.c +++ b/fs/signalfd.c @@ -30,6 +30,7 @@ #include <linux/signalfd.h> #include <linux/syscalls.h> #include <linux/proc_fs.h> +#include <linux/compat.h> void signalfd_cleanup(struct sighand_struct *sighand) { @@ -311,3 +312,33 @@ SYSCALL_DEFINE3(signalfd, int, ufd, sigset_t __user *, user_mask, { return sys_signalfd4(ufd, user_mask, sizemask, 0); } + +#ifdef CONFIG_COMPAT +COMPAT_SYSCALL_DEFINE4(signalfd4, int, ufd, + const compat_sigset_t __user *,sigmask, + compat_size_t, sigsetsize, + int, flags) +{ + compat_sigset_t ss32; + sigset_t tmp; + sigset_t __user *ksigmask; + + if (sigsetsize != sizeof(compat_sigset_t)) + return -EINVAL; + if (copy_from_user(&ss32, sigmask, sizeof(ss32))) + return -EFAULT; + sigset_from_compat(&tmp, &ss32); + ksigmask = compat_alloc_user_space(sizeof(sigset_t)); + if (copy_to_user(ksigmask, &tmp, sizeof(sigset_t))) + return -EFAULT; + + return sys_signalfd4(ufd, ksigmask, sizeof(sigset_t), flags); +} + +COMPAT_SYSCALL_DEFINE3(signalfd, int, ufd, + const compat_sigset_t __user *,sigmask, + compat_size_t, sigsetsize) +{ + return compat_sys_signalfd4(ufd, sigmask, sigsetsize, 0); +} +#endif |