From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:54231) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UPGoj-0000bf-Ag for qemu-devel@nongnu.org; Mon, 08 Apr 2013 14:29:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UPGod-0003cU-Bs for qemu-devel@nongnu.org; Mon, 08 Apr 2013 14:29:21 -0400 Received: from mail.rt-rk.ftn.uns.ac.rs ([147.91.177.140]:33231 helo=mail.rt-rk.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UPGod-0003Wa-5V for qemu-devel@nongnu.org; Mon, 08 Apr 2013 14:29:15 -0400 Received: from mail.rt-rk.com (mail.localdomain [127.0.0.1]) by mail.rt-rk.com (Postfix) with SMTP id CBC1C25BC31 for ; Mon, 8 Apr 2013 20:29:11 +0200 (CEST) From: Petar Jovanovic Date: Mon, 8 Apr 2013 20:26:10 +0200 Message-Id: <1365445570-112217-1-git-send-email-petar.jovanovic@rt-rk.com> Subject: [Qemu-devel] [PATCH] 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: qemu-trivial@nongnu.org, riku.voipio@linaro.org, petar.jovanovic@imgtec.com, 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 --- 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.7.9.5