NFS: Fix misparsing of nfsv4 fs_locations attribute (take 2)
[safe/jmp/linux-2.6] / fs / signalfd.c
index c8609fa..b07565c 100644 (file)
@@ -205,13 +205,17 @@ static const struct file_operations signalfd_fops = {
        .read           = signalfd_read,
 };
 
-asmlinkage long sys_signalfd4(int ufd, sigset_t __user *user_mask,
-                             size_t sizemask, int flags)
+SYSCALL_DEFINE4(signalfd4, int, ufd, sigset_t __user *, user_mask,
+               size_t, sizemask, int, flags)
 {
        sigset_t sigmask;
        struct signalfd_ctx *ctx;
 
-       if (flags & ~SFD_CLOEXEC)
+       /* Check the SFD_* constants for consistency.  */
+       BUILD_BUG_ON(SFD_CLOEXEC != O_CLOEXEC);
+       BUILD_BUG_ON(SFD_NONBLOCK != O_NONBLOCK);
+
+       if (flags & ~(SFD_CLOEXEC | SFD_NONBLOCK))
                return -EINVAL;
 
        if (sizemask != sizeof(sigset_t) ||
@@ -232,7 +236,7 @@ asmlinkage long sys_signalfd4(int ufd, sigset_t __user *user_mask,
                 * anon_inode_getfd() will install the fd.
                 */
                ufd = anon_inode_getfd("[signalfd]", &signalfd_fops, ctx,
-                                      flags & O_CLOEXEC);
+                                      flags & (O_CLOEXEC | O_NONBLOCK));
                if (ufd < 0)
                        kfree(ctx);
        } else {
@@ -255,8 +259,8 @@ asmlinkage long sys_signalfd4(int ufd, sigset_t __user *user_mask,
        return ufd;
 }
 
-asmlinkage long sys_signalfd(int ufd, sigset_t __user *user_mask,
-                            size_t sizemask)
+SYSCALL_DEFINE3(signalfd, int, ufd, sigset_t __user *, user_mask,
+               size_t, sizemask)
 {
        return sys_signalfd4(ufd, user_mask, sizemask, 0);
 }