Blob Blame History Raw
commit 7c91105917f41c11a0b377b2393725da380cd490
Author: tom <tom@a5019735-40e9-0310-863c-91ae7b9d1cf9>
Date:   Thu May 7 18:54:31 2015 +0000

    Add support for the syncfs system call.
    
    Based on patch from j@eckel.me on BZ#347389.
    
    
    git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15191 a5019735-40e9-0310-863c-91ae7b9d1cf9

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