Mark Wielaard 8ebb5c
commit 7c91105917f41c11a0b377b2393725da380cd490
Mark Wielaard 8ebb5c
Author: tom <tom@a5019735-40e9-0310-863c-91ae7b9d1cf9>
Mark Wielaard 8ebb5c
Date:   Thu May 7 18:54:31 2015 +0000
Mark Wielaard 8ebb5c
Mark Wielaard 8ebb5c
    Add support for the syncfs system call.
Mark Wielaard 8ebb5c
    
Mark Wielaard 8ebb5c
    Based on patch from j@eckel.me on BZ#347389.
Mark Wielaard 8ebb5c
    
Mark Wielaard 8ebb5c
    
Mark Wielaard 8ebb5c
    git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15191 a5019735-40e9-0310-863c-91ae7b9d1cf9
Mark Wielaard 8ebb5c
Mark Wielaard 8ebb5c
diff --git a/coregrind/m_syswrap/priv_syswrap-linux.h b/coregrind/m_syswrap/priv_syswrap-linux.h
Mark Wielaard 8ebb5c
index d093974..6552dca 100644
Mark Wielaard 8ebb5c
--- a/coregrind/m_syswrap/priv_syswrap-linux.h
Mark Wielaard 8ebb5c
+++ b/coregrind/m_syswrap/priv_syswrap-linux.h
Mark Wielaard 8ebb5c
@@ -287,6 +287,8 @@ DECL_TEMPLATE(linux, sys_fanotify_mark);
Mark Wielaard 8ebb5c
 DECL_TEMPLATE(linux, sys_getrandom);
Mark Wielaard 8ebb5c
 DECL_TEMPLATE(linux, sys_memfd_create);
Mark Wielaard 8ebb5c
 
