From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MgITS-0003ze-Lh for qemu-devel@nongnu.org; Wed, 26 Aug 2009 09:23:38 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MgITQ-0003yo-UP for qemu-devel@nongnu.org; Wed, 26 Aug 2009 09:23:38 -0400 Received: from [199.232.76.173] (port=44341 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MgITQ-0003yi-O7 for qemu-devel@nongnu.org; Wed, 26 Aug 2009 09:23:36 -0400 Received: from [84.20.150.76] (port=57393 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 1MgITQ-0005MM-2D for qemu-devel@nongnu.org; Wed, 26 Aug 2009 09:23:36 -0400 Date: Wed, 26 Aug 2009 16:23:31 +0300 From: Riku Voipio Subject: Re: [Qemu-devel] [PATCH 01/11] linux-user: add eventfd support Message-ID: <20090826132331.GA7862@kos.to> References: <2544cbe008bf325372291aa6eea38d98892d4a13.1250193231.git.riku.voipio@iki.fi> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="lrZ03NoBR/3+SXJZ" Content-Disposition: inline In-Reply-To: Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Kirill A. Shutemov" Cc: qemu-devel@nongnu.org --lrZ03NoBR/3+SXJZ Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Aug 21, 2009 at 02:29:46PM +0300, Kirill A. Shutemov wrote: > > =C2=A0#endif /* CONFIG_SPLICE */ > > +#ifdef CONFIG_EVENTFD > > +#include > I don't think that #include within function is a good idea. You are right. Corrected version attached. --lrZ03NoBR/3+SXJZ Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0001-linux-user-add-eventfd-support.patch" >>From c2882b96545eeabf16767c6effa836e6f9991018 Mon Sep 17 00:00:00 2001 Message-Id: In-Reply-To: References: From: Riku Voipio Date: Wed, 12 Aug 2009 15:08:24 +0300 Subject: [PATCH 01/10] linux-user: add eventfd support 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 | 15 +++++++++++++++ 2 files changed, 33 insertions(+), 0 deletions(-) diff --git a/configure b/configure index 5c1065f..56dd489 100755 --- a/configure +++ b/configure @@ -1322,6 +1322,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" @@ -1659,6 +1674,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..603fec2 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -60,6 +60,9 @@ #ifdef TARGET_GPROF #include #endif +#ifdef CONFIG_EVENTFD +#include +#endif #define termios host_termios #define winsize host_winsize @@ -6974,6 +6977,18 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, break; #endif #endif /* CONFIG_SPLICE */ +#ifdef CONFIG_EVENTFD +#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); -- 1.6.2.1 --lrZ03NoBR/3+SXJZ--