aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/ia32/ia32entry.S1
-rw-r--r--arch/x86/kernel/syscall_table_32.S1
-rw-r--r--fs/inotify_user.c12
-rw-r--r--include/asm-x86/unistd_32.h1
-rw-r--r--include/asm-x86/unistd_64.h2
-rw-r--r--include/linux/inotify.h5
-rw-r--r--include/linux/syscalls.h1
-rw-r--r--kernel/sys_ni.c1
8 files changed, 22 insertions, 2 deletions
diff --git a/arch/x86/ia32/ia32entry.S b/arch/x86/ia32/ia32entry.S
index 18808b164570..4541073dd837 100644
--- a/arch/x86/ia32/ia32entry.S
+++ b/arch/x86/ia32/ia32entry.S
@@ -831,4 +831,5 @@ ia32_sys_call_table:
831 .quad sys_epoll_create2 831 .quad sys_epoll_create2
832 .quad sys_dup3 /* 330 */ 832 .quad sys_dup3 /* 330 */
833 .quad sys_pipe2 833 .quad sys_pipe2
834 .quad sys_inotify_init1
834ia32_syscall_end: 835ia32_syscall_end:
diff --git a/arch/x86/kernel/syscall_table_32.S b/arch/x86/kernel/syscall_table_32.S
index 66154769d52f..f59aba5ff0f0 100644
--- a/arch/x86/kernel/syscall_table_32.S
+++ b/arch/x86/kernel/syscall_table_32.S
@@ -331,3 +331,4 @@ ENTRY(sys_call_table)
331 .long sys_epoll_create2 331 .long sys_epoll_create2
332 .long sys_dup3 /* 330 */ 332 .long sys_dup3 /* 330 */
333 .long sys_pipe2 333 .long sys_pipe2
334 .long sys_inotify_init1
diff --git a/fs/inotify_user.c b/fs/inotify_user.c
index 6676c06bb7c1..851005998cd4 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
569asmlinkage long sys_inotify_init(void) 569asmlinkage 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,10 @@ 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 if (flags & ~IN_CLOEXEC)
578 return -EINVAL;
579
580 fd = get_unused_fd_flags(flags & O_CLOEXEC);
578 if (fd < 0) 581 if (fd < 0)
579 return fd; 582 return fd;
580 583
@@ -638,6 +641,11 @@ out_put_fd:
638 return ret; 641 return ret;
639} 642}
640 643
644asmlinkage long sys_inotify_init(void)
645{
646 return sys_inotify_init1(0);
647}
648
641asmlinkage long sys_inotify_add_watch(int fd, const char __user *path, u32 mask) 649asmlinkage long sys_inotify_add_watch(int fd, const char __user *path, u32 mask)
642{ 650{
643 struct inode *inode; 651 struct inode *inode;
diff --git a/include/asm-x86/unistd_32.h b/include/asm-x86/unistd_32.h
index 748a05c77da4..b3daf503ab93 100644
--- a/include/asm-x86/unistd_32.h
+++ b/include/asm-x86/unistd_32.h
@@ -337,6 +337,7 @@
337#define __NR_epoll_create2 329 337#define __NR_epoll_create2 329
338#define __NR_dup3 330 338#define __NR_dup3 330
339#define __NR_pipe2 331 339#define __NR_pipe2 331
340#define __NR_inotify_init1 332
340 341
341#ifdef __KERNEL__ 342#ifdef __KERNEL__
342 343
diff --git a/include/asm-x86/unistd_64.h b/include/asm-x86/unistd_64.h
index d2284b43ad58..c8cb88d70c6b 100644
--- a/include/asm-x86/unistd_64.h
+++ b/include/asm-x86/unistd_64.h
@@ -651,6 +651,8 @@ __SYSCALL(__NR_epoll_create2, sys_epoll_create2)
651__SYSCALL(__NR_dup3, sys_dup3) 651__SYSCALL(__NR_dup3, sys_dup3)
652#define __NR_pipe2 293 652#define __NR_pipe2 293
653__SYSCALL(__NR_pipe2, sys_pipe2) 653__SYSCALL(__NR_pipe2, sys_pipe2)
654#define __NR_inotify_init1 294
655__SYSCALL(__NR_inotify_init1, sys_inotify_init1)
654 656
655 657
656#ifndef __NO_STUBS 658#ifndef __NO_STUBS
diff --git a/include/linux/inotify.h b/include/linux/inotify.h
index 742b917e7d1b..72ef82120512 100644
--- a/include/linux/inotify.h
+++ b/include/linux/inotify.h
@@ -7,6 +7,8 @@
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 */
11#include <linux/fcntl.h>
10#include <linux/types.h> 12#include <linux/types.h>
11 13
12/* 14/*
@@ -63,6 +65,9 @@ struct inotify_event {
63 IN_MOVED_TO | IN_DELETE | IN_CREATE | IN_DELETE_SELF | \ 65 IN_MOVED_TO | IN_DELETE | IN_CREATE | IN_DELETE_SELF | \
64 IN_MOVE_SELF) 66 IN_MOVE_SELF)
65 67
68/* Flags for sys_inotify_init1. */
69#define IN_CLOEXEC O_CLOEXEC
70
66#ifdef __KERNEL__ 71#ifdef __KERNEL__
67 72
68#include <linux/dcache.h> 73#include <linux/dcache.h>
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 034d3358549e..93a7e7f017a6 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -547,6 +547,7 @@ asmlinkage long sys_get_mempolicy(int __user *policy,
547 unsigned long addr, unsigned long flags); 547 unsigned long addr, unsigned long flags);
548 548
549asmlinkage long sys_inotify_init(void); 549asmlinkage long sys_inotify_init(void);
550asmlinkage long sys_inotify_init1(int flags);
550asmlinkage long sys_inotify_add_watch(int fd, const char __user *path, 551asmlinkage long sys_inotify_add_watch(int fd, const char __user *path,
551 u32 mask); 552 u32 mask);
552asmlinkage long sys_inotify_rm_watch(int fd, u32 wd); 553asmlinkage long sys_inotify_rm_watch(int fd, u32 wd);
diff --git a/kernel/sys_ni.c b/kernel/sys_ni.c
index 2a361ccdc7ca..bd66ac5406f3 100644
--- a/kernel/sys_ni.c
+++ b/kernel/sys_ni.c
@@ -96,6 +96,7 @@ cond_syscall(sys_keyctl);
96cond_syscall(compat_sys_keyctl); 96cond_syscall(compat_sys_keyctl);
97cond_syscall(compat_sys_socketcall); 97cond_syscall(compat_sys_socketcall);
98cond_syscall(sys_inotify_init); 98cond_syscall(sys_inotify_init);
99cond_syscall(sys_inotify_init1);
99cond_syscall(sys_inotify_add_watch); 100cond_syscall(sys_inotify_add_watch);
100cond_syscall(sys_inotify_rm_watch); 101cond_syscall(sys_inotify_rm_watch);
101cond_syscall(sys_migrate_pages); 102cond_syscall(sys_migrate_pages);