From c2882b96545eeabf16767c6effa836e6f9991018 Mon Sep 17 00:00:00 2001
Message-Id: <c2882b96545eeabf16767c6effa836e6f9991018.1251230665.git.riku.voipio@iki.fi>
In-Reply-To: <cover.1251230665.git.riku.voipio@iki.fi>
References: <cover.1251230665.git.riku.voipio@iki.fi>
From: Riku Voipio <riku.voipio@iki.fi>
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 <riku.voipio@iki.fi>
---
configure | 18 ++++++++++++++++++
linux-user/syscall.c | 15 +++++++++++++++
2 files changed, 33 insertions(+), 0 deletions(-)
@@ -1322,6 +1322,21 @@ if compile_prog "" "" ; then
splice=yes
fi
+# check if eventfd is supported
+eventfd=no
+cat > $TMPC << EOF
+#include <sys/eventfd.h>
+
+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
@@ -60,6 +60,9 @@
#ifdef TARGET_GPROF
#include <sys/gmon.h>
#endif
+#ifdef CONFIG_EVENTFD
+#include <sys/eventfd.h>
+#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