From patchwork Thu Jan 6 11:05:10 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 77723 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 1478FB70A9 for ; Fri, 7 Jan 2011 01:58:09 +1100 (EST) Received: from localhost ([127.0.0.1]:52169 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ParFz-0006gy-Ss for incoming@patchwork.ozlabs.org; Thu, 06 Jan 2011 09:56:04 -0500 Received: from [140.186.70.92] (port=58387 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ParCr-0005Wh-20 for qemu-devel@nongnu.org; Thu, 06 Jan 2011 09:52:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ParCi-0007cY-7H for qemu-devel@nongnu.org; Thu, 06 Jan 2011 09:52:41 -0500 Received: from mnementh.archaic.org.uk ([81.2.115.146]:42425) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ParCh-0007Te-VY for qemu-devel@nongnu.org; Thu, 06 Jan 2011 09:52:40 -0500 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.69) (envelope-from ) id 1PaneY-0004ob-H6; Thu, 06 Jan 2011 11:05:10 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Date: Thu, 6 Jan 2011 11:05:10 +0000 Message-Id: <1294311910-18488-1-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) Cc: Riku Voipio Subject: [Qemu-devel] [PATCH] linux-user: Implement sync_file_range{, 2} syscalls X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Implement the missing syscalls sync_file_range and sync_file_range2. The latter in particular is used by newer versions of apt on Ubuntu for ARM. Signed-off-by: Peter Maydell --- configure | 18 ++++++++++++++++++ linux-user/strace.list | 6 ++++++ linux-user/syscall.c | 23 +++++++++++++++++++++++ 3 files changed, 47 insertions(+), 0 deletions(-) diff --git a/configure b/configure index 47e4cf0..831a741 100755 --- a/configure +++ b/configure @@ -2075,6 +2075,21 @@ if compile_prog "$ARCH_CFLAGS" "" ; then fallocate=yes fi +# check for sync_file_range +sync_file_range=no +cat > $TMPC << EOF +#include + +int main(void) +{ + sync_file_range(0, 0, 0, 0); + return 0; +} +EOF +if compile_prog "$ARCH_CFLAGS" "" ; then + sync_file_range=yes +fi + # check for dup3 dup3=no cat > $TMPC << EOF @@ -2613,6 +2628,9 @@ fi if test "$fallocate" = "yes" ; then echo "CONFIG_FALLOCATE=y" >> $config_host_mak fi +if test "$sync_file_range" = "yes" ; then + echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak +fi if test "$dup3" = "yes" ; then echo "CONFIG_DUP3=y" >> $config_host_mak fi diff --git a/linux-user/strace.list b/linux-user/strace.list index 97b7f76..d7be0e7 100644 --- a/linux-user/strace.list +++ b/linux-user/strace.list @@ -1518,3 +1518,9 @@ #ifdef TARGET_NR_utimensat { TARGET_NR_utimensat, "utimensat", NULL, print_utimensat, NULL }, #endif +#ifdef TARGET_NR_sync_file_range +{ TARGET_NR_sync_file_range, "sync_file_range", NULL, NULL, NULL }, +#endif +#ifdef TARGET_NR_sync_file_range2 +{ TARGET_NR_sync_file_range2, "sync_file_range2", NULL, NULL, NULL }, +#endif diff --git a/linux-user/syscall.c b/linux-user/syscall.c index c3e8706..1939a5f 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -7365,6 +7365,29 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, ret = get_errno(fallocate(arg1, arg2, arg3, arg4)); break; #endif +#if defined(CONFIG_SYNC_FILE_RANGE) +#if defined(TARGET_NR_sync_file_range) + case TARGET_NR_sync_file_range: +#if TARGET_ABI_BITS == 32 + ret = get_errno(sync_file_range(arg1, target_offset64(arg2, arg3), + target_offset64(arg4, arg5), arg6)); +#else + ret = get_errno(sync_file_range(arg1, arg2, arg3, arg4)); +#endif + break; +#endif +#if defined(TARGET_NR_sync_file_range2) + case TARGET_NR_sync_file_range2: + /* This is like sync_file_range but the arguments are reordered */ +#if TARGET_ABI_BITS == 32 + ret = get_errno(sync_file_range(arg1, target_offset64(arg3, arg4), + target_offset64(arg5, arg6), arg2)); +#else + ret = get_errno(sync_file_range(arg1, arg3, arg4, arg2)); +#endif + break; +#endif +#endif default: unimplemented: gemu_log("qemu: Unsupported syscall: %d\n", num);