]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Clean up support for sync_file_range system call and add second version used
authorTom Hughes <tom@compton.nu>
Wed, 25 Nov 2009 11:29:14 +0000 (11:29 +0000)
committerTom Hughes <tom@compton.nu>
Wed, 25 Nov 2009 11:29:14 +0000 (11:29 +0000)
by ppc platforms based on patch from Dodji Seketeli. Part fix for #215973.

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

coregrind/m_syswrap/priv_syswrap-linux.h
coregrind/m_syswrap/syswrap-linux.c
coregrind/m_syswrap/syswrap-ppc32-linux.c
coregrind/m_syswrap/syswrap-ppc64-linux.c

index 6e914527ae1b3001295969aa1e0d9d21aa79a933..dcd39b79965e14418752647f2ffbac05edcc4ac0 100644 (file)
@@ -247,6 +247,7 @@ DECL_TEMPLATE(linux, sys_rt_sigsuspend);
 
 // Linux-specific?
 DECL_TEMPLATE(linux, sys_sync_file_range);
+DECL_TEMPLATE(linux, sys_sync_file_range2);
 DECL_TEMPLATE(linux, sys_stime);  /* maybe generic?  I'm not sure */
 
 // Linux specific (kernel modules)
index 29c11f59481374cddaf4810693147d4aa33a0601..6416701610c63b3650d99c869a43d0ab7f59db4f 100644 (file)
@@ -2481,15 +2481,50 @@ POST(sys_waitid)
 PRE(sys_sync_file_range)
 {
    *flags |= SfMayBlock;
-   PRINT("sys_sync_file_range ( %ld, %ld, %ld, %ld )",
-         ARG1,ARG2,ARG3,ARG4);
+#if VG_WORDSIZE == 4
+   PRINT("sys_sync_file_range ( %ld, %lld, %lld, %ld )",
+         ARG1,MERGE64(ARG2,ARG3),MERGE64(ARG4,ARG5),ARG6);
+   PRE_REG_READ6(long, "sync_file_range",
+                 int, fd,
+                 unsigned, MERGE64_FIRST(offset), unsigned, MERGE64_SECOND(offset),
+                 unsigned, MERGE64_FIRST(nbytes), unsigned, MERGE64_SECOND(nbytes),
+                 unsigned int, flags);
+#elif VG_WORDSIZE == 8
+   PRINT("sys_sync_file_range ( %ld, %lld, %lld, %ld )",
+         ARG1,(Long)ARG2,(Long)ARG3,ARG4);
    PRE_REG_READ4(long, "sync_file_range",
                  int, fd, vki_loff_t, offset, vki_loff_t, nbytes,
                  unsigned int, flags);
+#else
+#  error Unexpected word size
+#endif
    if (!ML_(fd_allowed)(ARG1, "sync_file_range", tid, False))
       SET_STATUS_Failure( VKI_EBADF );
 }
 
+PRE(sys_sync_file_range2)
+{
+   *flags |= SfMayBlock;
+#if VG_WORDSIZE == 4
+   PRINT("sys_sync_file_range2 ( %ld, %ld, %lld, %lld )",
+         ARG1,ARG2,MERGE64(ARG3,ARG4),MERGE64(ARG5,ARG6));
+   PRE_REG_READ6(long, "sync_file_range2",
+                 int, fd, unsigned int, flags,
+                 unsigned, MERGE64_FIRST(offset), unsigned, MERGE64_SECOND(offset),
+                 unsigned, MERGE64_FIRST(nbytes), unsigned, MERGE64_SECOND(nbytes));
+#elif VG_WORDSIZE == 8
+   PRINT("sys_sync_file_range2 ( %ld, %ld, %lld, %lld )",
+         ARG1,ARG2,(Long)ARG3,(Long)ARG4);
+   PRE_REG_READ4(long, "sync_file_range2",
+                 int, fd, unsigned int, flags,
+                 vki_loff_t, offset, vki_loff_t, nbytes);
+#else
+#  error Unexpected word size
+#endif
+   if (!ML_(fd_allowed)(ARG1, "sync_file_range2", tid, False))
+      SET_STATUS_Failure( VKI_EBADF );
+}
+
 PRE(sys_stime)
 {
    PRINT("sys_stime ( %#lx )", ARG1);
index 3d15f04cb915858cacefca8c62fd1fdf2f7b9540..3e67540d7d7f787e62cf04c74372f18c8e3b314c 100644 (file)
@@ -1857,7 +1857,7 @@ const SyscallTableEntry ML_(syscall_table)[] = {
    LINXY(__NR_signalfd,          sys_signalfd),          // 305
    LINXY(__NR_timerfd_create,    sys_timerfd_create),    // 306
    LINX_(__NR_eventfd,           sys_eventfd),           // 307
-//   LINX_(__NR_sync_file_range2,   sys_ni_syscall),       // 308
+   LINX_(__NR_sync_file_range2,  sys_sync_file_range2),  // 308
 //   LINX_(__NR_fallocate,         sys_fallocate),         // 309
 //   LINXY(__NR_subpage_prot,       sys_ni_syscall),       // 310
    LINXY(__NR_timerfd_settime,   sys_timerfd_settime),  // 311
index 12892a9da105e590dbcce45e5e6b077209278f10..0ce1d823ee441fcd4815d274abefc6bebe55d3d7 100644 (file)
@@ -1497,7 +1497,7 @@ const SyscallTableEntry ML_(syscall_table)[] = {
    LINXY(__NR_signalfd,          sys_signalfd),          // 305
    LINXY(__NR_timerfd_create,    sys_timerfd_create),    // 306
    LINX_(__NR_eventfd,           sys_eventfd),           // 307
-//   LINX_(__NR_sync_file_range2,   sys_ni_syscall),       // 308
+   LINX_(__NR_sync_file_range2,  sys_sync_file_range2),  // 308
    LINX_(__NR_fallocate,         sys_fallocate),         // 309
 //   LINXY(__NR_subpage_prot,       sys_ni_syscall),       // 310
    LINXY(__NR_timerfd_settime,   sys_timerfd_settime),  // 311