]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Add support for the inotify_init1 system call, based on patches
authorTom Hughes <tom@compton.nu>
Tue, 27 Oct 2009 14:17:27 +0000 (14:17 +0000)
committerTom Hughes <tom@compton.nu>
Tue, 27 Oct 2009 14:17:27 +0000 (14:17 +0000)
from Dodji Seketeli and Jakub Jelinek. Fixes #202315.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10909

coregrind/m_syswrap/priv_syswrap-linux.h
coregrind/m_syswrap/syswrap-amd64-linux.c
coregrind/m_syswrap/syswrap-linux.c
coregrind/m_syswrap/syswrap-ppc64-linux.c
coregrind/m_syswrap/syswrap-x86-linux.c

index ce48a929a0366f87b87afc314e7effb1df72b597..a0e4ab04c388e38d3c9b618fc0f2609b6ad8e6ee 100644 (file)
@@ -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);
 
index 39188901211adc18dbde9656ecc443072a2cac7b..5675570d9f3ccadcdbc02a40e89fdfb85fb8147e 100644 (file)
@@ -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
index 7a2e70862a5533a0c7e00ac120ddd8017e8a824b..6eb8a27cd14e64026fed161394c64d55ca8de602 100644 (file)
@@ -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);
index 2f93880982fe811a0869fae94eef9ba226e0aac0..ff540ebb4a8719985f1c7fb92b49be1b4bfe69f2 100644 (file)
@@ -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
index ea9edc2c13144bd9cc87098940c0443d8d9694b6..2264fd0abdaecb72c3e139c7eb2f1155739f3541 100644 (file)
@@ -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