.quad sys_epoll_create2
        .quad sys_dup3                  /* 330 */
        .quad sys_pipe2
+       .quad sys_inotify_init1
 ia32_syscall_end:
 
        .long sys_epoll_create2
        .long sys_dup3                  /* 330 */
        .long sys_pipe2
+       .long sys_inotify_init1
 
        .destroy_watch  = free_inotify_user_watch,
 };
 
-asmlinkage long sys_inotify_init(void)
+asmlinkage long sys_inotify_init1(int flags)
 {
        struct inotify_device *dev;
        struct inotify_handle *ih;
        struct file *filp;
        int fd, ret;
 
-       fd = get_unused_fd();
+       if (flags & ~IN_CLOEXEC)
+               return -EINVAL;
+
+       fd = get_unused_fd_flags(flags & O_CLOEXEC);
        if (fd < 0)
                return fd;
 
        return ret;
 }
 
+asmlinkage long sys_inotify_init(void)
+{
+       return sys_inotify_init1(0);
+}
+
 asmlinkage long sys_inotify_add_watch(int fd, const char __user *path, u32 mask)
 {
        struct inode *inode;
 
 #define __NR_epoll_create2     329
 #define __NR_dup3              330
 #define __NR_pipe2             331
+#define __NR_inotify_init1     332
 
 #ifdef __KERNEL__
 
 
 __SYSCALL(__NR_dup3, sys_dup3)
 #define __NR_pipe2                             293
 __SYSCALL(__NR_pipe2, sys_pipe2)
+#define __NR_inotify_init1                     294
+__SYSCALL(__NR_inotify_init1, sys_inotify_init1)
 
 
 #ifndef __NO_STUBS
 
 #ifndef _LINUX_INOTIFY_H
 #define _LINUX_INOTIFY_H
 
+/* For O_CLOEXEC */
+#include <linux/fcntl.h>
 #include <linux/types.h>
 
 /*
                         IN_MOVED_TO | IN_DELETE | IN_CREATE | IN_DELETE_SELF | \
                         IN_MOVE_SELF)
 
+/* Flags for sys_inotify_init1.  */
+#define IN_CLOEXEC O_CLOEXEC
+
 #ifdef __KERNEL__
 
 #include <linux/dcache.h>
 
                                unsigned long addr, unsigned long flags);
 
 asmlinkage long sys_inotify_init(void);
+asmlinkage long sys_inotify_init1(int flags);
 asmlinkage long sys_inotify_add_watch(int fd, const char __user *path,
                                        u32 mask);
 asmlinkage long sys_inotify_rm_watch(int fd, u32 wd);
 
 cond_syscall(compat_sys_keyctl);
 cond_syscall(compat_sys_socketcall);
 cond_syscall(sys_inotify_init);
+cond_syscall(sys_inotify_init1);
 cond_syscall(sys_inotify_add_watch);
 cond_syscall(sys_inotify_rm_watch);
 cond_syscall(sys_migrate_pages);