]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Support sys_pipe2 on {amd64,x86}-linux. Also, update syscall numbers
authorJulian Seward <jseward@acm.org>
Wed, 5 Nov 2008 11:20:59 +0000 (11:20 +0000)
committerJulian Seward <jseward@acm.org>
Wed, 5 Nov 2008 11:20:59 +0000 (11:20 +0000)
for all supported Linuxes to those in linux-2.6.28-rc3.

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

coregrind/m_syswrap/priv_syswrap-linux.h
coregrind/m_syswrap/syswrap-amd64-linux.c
coregrind/m_syswrap/syswrap-linux.c
coregrind/m_syswrap/syswrap-x86-linux.c
include/vki/vki-scnums-amd64-linux.h
include/vki/vki-scnums-ppc32-linux.h
include/vki/vki-scnums-ppc64-linux.h
include/vki/vki-scnums-x86-linux.h

index 85f2c38d7269b56b9bc9809770b734d981d658c8..32cd61f9f10c08a39ddd686f268728d3e02376a2 100644 (file)
@@ -206,6 +206,7 @@ DECL_TEMPLATE(linux, sys_sched_getaffinity);
 // Also, some archs on Linux do not match the generic wrapper for sys_pipe.
 DECL_TEMPLATE(linux, sys_munlockall);
 DECL_TEMPLATE(linux, sys_pipe);
+DECL_TEMPLATE(linux, sys_pipe2);
 DECL_TEMPLATE(linux, sys_quotactl);
 DECL_TEMPLATE(linux, sys_waitid);
 
index 243415a7d8c6c14cc32cac3cd45d0de4c04962ab..b5cc76b5b16d71108c7838a9efa590a5ec7409d0 100644 (file)
@@ -1350,14 +1350,24 @@ const SyscallTableEntry ML_(syscall_table)[] = {
    LINX_(__NR_sync_file_range,   sys_sync_file_range),  // 277
 //   LINX_(__NR_vmsplice,          sys_ni_syscall),       // 278
 //   LINX_(__NR_move_pages,        sys_ni_syscall),       // 279
+
    LINX_(__NR_utimensat,         sys_utimensat),        // 280
    LINXY(__NR_epoll_pwait,       sys_epoll_pwait),      // 281
    LINXY(__NR_signalfd,          sys_signalfd),         // 282
    LINXY(__NR_timerfd_create,    sys_timerfd_create),   // 283
    LINX_(__NR_eventfd,           sys_eventfd),          // 284
+
 //   LINX_(__NR_fallocate,        sys_ni_syscall),        // 285
    LINXY(__NR_timerfd_settime,   sys_timerfd_settime),  // 286
    LINXY(__NR_timerfd_gettime,   sys_timerfd_gettime),  // 287
+   //   (__NR_paccept,           sys_ni_syscall)        // 288
+   //   (__NR_signalfd4,         sys_ni_syscall)        // 289
+
+   //   (__NR_eventfd2,          sys_ni_syscall)        // 290
+   //   (__NR_epoll_create1,     sys_ni_syscall)        // 291
+   //   (__NR_dup3,              sys_ni_syscall)        // 292
+   LINXY(__NR_pipe2,             sys_pipe2)             // 293
+   //   (__NR_inotify_init1,     sys_ni_syscall)        // 294
 };
 
 const UInt ML_(syscall_table_size) = 
index dc54ca10de29da7e06f6fdb09a6ba53eed20396c..6be9124ee171c73d23987ef9d5548de5b442db96 100644 (file)
@@ -2235,7 +2235,6 @@ PRE(sys_pipe)
 POST(sys_pipe)
 {
    Int *p = (Int *)ARG1;
-
    if (!ML_(fd_allowed)(p[0], "pipe", tid, True) ||
        !ML_(fd_allowed)(p[1], "pipe", tid, True)) {
       VG_(close)(p[0]);
@@ -2250,6 +2249,33 @@ POST(sys_pipe)
    }
 }
 
