From patchwork Fri Apr 12 12:23:29 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 236075 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id C627D2C00AA for ; Fri, 12 Apr 2013 22:25:14 +1000 (EST) Received: from localhost ([::1]:59633 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UQd2W-0002Lp-RC for incoming@patchwork.ozlabs.org; Fri, 12 Apr 2013 08:25:12 -0400 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 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r3CCNbDG025423 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 12 Apr 2013 08:23:37 -0400 Received: from localhost (ovpn-112-42.ams2.redhat.com [10.36.112.42]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r3CCNa6C031153; Fri, 12 Apr 2013 08:23:37 -0400 From: Stefan Hajnoczi To: 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> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Anthony Liguori Subject: [Qemu-devel] [PATCH 2/4] linux-user: pass correct host flags to eventfd2 call X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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)