linux-user: Add support for syncfs() syscall
authorAleksandar Markovic <aleksandar.markovic@imgtec.com>
Mon, 10 Oct 2016 11:23:30 +0000 (13:23 +0200)
committerRiku Voipio <riku.voipio@linaro.org>
Fri, 21 Oct 2016 12:20:13 +0000 (15:20 +0300)
This patch implements Qemu user mode syncfs() syscall support. Syscall
syncfs() syncs the filesystem containing file determined by the open
file descriptor passed as the argument to syncfs().

The implementation consists of a straightforward invocation of host's
syncfs(). Configure and strace support is included as well.

Signed-off-by: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
configure
linux-user/strace.list
linux-user/syscall.c

index 1ce3d002ed86a26b7f7d98604883e161605e166c..d3dafcbb373eee61db7fa9f459079e0597c17680 100755 (executable)
--- a/configure
+++ b/configure
@@ -3926,6 +3926,21 @@ if compile_prog "" "" ; then
   clock_adjtime=yes
 fi
 
+# syncfs probe
+syncfs=no
+cat > $TMPC <<EOF
+#include <unistd.h>
+
+int main(void)
+{
+    return syncfs(0);
+}
+EOF
+syncfs=no
+if compile_prog "" "" ; then
+  syncfs=yes
+fi
+
 # Check if tools are available to build documentation.
 if test "$docs" != "no" ; then
   if has makeinfo && has pod2man; then
@@ -5214,6 +5229,9 @@ fi
 if test "$clock_adjtime" = "yes" ; then
   echo "CONFIG_CLOCK_ADJTIME=y" >> $config_host_mak
 fi
+if test "$syncfs" = "yes" ; then
+  echo "CONFIG_SYNCFS=y" >> $config_host_mak
+fi
 if test "$inotify" = "yes" ; then
   echo "CONFIG_INOTIFY=y" >> $config_host_mak
 fi
index dcd3812cadb936573eeb02c636a2957efdd9e73e..3b1282ec1a7257b038e807e70b02397416c325bc 100644 (file)
 { TARGET_NR_sync, "sync" , NULL, NULL, NULL },
 #endif
 #ifdef TARGET_NR_syncfs
-{ TARGET_NR_syncfs, "syncfs" , NULL, NULL, NULL },
+{ TARGET_NR_syncfs, "syncfs" , "%s(%d)", NULL, NULL },
 #endif
 #ifdef TARGET_NR_syscall
 { TARGET_NR_syscall, "syscall" , NULL, NULL, NULL },
index 14929965ff72eb6a87915dae7dc66d20d85eeb42..14c52072f94df303d81eb2f68be7df1fb04fe9dd 100644 (file)
@@ -8090,6 +8090,11 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
         sync();
         ret = 0;
         break;
+#if defined(TARGET_NR_syncfs) && defined(CONFIG_SYNCFS)
+    case TARGET_NR_syncfs:
+        ret = get_errno(syncfs(arg1));
+        break;
+#endif
     case TARGET_NR_kill:
         ret = get_errno(safe_kill(arg1, target_to_host_signal(arg2)));
         break;