qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: qemu-devel@nongnu.org
Cc: Anthony Liguori <aliguori@us.ibm.com>
Subject: [Qemu-devel] [PATCH 2/4] linux-user: pass correct host flags to eventfd2 call
Date: Fri, 12 Apr 2013 16:38:20 +0200	[thread overview]
Message-ID: <1365777502-7035-3-git-send-email-stefanha@redhat.com> (raw)
In-Reply-To: <1365777502-7035-1-git-send-email-stefanha@redhat.com>

From: Petar Jovanovic <petar.jovanovic@rt-rk.com>

This change makes conversion of TARGET_O_NONBLOCK and TARGET_O_CLOEXEC flags
to host flags before calling eventfd for TARGET_NR_eventfd2.

Signed-off-by: Petar Jovanovic <petar.jovanovic@imgtec.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 linux-user/syscall.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index ee82a2d..1f07621 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -8823,8 +8823,17 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
 #endif
 #if defined(TARGET_NR_eventfd2)
     case TARGET_NR_eventfd2:
-        ret = get_errno(eventfd(arg1, arg2));
+    {
+        int host_flags = arg2 & (~(TARGET_O_NONBLOCK | TARGET_O_CLOEXEC));
+        if (arg2 & TARGET_O_NONBLOCK) {
+            host_flags |= O_NONBLOCK;
+        }
+        if (arg2 & TARGET_O_CLOEXEC) {
+            host_flags |= O_CLOEXEC;
+        }
+        ret = get_errno(eventfd(arg1, host_flags));
         break;
+    }
 #endif
 #endif /* CONFIG_EVENTFD  */
 #if defined(CONFIG_FALLOCATE) && defined(TARGET_NR_fallocate)
-- 
1.8.1.4

  parent reply	other threads:[~2013-04-12 14:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-12 14:38 [Qemu-devel] [PULL v2 0/4] Trivial patches for 6 to 12 April 2013 Stefan Hajnoczi
2013-04-12 14:38 ` [Qemu-devel] [PATCH 1/4] target-moxie: Fix VMState registration Stefan Hajnoczi
2013-04-12 14:38 ` Stefan Hajnoczi [this message]
2013-04-12 14:38 ` [Qemu-devel] [PATCH 3/4] Typo, spelling and grammatical fixes Stefan Hajnoczi
2013-04-12 14:38 ` [Qemu-devel] [PATCH 4/4] cpu-exec: Allow "-d exec" in non-debug builds (drop CONFIG_DEBUG_EXEC) Stefan Hajnoczi
2013-04-13 12:31 ` [Qemu-devel] [PULL v2 0/4] Trivial patches for 6 to 12 April 2013 Aurelien Jarno
  -- strict thread matches above, loose matches on Subject: below --
2013-04-12 12:23 [Qemu-devel] [PULL " Stefan Hajnoczi
2013-04-12 12:23 ` [Qemu-devel] [PATCH 2/4] linux-user: pass correct host flags to eventfd2 call Stefan Hajnoczi

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=1365777502-7035-3-git-send-email-stefanha@redhat.com \
    --to=stefanha@redhat.com \
    --cc=aliguori@us.ibm.com \
    --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).