From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:38680) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UQf7Y-0003tS-AS for qemu-devel@nongnu.org; Fri, 12 Apr 2013 10:38:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UQf7V-0004M7-3t for qemu-devel@nongnu.org; Fri, 12 Apr 2013 10:38:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:22763) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UQf7U-0004Ly-TF for qemu-devel@nongnu.org; Fri, 12 Apr 2013 10:38:29 -0400 From: Stefan Hajnoczi Date: Fri, 12 Apr 2013 16:38:20 +0200 Message-Id: <1365777502-7035-3-git-send-email-stefanha@redhat.com> In-Reply-To: <1365777502-7035-1-git-send-email-stefanha@redhat.com> References: <1365777502-7035-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