From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:58194) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UQd13-0000HL-Di for qemu-devel@nongnu.org; Fri, 12 Apr 2013 08:23:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UQd10-0003kV-GR for qemu-devel@nongnu.org; Fri, 12 Apr 2013 08:23:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:6657) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UQd10-0003kR-8j for qemu-devel@nongnu.org; Fri, 12 Apr 2013 08:23:38 -0400 From: Stefan Hajnoczi Date: Fri, 12 Apr 2013 14:23:29 +0200 Message-Id: <1365769411-2102-3-git-send-email-stefanha@redhat.com> In-Reply-To: <1365769411-2102-1-git-send-email-stefanha@redhat.com> References: <1365769411-2102-1-git-send-email-stefanha@redhat.com> Subject: [Qemu-devel] [PATCH 2/4] linux-user: pass correct host flags to eventfd2 call List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Anthony Liguori From: Petar Jovanovic 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 Reviewed-by: Peter Maydell Signed-off-by: Stefan Hajnoczi --- 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