[CIFS] CIFS should honour umask
[linux-drm-fsl-dcu.git] / fs / compat.c
index 9cf75df9b2bb4753356ca9e3e5ae527b49329268..1de2331db8445d0923dfd17e6608d1357f466b3c 100644 (file)
@@ -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,46 @@ 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 */
+
+#ifdef CONFIG_TIMERFD
+
+asmlinkage long compat_sys_timerfd(int ufd, int clockid, int flags,
+                                  const struct compat_itimerspec __user *utmr)
+{
+       struct itimerspec t;
+       struct itimerspec __user *ut;
+
+       if (get_compat_itimerspec(&t, utmr))
+               return -EFAULT;
+       ut = compat_alloc_user_space(sizeof(*ut));
+       if (copy_to_user(ut, &t, sizeof(t)))
+               return -EFAULT;
+
+       return sys_timerfd(ufd, clockid, flags, ut);
+}
+
+#endif /* CONFIG_TIMERFD */