Skip to content

Commit

Permalink
signal/timer/event: signalfd compat code
Browse files Browse the repository at this point in the history
This patch implements the necessary compat code for the signalfd system call.

Signed-off-by: Davide Libenzi <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
davidel authored and Linus Torvalds committed May 11, 2007
1 parent 2121e24 commit 6d18c92
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions fs/compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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 */

0 comments on commit 6d18c92

Please sign in to comment.