qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Riku Voipio <riku.voipio@iki.fi>
To: "Kirill A. Shutemov" <kirill@shutemov.name>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 01/11] linux-user: add eventfd support
Date: Wed, 26 Aug 2009 16:23:31 +0300	[thread overview]
Message-ID: <20090826132331.GA7862@kos.to> (raw)
In-Reply-To: <cc557aab0908210429i2ccacdfep1494d4fa6563c1b2@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 275 bytes --]

On Fri, Aug 21, 2009 at 02:29:46PM +0300, Kirill A. Shutemov wrote:
> >  #endif /* CONFIG_SPLICE */
> > +#ifdef CONFIG_EVENTFD
> > +#include <sys/eventfd.h>

> I don't think that #include within function is a good idea.

You are right. Corrected version attached.


[-- Attachment #2: 0001-linux-user-add-eventfd-support.patch --]
[-- Type: text/x-diff, Size: 2499 bytes --]

>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(-)

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 <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
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 <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


  reply	other threads:[~2009-08-26 13:23 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-13 20:06 [Qemu-devel] [PATCH 00/11] linux-user patches for HEAD riku.voipio
2009-08-13 20:06 ` [Qemu-devel] [PATCH 01/11] linux-user: add eventfd support riku.voipio
2009-08-21 11:29   ` Kirill A. Shutemov
2009-08-26 13:23     ` Riku Voipio [this message]
2009-08-13 20:06 ` [Qemu-devel] [PATCH 02/11] m68k,linux-user: add setup_frame riku.voipio
2009-08-13 20:06 ` [Qemu-devel] [PATCH 03/11] m68k, linux-user: add setup_rt_frame riku.voipio
2009-08-13 20:06 ` [Qemu-devel] [PATCH 04/11] m68k, linux-user: enable sigaltstack() riku.voipio
2009-08-13 20:06 ` [Qemu-devel] [PATCH 05/11] linux-user: fix mq_* compilation problems riku.voipio
2009-08-13 20:06 ` [Qemu-devel] [PATCH 06/11] linux-user: fcntl fixes for LTP riku.voipio
2009-08-13 20:06 ` [Qemu-devel] [PATCH 07/11] linux-user: enable getdents for > 32-bit systems riku.voipio
2009-08-13 20:06 ` [Qemu-devel] [PATCH 08/11] linux-user: define a couple of syscalls for non-uid16 targets riku.voipio
2009-08-13 20:06 ` [Qemu-devel] [PATCH 09/11] linux-user: fadvise64 implementation riku.voipio
2009-08-13 20:06 ` [Qemu-devel] [PATCH 10/11] linux-user: zero fstat buffer to initialize nsec fields riku.voipio
2009-08-13 20:06 ` [Qemu-devel] [PATCH 11/11] linux-user: Rewrite mmap_find_vma() to work fine on 64-bit hosts with 32-bit targets riku.voipio

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=20090826132331.GA7862@kos.to \
    --to=riku.voipio@iki.fi \
    --cc=kirill@shutemov.name \
    --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).