Received: from eggs.gnu.org ([2001:4830:134:3::10]:40896) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1btXg5-000563-Ak for qemu-devel@nongnu.org; Mon, 10 Oct 2016 06:19:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1btXg4-0001AL-H5 for qemu-devel@nongnu.org; Mon, 10 Oct 2016 06:19:25 -0400 Received: from mx2.rt-rk.com ([89.216.37.149]:57706 helo=mail.rt-rk.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1btXg4-0001A5-9z for qemu-devel@nongnu.org; Mon, 10 Oct 2016 06:19:24 -0400 From: Aleksandar Markovic Date: Mon, 10 Oct 2016 12:18:25 +0200 Message-Id: <20161010101833.89162-3-aleksandar.markovic@rt-rk.com> In-Reply-To: <20161010101833.89162-1-aleksandar.markovic@rt-rk.com> References: <20161010101833.89162-1-aleksandar.markovic@rt-rk.com> Subject: [Qemu-devel] [PATCH v8 2/2] linux-user: Add support for syncfs() syscall List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, riku.voipio@iki.fi, laurent@vivier.eu, peter.maydell@linaro.org, petar.jovanovic@imgtec.com, miodrag.dinic@imgtec.com, aleksandar.rikalo@imgtec.com, aleksandar.markovic@imgtec.com From: Aleksandar Markovic 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 --- configure | 18 ++++++++++++++++++ linux-user/strace.list | 2 +- linux-user/syscall.c | 5 +++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 044e0cd..7b9984b 100755 --- a/configure +++ b/configure @@ -3913,6 +3913,21 @@ if compile_prog "" "" ; then clock_adjtime=yes fi +# syncfs probe +syncfs=no +cat > $TMPC < + +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 @@ -5201,6 +5216,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 diff --git a/linux-user/strace.list b/linux-user/strace.list index 9355075..c549f99 100644 --- a/linux-user/strace.list +++ b/linux-user/strace.list @@ -1462,7 +1462,7 @@ { TARGET_NR_sync_file_range, "sync_file_range" , 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 }, diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 25be16b..850f4cc 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -8071,6 +8071,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; -- 2.9.3