From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MTMPZ-0004eH-3M for qemu-devel@nongnu.org; Tue, 21 Jul 2009 16:58:09 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MTMPY-0004dq-Hk for qemu-devel@nongnu.org; Tue, 21 Jul 2009 16:58:08 -0400 Received: from [199.232.76.173] (port=51550 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MTMPY-0004dm-52 for qemu-devel@nongnu.org; Tue, 21 Jul 2009 16:58:08 -0400 Received: from naru.obs2.net ([84.20.150.76]:57467) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MTMPX-0007sq-3W for qemu-devel@nongnu.org; Tue, 21 Jul 2009 16:58:07 -0400 From: riku.voipio@iki.fi Date: Tue, 21 Jul 2009 23:58:04 +0300 Message-Id: <1248209884-10662-2-git-send-email-riku.voipio@iki.fi> In-Reply-To: <1248209884-10662-1-git-send-email-riku.voipio@iki.fi> References: <1248209884-10662-1-git-send-email-riku.voipio@iki.fi> Subject: [Qemu-devel] linux-user: add eventfd support List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Riku Voipio 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 0db885b..8a7399f 100755 --- a/configure +++ b/configure @@ -1366,6 +1366,21 @@ if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; 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 $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; 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" @@ -1715,6 +1730,9 @@ fi if test "$splice" = "yes" ; then echo "#define CONFIG_SPLICE 1" >> $config_host_h fi +if test "$eventfd" = "yes" ; then + echo "#define CONFIG_EVENTFD 1" >> $config_host_h +fi if test "$inotify" = "yes" ; then echo "#define CONFIG_INOTIFY 1" >> $config_host_h fi diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 7b57323..081cb34 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -6966,6 +6966,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); -- 1.6.2.1