Mark Wielaard 8ebb5c
+DECL_TEMPLATE(linux, sys_syncfs);
Mark Wielaard 8ebb5c
+
Mark Wielaard 8ebb5c
 /* ---------------------------------------------------------------------
Mark Wielaard 8ebb5c
    Wrappers for sockets and ipc-ery.  These are split into standalone
Mark Wielaard 8ebb5c
    procedures because x86-linux hides them inside multiplexors
Mark Wielaard 8ebb5c
diff --git a/coregrind/m_syswrap/syswrap-amd64-linux.c b/coregrind/m_syswrap/syswrap-amd64-linux.c
Mark Wielaard 8ebb5c
index 62f7ee6..de3288e 100644
Mark Wielaard 8ebb5c
--- a/coregrind/m_syswrap/syswrap-amd64-linux.c
Mark Wielaard 8ebb5c
+++ b/coregrind/m_syswrap/syswrap-amd64-linux.c
Mark Wielaard 8ebb5c
@@ -1062,7 +1062,7 @@ static SyscallTableEntry syscall_table[] = {
Mark Wielaard 8ebb5c
    LINXY(__NR_open_by_handle_at, sys_open_by_handle_at),// 304
Mark Wielaard 8ebb5c
 
Mark Wielaard 8ebb5c
    LINXY(__NR_clock_adjtime,     sys_clock_adjtime),    // 305
Mark Wielaard 8ebb5c
-//   LINX_(__NR_syncfs,            sys_ni_syscall),       // 306
Mark Wielaard 8ebb5c
+   LINX_(__NR_syncfs,            sys_syncfs),           // 306
Mark Wielaard 8ebb5c
    LINXY(__NR_sendmmsg,          sys_sendmmsg),         // 307
Mark Wielaard 8ebb5c
 //   LINX_(__NR_setns,             sys_ni_syscall),       // 308
Mark Wielaard 8ebb5c
    LINXY(__NR_getcpu,            sys_getcpu),           // 309
Mark Wielaard 8ebb5c
diff --git a/coregrind/m_syswrap/syswrap-arm-linux.c b/coregrind/m_syswrap/syswrap-arm-linux.c
Mark Wielaard 8ebb5c
index dc8714c..f8f56f5 100644
Mark Wielaard 8ebb5c
--- a/coregrind/m_syswrap/syswrap-arm-linux.c
Mark Wielaard 8ebb5c
+++ b/coregrind/m_syswrap/syswrap-arm-linux.c
Mark Wielaard 8ebb5c
@@ -1212,6 +1212,7 @@ static SyscallTableEntry syscall_main_table[] = {
Mark Wielaard 8ebb5c
    LINXY(__NR_name_to_handle_at, sys_name_to_handle_at),// 370
Mark Wielaard 8ebb5c
    LINXY(__NR_open_by_handle_at, sys_open_by_handle_at),// 371
Mark Wielaard 8ebb5c
    LINXY(__NR_clock_adjtime,     sys_clock_adjtime),    // 372
Mark Wielaard 8ebb5c
+   LINX_(__NR_syncfs,            sys_syncfs),           // 373
Mark Wielaard 8ebb5c
    LINXY(__NR_sendmmsg,          sys_sendmmsg),         // 374
Mark Wielaard 8ebb5c
    LINXY(__NR_getrandom,         sys_getrandom),        // 384
Mark Wielaard 8ebb5c
    LINXY(__NR_memfd_create,      sys_memfd_create)      // 385
Mark Wielaard 8ebb5c
diff --git a/coregrind/m_syswrap/syswrap-arm64-linux.c b/coregrind/m_syswrap/syswrap-arm64-linux.c
Mark Wielaard 8ebb5c
index 2f35e51..7551e8a 100644
Mark Wielaard 8ebb5c
--- a/coregrind/m_syswrap/syswrap-arm64-linux.c
Mark Wielaard 8ebb5c
+++ b/coregrind/m_syswrap/syswrap-arm64-linux.c
Mark Wielaard 8ebb5c
@@ -1042,6 +1042,8 @@ static SyscallTableEntry syscall_main_table[] = {
Mark Wielaard 8ebb5c
 
Mark Wielaard 8ebb5c
    GENXY(__NR_wait4,             sys_wait4),             // 260
Mark Wielaard 8ebb5c
 
Mark Wielaard 8ebb5c
+   LINX_(__NR_syncfs,            sys_syncfs),            // 267
Mark Wielaard 8ebb5c
+
Mark Wielaard 8ebb5c
    LINXY(__NR_sendmmsg,          sys_sendmmsg),          // 269
Mark Wielaard 8ebb5c
    LINXY(__NR_process_vm_readv,  sys_process_vm_readv),  // 270
Mark Wielaard 8ebb5c
    LINX_(__NR_process_vm_writev, sys_process_vm_writev), // 271
Mark Wielaard 8ebb5c
diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c
Mark Wielaard 8ebb5c
index f15c909..09c247c 100644
Mark Wielaard 8ebb5c
--- a/coregrind/m_syswrap/syswrap-linux.c
Mark Wielaard 8ebb5c
+++ b/coregrind/m_syswrap/syswrap-linux.c
Mark Wielaard 8ebb5c
@@ -3064,6 +3064,13 @@ POST(sys_memfd_create)
Mark Wielaard 8ebb5c
    }
Mark Wielaard 8ebb5c
 }
Mark Wielaard 8ebb5c
 
Mark Wielaard 8ebb5c
+PRE(sys_syncfs)
Mark Wielaard 8ebb5c
+{
Mark Wielaard 8ebb5c
+   *flags |= SfMayBlock;
Mark Wielaard 8ebb5c
+   PRINT("sys_syncfs ( %ld )", ARG1);
Mark Wielaard 8ebb5c
+   PRE_REG_READ1(long, "syncfs", unsigned int, fd);
Mark Wielaard 8ebb5c
+}
Mark Wielaard 8ebb5c
+
Mark Wielaard 8ebb5c
 /* ---------------------------------------------------------------------
Mark Wielaard 8ebb5c
    utime wrapper
Mark Wielaard 8ebb5c
    ------------------------------------------------------------------ */
