diff options
-rw-r--r-- | fs/inotify_user.c | 4 | ||||
-rw-r--r-- | include/linux/inotify.h | 3 |
2 files changed, 4 insertions, 3 deletions
diff --git a/fs/inotify_user.c b/fs/inotify_user.c index 851005998cd4..dc7e1f619748 100644 --- a/fs/inotify_user.c +++ b/fs/inotify_user.c | |||
@@ -574,7 +574,7 @@ asmlinkage long sys_inotify_init1(int flags) | |||
574 | struct file *filp; | 574 | struct file *filp; |
575 | int fd, ret; | 575 | int fd, ret; |
576 | 576 | ||
577 | if (flags & ~IN_CLOEXEC) | 577 | if (flags & ~(IN_CLOEXEC | IN_NONBLOCK)) |
578 | return -EINVAL; | 578 | return -EINVAL; |
579 | 579 | ||
580 | fd = get_unused_fd_flags(flags & O_CLOEXEC); | 580 | fd = get_unused_fd_flags(flags & O_CLOEXEC); |
@@ -613,7 +613,7 @@ asmlinkage long sys_inotify_init1(int flags) | |||
613 | filp->f_path.dentry = dget(inotify_mnt->mnt_root); | 613 | filp->f_path.dentry = dget(inotify_mnt->mnt_root); |
614 | filp->f_mapping = filp->f_path.dentry->d_inode->i_mapping; | 614 | filp->f_mapping = filp->f_path.dentry->d_inode->i_mapping; |
615 | filp->f_mode = FMODE_READ; | 615 | filp->f_mode = FMODE_READ; |
616 | filp->f_flags = O_RDONLY; | 616 | filp->f_flags = O_RDONLY | (flags & O_NONBLOCK); |
617 | filp->private_data = dev; | 617 | filp->private_data = dev; |
618 | 618 | ||
619 | INIT_LIST_HEAD(&dev->events); | 619 | INIT_LIST_HEAD(&dev->events); |
diff --git a/include/linux/inotify.h b/include/linux/inotify.h index 72ef82120512..bd578578a8b9 100644 --- a/include/linux/inotify.h +++ b/include/linux/inotify.h | |||
@@ -7,7 +7,7 @@ | |||
7 | #ifndef _LINUX_INOTIFY_H | 7 | #ifndef _LINUX_INOTIFY_H |
8 | #define _LINUX_INOTIFY_H | 8 | #define _LINUX_INOTIFY_H |
9 | 9 | ||
10 | /* For O_CLOEXEC */ | 10 | /* For O_CLOEXEC and O_NONBLOCK */ |
11 | #include <linux/fcntl.h> | 11 | #include <linux/fcntl.h> |
12 | #include <linux/types.h> | 12 | #include <linux/types.h> |
13 | 13 | ||
@@ -67,6 +67,7 @@ struct inotify_event { | |||
67 | 67 | ||
68 | /* Flags for sys_inotify_init1. */ | 68 | /* Flags for sys_inotify_init1. */ |
69 | #define IN_CLOEXEC O_CLOEXEC | 69 | #define IN_CLOEXEC O_CLOEXEC |
70 | #define IN_NONBLOCK O_NONBLOCK | ||
70 | 71 | ||
71 | #ifdef __KERNEL__ | 72 | #ifdef __KERNEL__ |
72 | 73 | ||