summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/inotify_user.c4
-rw-r--r--include/linux/inotify.h3
2 files changed, 4 insertions, 3 deletions
diff --git a/fs/inotify_user.c b/fs/inotify_user.c
index 851005998cd..dc7e1f61974 100644
--- a/fs/inotify_user.c
+++ b/fs/inotify_user.c
@@ -574,7 +574,7 @@ asmlinkage long sys_inotify_init1(int flags)
struct file *filp;
int fd, ret;
- if (flags & ~IN_CLOEXEC)
+ if (flags & ~(IN_CLOEXEC | IN_NONBLOCK))
return -EINVAL;
fd = get_unused_fd_flags(flags & O_CLOEXEC);
@@ -613,7 +613,7 @@ asmlinkage long sys_inotify_init1(int flags)
filp->f_path.dentry = dget(inotify_mnt->mnt_root);
filp->f_mapping = filp->f_path.dentry->d_inode->i_mapping;
filp->f_mode = FMODE_READ;
- filp->f_flags = O_RDONLY;
+ filp->f_flags = O_RDONLY | (flags & O_NONBLOCK);
filp->private_data = dev;
INIT_LIST_HEAD(&dev->events);
diff --git a/include/linux/inotify.h b/include/linux/inotify.h
index 72ef8212051..bd578578a8b 100644
--- a/include/linux/inotify.h
+++ b/include/linux/inotify.h
@@ -7,7 +7,7 @@
#ifndef _LINUX_INOTIFY_H
#define _LINUX_INOTIFY_H
-/* For O_CLOEXEC */
+/* For O_CLOEXEC and O_NONBLOCK */
#include <linux/fcntl.h>
#include <linux/types.h>
@@ -67,6 +67,7 @@ struct inotify_event {
/* Flags for sys_inotify_init1. */
#define IN_CLOEXEC O_CLOEXEC
+#define IN_NONBLOCK O_NONBLOCK
#ifdef __KERNEL__