qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: riku.voipio@iki.fi
To: qemu-devel@nongnu.org
Cc: Riku Voipio <riku.voipio@iki.fi>
Subject: [Qemu-devel] linux-user: add eventfd support
Date: Tue, 21 Jul 2009 23:58:04 +0300	[thread overview]
Message-ID: <1248209884-10662-2-git-send-email-riku.voipio@iki.fi> (raw)
In-Reply-To: <1248209884-10662-1-git-send-email-riku.voipio@iki.fi>

From: Riku Voipio <riku.voipio@iki.fi>

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 |   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 <sys/eventfd.h>
+
+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 <sys/eventfd.h>
+#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

      reply	other threads:[~2009-07-21 20:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-21 20:58 [Qemu-devel] RFC: target-arm: vld1.64 and vst1.64 support riku.voipio
2009-07-21 20:58 ` riku.voipio [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1248209884-10662-2-git-send-email-riku.voipio@iki.fi \
    --to=riku.voipio@iki.fi \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).