+/* pipe2 (a kernel 2.6.twentysomething invention) is like pipe, except
+   there's a second arg containing flags to be applied to the new file
+   descriptors.  It hardly seems worth the effort to factor out the
+   duplicated code, hence: */
+PRE(sys_pipe2)
+{
+   PRINT("sys_pipe2 ( %#lx, %#lx )", ARG1, ARG2);
+   PRE_REG_READ2(int, "pipe", int *, filedes, long, flags);
+   PRE_MEM_WRITE( "pipe2(filedes)", ARG1, 2*sizeof(int) );
+}
+POST(sys_pipe2)
+{
+   Int *p = (Int *)ARG1;
+   if (!ML_(fd_allowed)(p[0], "pipe2", tid, True) ||
+       !ML_(fd_allowed)(p[1], "pipe2", tid, True)) {
+      VG_(close)(p[0]);
+      VG_(close)(p[1]);
+      SET_STATUS_Failure( VKI_EMFILE );
+   } else {
+      POST_MEM_WRITE( ARG1, 2*sizeof(int) );
+      if (VG_(clo_track_fds)) {
+         ML_(record_fd_open_nameless)(tid, p[0]);
+         ML_(record_fd_open_nameless)(tid, p[1]);
+      }
+   }
+}
+
 PRE(sys_quotactl)
 {
    PRINT("sys_quotactl (0x%lx, %#lx, 0x%lx, 0x%lx )", ARG1,ARG2,ARG3, ARG4);
index 8c5351ac1c98ce74ab1149531fde4a635beb126c..33ced73c36f0105a0b9f012c2c7d3925fb402c4c 100644 (file)
@@ -2231,8 +2231,16 @@ const SyscallTableEntry ML_(syscall_table)[] = {
    LINXY(__NR_timerfd_create,    sys_timerfd_create),   // 322
    LINX_(__NR_eventfd,           sys_eventfd),          // 323
 //   LINX_(__NR_fallocate,        sys_ni_syscall),        // 324
+
    LINXY(__NR_timerfd_settime,   sys_timerfd_settime),  // 325
    LINXY(__NR_timerfd_gettime,   sys_timerfd_gettime),  // 326
+   //   (__NR_signalfd4,         sys_ni_syscall)        // 327
+   //   (__NR_eventfd2,          sys_ni_syscall)        // 328
+   //   (__NR_epoll_create1,     sys_ni_syscall)        // 329
+
+   //   (__NR_dup3,              sys_ni_syscall)        // 330
+   LINXY(__NR_pipe2,             sys_pipe2)             // 331
+   //   (__NR_inotify_init1,     sys_ni_syscall)        // 332
 };
 
 const UInt ML_(syscall_table_size) = 
index 0f1ae01f79de1f8347ec2b1751d4ae8b94d04390..ed3d3e8510b0b42e29ec6e5de03ed52aba024e85 100644 (file)
 #define __NR_fallocate         285
 #define __NR_timerfd_settime   286
 #define __NR_timerfd_gettime   287
+#define __NR_paccept            288
+#define __NR_signalfd4          289
+#define __NR_eventfd2           290
+#define __NR_epoll_create1      291
+#define __NR_dup3               292
+#define __NR_pipe2              293
+#define __NR_inotify_init1      294
 
 #endif /* __VKI_SCNUMS_AMD64_LINUX_H */
 
index 8441d820ba47a7844a600dc15f76937d24f26cd3..7259261adda70222ce9c30b91ccf5d9b61e867b2 100644 (file)
 #define __NR_subpage_prot      310
 #define __NR_timerfd_settime   311
 #define __NR_timerfd_gettime   312
+#define __NR_signalfd4          313
+#define __NR_eventfd2           314
+#define __NR_epoll_create1      315
+#define __NR_dup3               316
+#define __NR_pipe2              317
+#define __NR_inotify_init1      318
 
 #endif /* __VKI_SCNUMS_PPC32_LINUX_H */
 
index dba2012afa63c5981bed90d8cd4ec36622e1bd7b..3520c2cf61eb653ff069f85f7513d75e62d1a93a 100644 (file)
 #define __NR_subpage_prot      310
 #define __NR_timerfd_settime   311
 #define __NR_timerfd_gettime   312
+#define __NR_signalfd4          313
+#define __NR_eventfd2           314
+#define __NR_epoll_create1      315
+#define __NR_dup3               316
+#define __NR_pipe2              317
+#define __NR_inotify_init1      318
 
 #endif /* __VKI_SCNUMS_PPC64_LINUX_H */
 
index 95fee1008e6ceea90f68376ecc0b0f392de15426..e564cf5546f59f01f7914a9c255cd690482cdccc 100644 (file)
 #define __NR_fallocate         324
 #define __NR_timerfd_settime   325
 #define __NR_timerfd_gettime   326
+#define __NR_signalfd4          327
+#define __NR_eventfd2           328
+#define __NR_epoll_create1      329
+#define __NR_dup3               330
+#define __NR_pipe2              331
+#define __NR_inotify_init1      332
 
 #endif /* __VKI_SCNUMS_X86_LINUX_H */