aboutsummaryrefslogtreecommitdiffstats
path: root/fs/signalfd.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2013-02-24 01:41:39 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2013-03-03 22:58:46 -0500
commit7d197ed4a68e76000070979563051e08bf6fc0aa (patch)
treead74a62a2808db635a954c571d8b9a59bb4cf43c /fs/signalfd.c
parent2cf0966683430b6468f36ca20515a33ca7f2403c (diff)
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.c31
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 @@
30#include <linux/signalfd.h> 30#include <linux/signalfd.h>
31#include <linux/syscalls.h> 31#include <linux/syscalls.h>
32#include <linux/proc_fs.h> 32#include <linux/proc_fs.h>
33#include <linux/compat.h>
33 34
34void signalfd_cleanup(struct sighand_struct *sighand) 35void signalfd_cleanup(struct sighand_struct *sighand)
35{ 36{
@@ -311,3 +312,33 @@ SYSCALL_DEFINE3(signalfd, int, ufd, sigset_t __user *, user_mask,
311{ 312{
312 return sys_signalfd4(ufd, user_mask, sizemask, 0); 313 return sys_signalfd4(ufd, user_mask, sizemask, 0);
313} 314}
315
316#ifdef CONFIG_COMPAT
317COMPAT_SYSCALL_DEFINE4(signalfd4, int, ufd,
318 const compat_sigset_t __user *,sigmask,
319 compat_size_t, sigsetsize,
320 int, flags)
321{
322 compat_sigset_t ss32;
323 sigset_t tmp;
324 sigset_t __user *ksigmask;
325
326 if (sigsetsize != sizeof(compat_sigset_t))
327 return -EINVAL;
328 if (copy_from_user(&ss32, sigmask, sizeof(ss32)))
329 return -EFAULT;
330 sigset_from_compat(&tmp, &ss32);
331 ksigmask = compat_alloc_user_space(sizeof(sigset_t));
332 if (copy_to_user(ksigmask, &tmp, sizeof(sigset_t)))
333 return -EFAULT;
334
335 return sys_signalfd4(ufd, ksigmask, sizeof(sigset_t), flags);
336}
337
338COMPAT_SYSCALL_DEFINE3(signalfd, int, ufd,
339 const compat_sigset_t __user *,sigmask,
340 compat_size_t, sigsetsize)
341{
342 return compat_sys_signalfd4(ufd, sigmask, sigsetsize, 0);
343}
344#endif