diff options
Diffstat (limited to 'fs/inotify_user.c')
-rw-r--r-- | fs/inotify_user.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/fs/inotify_user.c b/fs/inotify_user.c index 6676c06bb7c1..fe79c25d95dc 100644 --- a/fs/inotify_user.c +++ b/fs/inotify_user.c | |||
@@ -566,7 +566,7 @@ static const struct inotify_operations inotify_user_ops = { | |||
566 | .destroy_watch = free_inotify_user_watch, | 566 | .destroy_watch = free_inotify_user_watch, |
567 | }; | 567 | }; |
568 | 568 | ||
569 | asmlinkage long sys_inotify_init(void) | 569 | asmlinkage long sys_inotify_init1(int flags) |
570 | { | 570 | { |
571 | struct inotify_device *dev; | 571 | struct inotify_device *dev; |
572 | struct inotify_handle *ih; | 572 | struct inotify_handle *ih; |
@@ -574,7 +574,14 @@ asmlinkage long sys_inotify_init(void) | |||
574 | struct file *filp; | 574 | struct file *filp; |
575 | int fd, ret; | 575 | int fd, ret; |
576 | 576 | ||
577 | fd = get_unused_fd(); | 577 | /* Check the IN_* constants for consistency. */ |
578 | BUILD_BUG_ON(IN_CLOEXEC != O_CLOEXEC); | ||
579 | BUILD_BUG_ON(IN_NONBLOCK != O_NONBLOCK); | ||
580 | |||
581 | if (flags & ~(IN_CLOEXEC | IN_NONBLOCK)) | ||
582 | return -EINVAL; | ||
583 | |||
584 | fd = get_unused_fd_flags(flags & O_CLOEXEC); | ||
578 | if (fd < 0) | 585 | if (fd < 0) |
579 | return fd; | 586 | return fd; |
580 | 587 | ||
@@ -610,7 +617,7 @@ asmlinkage long sys_inotify_init(void) | |||
610 | filp->f_path.dentry = dget(inotify_mnt->mnt_root); | 617 | filp->f_path.dentry = dget(inotify_mnt->mnt_root); |
611 | filp->f_mapping = filp->f_path.dentry->d_inode->i_mapping; | 618 | filp->f_mapping = filp->f_path.dentry->d_inode->i_mapping; |
612 | filp->f_mode = FMODE_READ; | 619 | filp->f_mode = FMODE_READ; |
613 | filp->f_flags = O_RDONLY; | 620 | filp->f_flags = O_RDONLY | (flags & O_NONBLOCK); |
614 | filp->private_data = dev; | 621 | filp->private_data = dev; |
615 | 622 | ||
616 | INIT_LIST_HEAD(&dev->events); | 623 | INIT_LIST_HEAD(&dev->events); |
@@ -638,6 +645,11 @@ out_put_fd: | |||
638 | return ret; | 645 | return ret; |
639 | } | 646 | } |
640 | 647 | ||
648 | asmlinkage long sys_inotify_init(void) | ||
649 | { | ||
650 | return sys_inotify_init1(0); | ||
651 | } | ||
652 | |||
641 | asmlinkage long sys_inotify_add_watch(int fd, const char __user *path, u32 mask) | 653 | asmlinkage long sys_inotify_add_watch(int fd, const char __user *path, u32 mask) |
642 | { | 654 | { |
643 | struct inode *inode; | 655 | struct inode *inode; |