From patchwork Wed Oct 21 13:52:30 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulrich Hecht X-Patchwork-Id: 36607 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 E24BAB7BBF for ; Thu, 22 Oct 2009 02:10:20 +1100 (EST) Received: from localhost ([127.0.0.1]:55190 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N0cpN-0000fy-Oj for incoming@patchwork.ozlabs.org; Wed, 21 Oct 2009 11:10:17 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N0bbt-0005P6-OQ for qemu-devel@nongnu.org; Wed, 21 Oct 2009 09:52:18 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N0bbm-0005I5-L7 for qemu-devel@nongnu.org; Wed, 21 Oct 2009 09:52:15 -0400 Received: from [199.232.76.173] (port=37612 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N0bbl-0005GM-7K for qemu-devel@nongnu.org; Wed, 21 Oct 2009 09:52:09 -0400 Received: from cantor.suse.de ([195.135.220.2]:54505 helo=mx1.suse.de) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1N0bbj-0005NQ-Sm for qemu-devel@nongnu.org; Wed, 21 Oct 2009 09:52:08 -0400 Received: from relay2.suse.de (relay-ext.suse.de [195.135.221.8]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.suse.de (Postfix) with ESMTP id 5F89794430; Wed, 21 Oct 2009 15:52:05 +0200 (CEST) From: Ulrich Hecht To: aurelien@aurel32.net Date: Wed, 21 Oct 2009 15:52:30 +0200 Message-Id: <1256133153-3121-10-git-send-email-uli@suse.de> X-Mailer: git-send-email 1.6.2.1 In-Reply-To: <1256133153-3121-9-git-send-email-uli@suse.de> References: <1256133153-3121-1-git-send-email-uli@suse.de> <1256133153-3121-2-git-send-email-uli@suse.de> <1256133153-3121-3-git-send-email-uli@suse.de> <1256133153-3121-4-git-send-email-uli@suse.de> <1256133153-3121-5-git-send-email-uli@suse.de> <1256133153-3121-6-git-send-email-uli@suse.de> <1256133153-3121-7-git-send-email-uli@suse.de> <1256133153-3121-8-git-send-email-uli@suse.de> <1256133153-3121-9-git-send-email-uli@suse.de> X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.4-2.6 Cc: riku.voipio@iki.fi, qemu-devel@nongnu.org, agraf@suse.de Subject: [Qemu-devel] [PATCH 09/12] linux-user: dup3, fallocate 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 implementations of dup3 and fallocate that are good enough to fool LTP dup3 check, fallocate check fixed use compile_prog Signed-off-by: Ulrich Hecht --- configure | 36 ++++++++++++++++++++++++++++++++++++ linux-user/syscall.c | 10 ++++++++++ 2 files changed, 46 insertions(+), 0 deletions(-) diff --git a/configure b/configure index 64be51f..30ecd8f 100755 --- a/configure +++ b/configure @@ -1573,6 +1573,36 @@ if compile_prog "" "" ; then eventfd=yes fi +# check for fallocate +fallocate=no +cat > $TMPC << EOF +#include + +int main(void) +{ + fallocate(0, 0, 0, 0); + return 0; +} +EOF +if compile_prog "" "" ; then + fallocate=yes +fi + +# check for dup3 +dup3=no +cat > $TMPC << EOF +#include + +int main(void) +{ + dup3(0, 0, 0); + return 0; +} +EOF +if compile_prog "" "" ; then + dup3=yes +fi + # Check if tools are available to build documentation. if test "$docs" != "no" ; then if test -x "`which texi2html 2>/dev/null`" -a \ @@ -1954,6 +1984,12 @@ fi if test "$eventfd" = "yes" ; then echo "CONFIG_EVENTFD=y" >> $config_host_mak fi +if test "$fallocate" = "yes" ; then + echo "CONFIG_FALLOCATE=y" >> $config_host_mak +fi +if test "$dup3" = "yes" ; then + echo "CONFIG_DUP3=y" >> $config_host_mak +fi if test "$inotify" = "yes" ; then echo "CONFIG_INOTIFY=y" >> $config_host_mak fi diff --git a/linux-user/syscall.c b/linux-user/syscall.c index f2a53d5..4991154 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -4747,6 +4747,11 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, case TARGET_NR_dup2: ret = get_errno(dup2(arg1, arg2)); break; +#if defined(TARGET_NR_dup3) && defined(CONFIG_DUP3) + case TARGET_NR_dup3: + ret = get_errno(dup3(arg1, arg2, arg3)); + break; +#endif #ifdef TARGET_NR_getppid /* not on alpha */ case TARGET_NR_getppid: ret = get_errno(getppid()); @@ -7022,6 +7027,11 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, break; #endif #endif /* CONFIG_EVENTFD */ +#if defined(CONFIG_FALLOCATE) && defined(TARGET_NR_fallocate) + case TARGET_NR_fallocate: + ret = get_errno(fallocate(arg1, arg2, arg3, arg4)); + break; +#endif default: unimplemented: gemu_log("qemu: Unsupported syscall: %d\n", num);