I've attached a patch that adds support for Linux's sync_file_range. I tested it under x86_64, and added an entry for x86 since I happened to find the syscall number in my /usr/include directory. Presumably, it's supported on other architectures too...

The manpage lists "off64_t" as the type for some of the parameters, but there is no vki_off64_t type, so I used vki_off_t. Should I use vki_loff_t instead?

Thanks,
Rusty
diff -x 'config*' -x Makefile -x '*.Po' -x debian -r -u valgrind-3.3.0-original/coregrind/m_syswrap/priv_syswrap-linux.h valgrind-3.3.0/coregrind/m_syswrap/priv_syswrap-linux.h
--- valgrind-3.3.0-original/coregrind/m_syswrap/priv_syswrap-linux.h	2007-12-10 15:18:43.000000000 -0800
+++ valgrind-3.3.0/coregrind/m_syswrap/priv_syswrap-linux.h	2007-12-21 11:50:33.000000000 -0800
@@ -220,6 +220,9 @@
 DECL_TEMPLATE(linux, sys_rt_sigqueueinfo);
 DECL_TEMPLATE(linux, sys_rt_sigsuspend);
 
+// Linux-specific?
+DECL_TEMPLATE(linux, sys_sync_file_range);
+
 /* ---------------------------------------------------------------------
    Wrappers for sockets and ipc-ery.  These are split into standalone
    procedures because x86-linux hides them inside multiplexors
diff -x 'config*' -x Makefile -x '*.Po' -x debian -r -u valgrind-3.3.0-original/coregrind/m_syswrap/syswrap-amd64-linux.c valgrind-3.3.0/coregrind/m_syswrap/syswrap-amd64-linux.c
--- valgrind-3.3.0-original/coregrind/m_syswrap/syswrap-amd64-linux.c	2007-12-10 15:18:43.000000000 -0800
+++ valgrind-3.3.0/coregrind/m_syswrap/syswrap-amd64-linux.c	2007-12-21 11:45:57.000000000 -0800
@@ -1371,6 +1371,8 @@
 //   LINX_(__NR_unshare,		 sys_unshare),          // 272
    LINX_(__NR_set_robust_list,	 sys_set_robust_list),  // 273
    LINXY(__NR_get_robust_list,	 sys_get_robust_list),  // 274
+
+   LINX_(__NR_sync_file_range,   sys_sync_file_range),  // 277
 };
 
 const UInt ML_(syscall_table_size) = 
diff -x 'config*' -x Makefile -x '*.Po' -x debian -r -u valgrind-3.3.0-original/coregrind/m_syswrap/syswrap-linux.c valgrind-3.3.0/coregrind/m_syswrap/syswrap-linux.c
--- valgrind-3.3.0-original/coregrind/m_syswrap/syswrap-linux.c	2007-12-10 15:18:43.000000000 -0800
+++ valgrind-3.3.0/coregrind/m_syswrap/syswrap-linux.c	2007-12-21 11:55:49.000000000 -0800
@@ -1625,6 +1625,15 @@
    POST_MEM_WRITE( ARG3, sizeof(vki_timer_t) );
 }
 
+PRE(sys_sync_file_range)
+{
+  // PRINT("sys_sync_file_range ( %d, %lld, %lld, %d )"
+  //	 ARG1, ARG2,ARG3,ARG4);
+   PRE_REG_READ4(int, "sync_file_range",
+		 int, fd, vki_off_t, offset, vki_off_t, nbytes,
+		 unsigned int, flags);
+}
+
 PRE(sys_timer_settime)
 {
    PRINT("sys_timer_settime( %lld, %d, %p, %p )", (ULong)ARG1,ARG2,ARG3,ARG4);
diff -x 'config*' -x Makefile -x '*.Po' -x debian -r -u valgrind-3.3.0-original/coregrind/m_syswrap/syswrap-x86-linux.c valgrind-3.3.0/coregrind/m_syswrap/syswrap-x86-linux.c
--- valgrind-3.3.0-original/coregrind/m_syswrap/syswrap-x86-linux.c	2007-12-10 15:18:43.000000000 -0800
+++ valgrind-3.3.0/coregrind/m_syswrap/syswrap-x86-linux.c	2008-01-03 14:24:01.000000000 -0800
@@ -2217,6 +2217,9 @@
    LINX_(__NR_set_robust_list,	 sys_set_robust_list),  // 311
    LINXY(__NR_get_robust_list,	 sys_get_robust_list),  // 312
 
+   LINX_(__NR_sync_file_range,   sys_sync_file_range),  // 314
+
+
    LINX_(__NR_utimensat,         sys_utimensat),        // 320
 };
 
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Valgrind-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/valgrind-developers

Reply via email to