]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Add support for the inotify system calls based on a patch
authorTom Hughes <tom@compton.nu>
Mon, 25 Jul 2005 15:21:41 +0000 (15:21 +0000)
committerTom Hughes <tom@compton.nu>
Mon, 25 Jul 2005 15:21:41 +0000 (15:21 +0000)
from John McCutchan <ttb@tentacle.dhs.org>.

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

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

index 99c3d5048e379125bd2f855318107e904f7844d5..522dfe9363ca52df04d8d0fddcb2ae92345023d2 100644 (file)
@@ -92,6 +92,10 @@ DECL_TEMPLATE(linux, sys_io_cancel);
 DECL_TEMPLATE(linux, sys_set_mempolicy);
 DECL_TEMPLATE(linux, sys_get_mempolicy);
 
+DECL_TEMPLATE(linux, sys_inotify_init);
+DECL_TEMPLATE(linux, sys_inotify_add_watch);
+DECL_TEMPLATE(linux, sys_inotify_rm_watch);
+
 #endif   // __PRIV_SYSWRAP_LINUX_H
 
 /*--------------------------------------------------------------------*/
index 965470d35dcd5d387b3f8fcbf2a6c2480f52bcdd..a882604852ada77c34a78eb62255c11fb92bb90e 100644 (file)
@@ -860,6 +860,36 @@ POST(sys_get_mempolicy)
       POST_MEM_WRITE( ARG2, VG_ROUNDUP( ARG3, sizeof(UWord) * 8 ) / sizeof(UWord) );
 }
 
+PRE(sys_inotify_init)
+{
+   PRINT("sys_inotify_init ( )");
+   PRE_REG_READ0(long, "inotify_init");
+}
+POST(sys_inotify_init)
+{
+   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( %d, %p, %x )", ARG1,ARG2,ARG3);
+   PRE_REG_READ3(long, "inotify_add_watch", int, fd, char *, path, int, mask);
+   PRE_MEM_RASCIIZ( "inotify_add_watch(path)", ARG2 );
+}
+
+PRE(sys_inotify_rm_watch)
+{
+   PRINT( "sys_inotify_rm_watch( %d, %x )", ARG1,ARG2);
+   PRE_REG_READ2(long, "inotify_rm_watch", int, fd, int, wd);
+}
+
 #undef PRE
 #undef POST
 
index d83d2c6e2b168ee4c5855c5a3cbf23b08b5ba4e0..f455e7becd5a279f1af009e64f3faa1cee562c9e 100644 (file)
@@ -2277,6 +2277,18 @@ const SyscallTableEntry ML_(syscall_table)[] = {
    GENX_(__NR_mq_notify,         sys_mq_notify),      // (mq_open+4)
    GENXY(__NR_mq_getsetattr,     sys_mq_getsetattr),  // (mq_open+5)
    GENX_(__NR_sys_kexec_load,    sys_ni_syscall),     // 283
+//   GENXY(__NR_waitid,            sys_waitid),         // 284
+
+   GENX_(285,                    sys_ni_syscall),     // 285
+//   LINX_(__NR_add_key,           sys_add_key),        // 286
+//   LINX_(__NR_request_key,       sys_request_key),    // 287
+//   LINXY(__NR_keyctl,            sys_keyctl),         // 288
+//   LINX_(__NR_ioprio_set,        sys_ioprio_set),     // 289
+
+//   LINX_(__NR_ioprio_get,        sys_ioprio_get),     // 290
+   LINX_(__NR_inotify_init,     sys_inotify_init),   // 291
+   LINX_(__NR_inotify_add_watch, sys_inotify_add_watch), // 292
+   LINX_(__NR_inotify_rm_watch,         sys_inotify_rm_watch), // 293
 };
 
 const UInt ML_(syscall_table_size) =