From patchwork Thu Aug 13 20:06:14 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 31354 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 8F198B70AD for ; Fri, 14 Aug 2009 06:09:14 +1000 (EST) Received: from localhost ([127.0.0.1]:42085 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mbgbl-0006vM-Hb for incoming@patchwork.ozlabs.org; Thu, 13 Aug 2009 16:09:09 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MbgZG-0003uY-HU for qemu-devel@nongnu.org; Thu, 13 Aug 2009 16:06:34 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MbgZC-0003pd-OC for qemu-devel@nongnu.org; Thu, 13 Aug 2009 16:06:31 -0400 Received: from [199.232.76.173] (port=50650 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MbgZC-0003pE-JM for qemu-devel@nongnu.org; Thu, 13 Aug 2009 16:06:30 -0400 Received: from [84.20.150.76] (port=34664 helo=naru.obs2.net) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MbgZB-0000pH-Dh for qemu-devel@nongnu.org; Thu, 13 Aug 2009 16:06:29 -0400 Received: from kos.to (localhost.localdomain [127.0.0.1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by narury.org (Postfix) with ESMTP id 968A53274061; Thu, 13 Aug 2009 23:06:25 +0300 (EEST) Received: by kos.to (Postfix, from userid 573) id 03ED2EE8317; Thu, 13 Aug 2009 23:06:24 +0300 (EEST) From: riku.voipio@iki.fi To: qemu-devel@nongnu.org Date: Thu, 13 Aug 2009 23:06:14 +0300 Message-Id: <2544cbe008bf325372291aa6eea38d98892d4a13.1250193231.git.riku.voipio@iki.fi> X-Mailer: git-send-email 1.6.2.1 In-Reply-To: References: In-Reply-To: References: X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.4-2.6 Cc: Riku Voipio Subject: [Qemu-devel] [PATCH 01/11] linux-user: add eventfd support 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 From: Riku Voipio Straightforward implementation. This syscall is rare enough that we don't need to support the odder cases, just disable it if host glibc is too old. Signed-off-by: Riku Voipio --- configure | 18 ++++++++++++++++++ linux-user/syscall.c | 13 +++++++++++++ 2 files changed, 31 insertions(+), 0 deletions(-) diff --git a/configure b/configure index 0b2c721..c52f1cf 100755 --- a/configure +++ b/configure @@ -1345,6 +1345,21 @@ if compile_prog "" "" ; then splice=yes fi +# check if eventfd is supported +eventfd=no +cat > $TMPC << EOF +#include + +int main(void) +{ + int efd = eventfd(0, 0); + return 0; +} +EOF +if compile_prog "" "" ; then + eventfd=yes +fi + # Check if tools are available to build documentation. if test "$build_docs" = "yes" -a \( ! -x "`which texi2html 2>/dev/null`" -o ! -x "`which pod2man 2>/dev/null`" \) ; then build_docs="no" @@ -1684,6 +1699,9 @@ fi if test "$splice" = "yes" ; then echo "CONFIG_SPLICE=y" >> $config_host_mak fi +if test "$eventfd" = "yes" ; then + echo "CONFIG_EVENTFD=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 673eed4..3b1ed60 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -6974,6 +6974,19 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, break; #endif #endif /* CONFIG_SPLICE */ +#ifdef CONFIG_EVENTFD +#include +#if defined(TARGET_NR_eventfd) + case TARGET_NR_eventfd: + ret = get_errno(eventfd(arg1, 0)); + break; +#endif +#if defined(TARGET_NR_eventfd2) + case TARGET_NR_eventfd2: + ret = get_errno(eventfd(arg1, arg2)); + break; +#endif +#endif /* CONFIG_EVENTFD */ default: unimplemented: gemu_log("qemu: Unsupported syscall: %d\n", num);