From: Tom Hughes Date: Tue, 27 Oct 2009 14:17:27 +0000 (+0000) Subject: Add support for the inotify_init1 system call, based on patches X-Git-Tag: svn/VALGRIND_3_6_0~500 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=387cb44cc1ad64e0167ebb2b7d9dff4b65cf947b;p=thirdparty%2Fvalgrind.git Add support for the inotify_init1 system call, based on patches from Dodji Seketeli and Jakub Jelinek. Fixes #202315. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10909 --- diff --git a/coregrind/m_syswrap/priv_syswrap-linux.h b/coregrind/m_syswrap/priv_syswrap-linux.h index ce48a929a0..a0e4ab04c3 100644 --- a/coregrind/m_syswrap/priv_syswrap-linux.h +++ b/coregrind/m_syswrap/priv_syswrap-linux.h @@ -117,6 +117,7 @@ DECL_TEMPLATE(linux, sys_set_mempolicy); DECL_TEMPLATE(linux, sys_get_mempolicy); DECL_TEMPLATE(linux, sys_inotify_init); +DECL_TEMPLATE(linux, sys_inotify_init1); DECL_TEMPLATE(linux, sys_inotify_add_watch); DECL_TEMPLATE(linux, sys_inotify_rm_watch); diff --git a/coregrind/m_syswrap/syswrap-amd64-linux.c b/coregrind/m_syswrap/syswrap-amd64-linux.c index 3918890121..5675570d9f 100644 --- a/coregrind/m_syswrap/syswrap-amd64-linux.c +++ b/coregrind/m_syswrap/syswrap-amd64-linux.c @@ -1375,7 +1375,7 @@ const SyscallTableEntry ML_(syscall_table)[] = { LINXY(__NR_epoll_create1, sys_epoll_create1), // 291 // (__NR_dup3, sys_ni_syscall) // 292 LINXY(__NR_pipe2, sys_pipe2), // 293 - // (__NR_inotify_init1, sys_ni_syscall) // 294 + LINXY(__NR_inotify_init1, sys_inotify_init1), // 294 // (__NR_preadv, sys_ni_syscall) // 295 // (__NR_pwritev, sys_ni_syscall) // 296 diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c index 7a2e70862a..6eb8a27cd1 100644 --- a/coregrind/m_syswrap/syswrap-linux.c +++ b/coregrind/m_syswrap/syswrap-linux.c @@ -1526,6 +1526,24 @@ POST(sys_inotify_init) } } +PRE(sys_inotify_init1) +{ + PRINT("sys_inotify_init ( %ld )", ARG1); + PRE_REG_READ1(long, "inotify_init", int, flag); +} + +POST(sys_inotify_init1) +{ + vg_assert(SUCCESS); + if (!ML_(fd_allowed)(RES, "inotify_init", tid, True)) { + VG_(close)(RES); + SET_STATUS_Failure( VKI_EMFILE ); + } else { + if (VG_(clo_track_fds)) + ML_(record_fd_open_nameless) (tid, RES); + } +} + PRE(sys_inotify_add_watch) { PRINT( "sys_inotify_add_watch ( %ld, %#lx, %lx )", ARG1,ARG2,ARG3); diff --git a/coregrind/m_syswrap/syswrap-ppc64-linux.c b/coregrind/m_syswrap/syswrap-ppc64-linux.c index 2f93880982..ff540ebb4a 100644 --- a/coregrind/m_syswrap/syswrap-ppc64-linux.c +++ b/coregrind/m_syswrap/syswrap-ppc64-linux.c @@ -1507,7 +1507,7 @@ const SyscallTableEntry ML_(syscall_table)[] = { LINXY(__NR_epoll_create1, sys_epoll_create1), // 315 // (__NR_dup3, sys_ni_syscall) // 316 LINXY(__NR_pipe2, sys_pipe2), // 317 - // (__NR_inotify_init1, sys_ni_syscall) // 318 + LINXY(__NR_inotify_init1, sys_inotify_init1), // 318 LINXY(__NR_perf_counter_open, sys_perf_counter_open) // 319 // (__NR_preadv, sys_ni_syscall) // 320 // (__NR_pwritev, sys_ni_syscall) // 321 diff --git a/coregrind/m_syswrap/syswrap-x86-linux.c b/coregrind/m_syswrap/syswrap-x86-linux.c index ea9edc2c13..2264fd0abd 100644 --- a/coregrind/m_syswrap/syswrap-x86-linux.c +++ b/coregrind/m_syswrap/syswrap-x86-linux.c @@ -2254,7 +2254,7 @@ const SyscallTableEntry ML_(syscall_table)[] = { // (__NR_dup3, sys_ni_syscall) // 330 LINXY(__NR_pipe2, sys_pipe2), // 331 - // (__NR_inotify_init1, sys_ni_syscall) // 332 + LINXY(__NR_inotify_init1, sys_inotify_init1), // 332 // (__NR_preadv, sys_ni_syscall) // 333 // (__NR_pwritev, sys_ni_syscall) // 334