Skip to content

Commit

Permalink
linux-user: Add support for syncfs() syscall
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
aleksandar-markovic authored and Riku Voipio committed Oct 21, 2016
1 parent 38860a0 commit 5a03cd0
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
18 changes: 18 additions & 0 deletions configure
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion linux-user/strace.list
Expand Up @@ -1459,7 +1459,7 @@
{ 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 },
Expand Down
5 changes: 5 additions & 0 deletions linux-user/syscall.c
Expand Up @@ -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;
Expand Down

0 comments on commit 5a03cd0

Please sign in to comment.