Mark Wielaard 8ebb5c
diff --git a/coregrind/m_syswrap/syswrap-mips32-linux.c b/coregrind/m_syswrap/syswrap-mips32-linux.c
Mark Wielaard 8ebb5c
index 1b4c5bc..7a71576 100644
Mark Wielaard 8ebb5c
--- a/coregrind/m_syswrap/syswrap-mips32-linux.c
Mark Wielaard 8ebb5c
+++ b/coregrind/m_syswrap/syswrap-mips32-linux.c
Mark Wielaard 8ebb5c
@@ -1112,6 +1112,7 @@ static SyscallTableEntry syscall_main_table[] = {
Mark Wielaard 8ebb5c
    LINXY (__NR_prlimit64,              sys_prlimit64),               // 338
Mark Wielaard 8ebb5c
    //..
Mark Wielaard 8ebb5c
    LINXY (__NR_clock_adjtime,          sys_clock_adjtime),           // 341
Mark Wielaard 8ebb5c
+   LINX_ (__NR_syncfs,                 sys_syncfs),                  // 342
Mark Wielaard 8ebb5c
    //..
Mark Wielaard 8ebb5c
    LINXY (__NR_process_vm_readv,       sys_process_vm_readv),        // 345
Mark Wielaard 8ebb5c
    LINX_ (__NR_process_vm_writev,      sys_process_vm_writev),       // 346
Mark Wielaard 8ebb5c
diff --git a/coregrind/m_syswrap/syswrap-mips64-linux.c b/coregrind/m_syswrap/syswrap-mips64-linux.c
Mark Wielaard 8ebb5c
index d356645..3a5e979 100644
Mark Wielaard 8ebb5c
--- a/coregrind/m_syswrap/syswrap-mips64-linux.c
Mark Wielaard 8ebb5c
+++ b/coregrind/m_syswrap/syswrap-mips64-linux.c
Mark Wielaard 8ebb5c
@@ -909,7 +909,8 @@ static SyscallTableEntry syscall_main_table[] = {
Mark Wielaard 8ebb5c
    LINXY (__NR_process_vm_readv, sys_process_vm_readv),
Mark Wielaard 8ebb5c
    LINX_ (__NR_process_vm_writev, sys_process_vm_writev),
Mark Wielaard 8ebb5c
    LINXY(__NR_getrandom, sys_getrandom),
Mark Wielaard 8ebb5c
-   LINXY(__NR_memfd_create, sys_memfd_create)
Mark Wielaard 8ebb5c
+   LINXY(__NR_memfd_create, sys_memfd_create),
Mark Wielaard 8ebb5c
+   LINX_(__NR_syncfs, sys_syncfs)
Mark Wielaard 8ebb5c
 };
Mark Wielaard 8ebb5c
 
Mark Wielaard 8ebb5c
 SyscallTableEntry * ML_(get_linux_syscall_entry) ( UInt sysno )
Mark Wielaard 8ebb5c
diff --git a/coregrind/m_syswrap/syswrap-ppc32-linux.c b/coregrind/m_syswrap/syswrap-ppc32-linux.c
Mark Wielaard 8ebb5c
index 1f5d7f6..9c9937b 100644
Mark Wielaard 8ebb5c
--- a/coregrind/m_syswrap/syswrap-ppc32-linux.c
Mark Wielaard 8ebb5c
+++ b/coregrind/m_syswrap/syswrap-ppc32-linux.c
Mark Wielaard 8ebb5c
@@ -1253,7 +1253,7 @@ static SyscallTableEntry syscall_table[] = {
Mark Wielaard 8ebb5c
    LINXY(__NR_accept4,           sys_accept4),          // 344
Mark Wielaard 8ebb5c
 
Mark Wielaard 8ebb5c
    LINX_(__NR_clock_adjtime,     sys_clock_adjtime),    // 347
Mark Wielaard 8ebb5c
-
Mark Wielaard 8ebb5c
+   LINX_(__NR_syncfs,            sys_syncfs),           // 348
Mark Wielaard 8ebb5c
    LINXY(__NR_sendmmsg,          sys_sendmmsg),         // 349
Mark Wielaard 8ebb5c
 
Mark Wielaard 8ebb5c
    LINXY(__NR_process_vm_readv,  sys_process_vm_readv), // 351
Mark Wielaard 8ebb5c
diff --git a/coregrind/m_syswrap/syswrap-ppc64-linux.c b/coregrind/m_syswrap/syswrap-ppc64-linux.c
Mark Wielaard 8ebb5c
index 6f3c1f7..e2432fd 100644
Mark Wielaard 8ebb5c
--- a/coregrind/m_syswrap/syswrap-ppc64-linux.c
Mark Wielaard 8ebb5c
+++ b/coregrind/m_syswrap/syswrap-ppc64-linux.c
Mark Wielaard 8ebb5c
@@ -1155,7 +1155,7 @@ static SyscallTableEntry syscall_table[] = {
Mark Wielaard 8ebb5c
    LINXY(__NR_accept4,           sys_accept4),          // 344
Mark Wielaard 8ebb5c
 
Mark Wielaard 8ebb5c
    LINXY(__NR_clock_adjtime,     sys_clock_adjtime),    // 347
Mark Wielaard 8ebb5c
-
Mark Wielaard 8ebb5c
+   LINX_(__NR_syncfs,            sys_syncfs),           // 348
Mark Wielaard 8ebb5c
    LINXY(__NR_sendmmsg,          sys_sendmmsg),         // 349
Mark Wielaard 8ebb5c
 
Mark Wielaard 8ebb5c
    LINXY(__NR_process_vm_readv,  sys_process_vm_readv), // 351
Mark Wielaard 8ebb5c
diff --git a/coregrind/m_syswrap/syswrap-s390x-linux.c b/coregrind/m_syswrap/syswrap-s390x-linux.c
Mark Wielaard 8ebb5c
index 8e0afa0..db374f4 100644
Mark Wielaard 8ebb5c
--- a/coregrind/m_syswrap/syswrap-s390x-linux.c
Mark Wielaard 8ebb5c
+++ b/coregrind/m_syswrap/syswrap-s390x-linux.c
Mark Wielaard 8ebb5c
@@ -1035,7 +1035,7 @@ static SyscallTableEntry syscall_table[] = {
Mark Wielaard 8ebb5c
    LINXY(__NR_name_to_handle_at, sys_name_to_handle_at),              // 335
Mark Wielaard 8ebb5c
    LINXY(__NR_open_by_handle_at, sys_open_by_handle_at),              // 336
Mark Wielaard 8ebb5c
    LINXY(__NR_clock_adjtime, sys_clock_adjtime),                      // 337
Mark Wielaard 8ebb5c
-// ?????(__NR_syncfs, ),                                              // 338
Mark Wielaard 8ebb5c
+   LINX_(__NR_syncfs, sys_syncfs),                                    // 338
Mark Wielaard 8ebb5c
 // ?????(__NR_setns, ),                                               // 339
Mark Wielaard 8ebb5c
 
Mark Wielaard 8ebb5c
    LINXY(__NR_process_vm_readv, sys_process_vm_readv),                // 340
Mark Wielaard 8ebb5c
diff --git a/coregrind/m_syswrap/syswrap-x86-linux.c b/coregrind/m_syswrap/syswrap-x86-linux.c
Mark Wielaard 8ebb5c
index 0f80d4a..e08af76 100644
Mark Wielaard 8ebb5c
--- a/coregrind/m_syswrap/syswrap-x86-linux.c
Mark Wielaard 8ebb5c
+++ b/coregrind/m_syswrap/syswrap-x86-linux.c
Mark Wielaard 8ebb5c
@@ -1805,7 +1805,7 @@ static SyscallTableEntry syscall_table[] = {
Mark Wielaard 8ebb5c
    LINXY(__NR_name_to_handle_at, sys_name_to_handle_at),// 341
Mark Wielaard 8ebb5c
    LINXY(__NR_open_by_handle_at, sys_open_by_handle_at),// 342
Mark Wielaard 8ebb5c
    LINXY(__NR_clock_adjtime,     sys_clock_adjtime),    // 343
Mark Wielaard 8ebb5c
-//   LINX_(__NR_syncfs,            sys_ni_syscall),       // 344
Mark Wielaard 8ebb5c
+   LINX_(__NR_syncfs,            sys_syncfs),           // 344
Mark Wielaard 8ebb5c
 
Mark Wielaard 8ebb5c
    LINXY(__NR_sendmmsg,          sys_sendmmsg),         // 345
Mark Wielaard 8ebb5c
 //   LINX_(__NR_setns,             sys_ni_syscall),       // 346