|
From: <sv...@va...> - 2009-11-25 11:29:28
|
Author: tom
Date: 2009-11-25 11:29:14 +0000 (Wed, 25 Nov 2009)
New Revision: 10952
Log:
Clean up support for sync_file_range system call and add second version used
by ppc platforms based on patch from Dodji Seketeli. Part fix for #215973.
Modified:
trunk/coregrind/m_syswrap/priv_syswrap-linux.h
trunk/coregrind/m_syswrap/syswrap-linux.c
trunk/coregrind/m_syswrap/syswrap-ppc32-linux.c
trunk/coregrind/m_syswrap/syswrap-ppc64-linux.c
Modified: trunk/coregrind/m_syswrap/priv_syswrap-linux.h
===================================================================
--- trunk/coregrind/m_syswrap/priv_syswrap-linux.h 2009-11-25 11:24:00 UTC (rev 10951)
+++ trunk/coregrind/m_syswrap/priv_syswrap-linux.h 2009-11-25 11:29:14 UTC (rev 10952)
@@ -247,6 +247,7 @@
// 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)
Modified: trunk/coregrind/m_syswrap/syswrap-linux.c
===================================================================
--- trunk/coregrind/m_syswrap/syswrap-linux.c 2009-11-25 11:24:00 UTC (rev 10951)
+++ trunk/coregrind/m_syswrap/syswrap-linux.c 2009-11-25 11:29:14 UTC (rev 10952)
@@ -2481,15 +2481,50 @@
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);
Modified: trunk/coregrind/m_syswrap/syswrap-ppc32-linux.c
===================================================================
--- trunk/coregrind/m_syswrap/syswrap-ppc32-linux.c 2009-11-25 11:24:00 UTC (rev 10951)
+++ trunk/coregrind/m_syswrap/syswrap-ppc32-linux.c 2009-11-25 11:29:14 UTC (rev 10952)
@@ -1857,7 +1857,7 @@
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
Modified: trunk/coregrind/m_syswrap/syswrap-ppc64-linux.c
===================================================================
--- trunk/coregrind/m_syswrap/syswrap-ppc64-linux.c 2009-11-25 11:24:00 UTC (rev 10951)
+++ trunk/coregrind/m_syswrap/syswrap-ppc64-linux.c 2009-11-25 11:29:14 UTC (rev 10952)
@@ -1497,7 +1497,7 @@
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
|