summaryrefslogtreecommitdiffstats
path: root/fs/compat.c
diff options
context:
space:
mode:
authorDavide Libenzi <davidel@xmailserver.org>2007-05-11 07:23:15 +0200
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-11 17:29:36 +0200
commit6d18c9220965b437287c3a7e803725c24992ceac (patch)
tree95b87523f134f10a25487b6fdc702a338fb0e911 /fs/compat.c
parentsignal/timer/event: signalfd wire up x86 arches (diff)
downloadlinux-6d18c9220965b437287c3a7e803725c24992ceac.tar.xz
linux-6d18c9220965b437287c3a7e803725c24992ceac.zip
signal/timer/event: signalfd compat code
This patch implements the necessary compat code for the signalfd system call. Signed-off-by: Davide Libenzi <davidel@xmailserver.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to '')
-rw-r--r--fs/compat.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/fs/compat.c b/fs/compat.c
index 9cf75df9b2bb..2487b83b18df 100644
--- a/fs/compat.c
+++ b/fs/compat.c
@@ -46,6 +46,7 @@
#include <linux/tsacct_kern.h>
#include <linux/security.h>
#include <linux/highmem.h>
+#include <linux/signal.h>
#include <linux/poll.h>
#include <linux/mm.h>
#include <linux/eventpoll.h>
@@ -2199,3 +2200,28 @@ asmlinkage long compat_sys_epoll_pwait(int epfd,
#endif /* TIF_RESTORE_SIGMASK */
#endif /* CONFIG_EPOLL */
+
+#ifdef CONFIG_SIGNALFD
+
+asmlinkage long compat_sys_signalfd(int ufd,
+ const compat_sigset_t __user *sigmask,
+ compat_size_t sigsetsize)
+{
+ 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_signalfd(ufd, ksigmask, sizeof(sigset_t));
+}
+
+#endif /* CONFIG_SIGNALFD */
+