From patchwork Sun Jun 10 03:02:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 138179 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp2617319lji; Sat, 9 Jun 2018 21:20:12 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKFTss6y+IhKOg/RayOiA/3yae6u1cwhttQEQOt2ypgklRU82NknDtZzfqOxkJBOmMDtilg X-Received: by 2002:a37:e102:: with SMTP id c2-v6mr10118098qkm.18.1528604412339; Sat, 09 Jun 2018 21:20:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528604412; cv=none; d=google.com; s=arc-20160816; b=bMX3CaSixfybEuf+nxhD2biGoFPMiMEmamO2DBCBLdHVr1iuPkl+RW/v4gswYAYV3Z 4YYTgPe4z6LPtk65/GfmI3kWpcrpbsfRmfaX/Az80n8V+qfiprUD6R5rQ9xlzJq41N95 VlYCxDxK1QmPLtUvYLr9DVgzFfqL0ZRgOCcPMXjN5uFrg+hpCxRAzBBcaJtQJFOfpWEk 7PUVmzexDqGSUqDtT93w9M/h5xle5g+NpyZCNFeZhlsewK/Lg3RbkptAWacKIbFy76P+ ymmi1KLGloj4oK1IRIxHKZPymLWsZkfXrp2cpsWFcBubV2omFQ+YoKz5a2SzQNcZKpqa 8/aA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=+vtsSTxRB60MNVp1ZyA7bfX5Ze3pHyo+t2dzlL0HpHg=; b=Ss7XhMyjFJrchlWfnEfdtg0PqhtU0uP37ieheMVLSaQhwaa1aHZG3mUj2nwos95O9n hPk93EoiygcdEhzkV8FKwbSD/IUj+EzsAGVSD4y7xODWujQU3WiCiMMaG1QilkPKjx2+ flm61jNyuO3VhRXaW3Rl38mcXBsF2BzhucQcmNa/mgQa3w4QCSb0PSRO4rwFrIQygJdG QL+uye9z327OiutqU+9afTsqbGG1gSfgjY6huG2aJTe2O0kkIhcqjHqI/It+E+uxacqu 55wmOaHXSkzkQC+XKvusf2PsZ34GJVJEJ0C/1R5QfBf2v2nQiyMf099QP2LJt34fx3A2 GEdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=PA6bi8eV; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id e67-v6si3687458qkd.66.2018.06.09.21.20.12 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sat, 09 Jun 2018 21:20:12 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=PA6bi8eV; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:42609 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fRrpr-000509-SD for patch@linaro.org; Sun, 10 Jun 2018 00:20:11 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41456) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fRqfr-0004Vf-F7 for qemu-devel@nongnu.org; Sat, 09 Jun 2018 23:05:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fRqfq-0004iR-Cy for qemu-devel@nongnu.org; Sat, 09 Jun 2018 23:05:47 -0400 Received: from mail-pf0-x243.google.com ([2607:f8b0:400e:c00::243]:45645) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fRqfq-0004i9-6A for qemu-devel@nongnu.org; Sat, 09 Jun 2018 23:05:46 -0400 Received: by mail-pf0-x243.google.com with SMTP id a22-v6so8480880pfo.12 for ; Sat, 09 Jun 2018 20:05:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=+vtsSTxRB60MNVp1ZyA7bfX5Ze3pHyo+t2dzlL0HpHg=; b=PA6bi8eVCF4ArxTp5mrE59+zpCWOPzh6dobduWMVsXuGTDKeUPzGZzOxaBE1PSYi1F qeNHTrBs8gSZUqfmm04e8LCAwY66Jt0RUVBFxVktIFf/f+j88dj7bF7SRcMvxxqJF+YF R2zWoIMQKquQkQE6KlT/mMTjSeLAocpQGB9cE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=+vtsSTxRB60MNVp1ZyA7bfX5Ze3pHyo+t2dzlL0HpHg=; b=nCJb8tw723bf7zyJArjH5HTFVPStOBDzJgosC5U9F1tXPxbyDjRLEWkIkH3BBfgLBz 6CWkRvNY/XFaTDEw4auGxQtTC2XW1uN1mMluvps+yqGMs3fISGxlrhDMKrCvW8QdgHXz 7Y9EeLh7OdsIXnEtTWTRDxx4wIJyTms8UW36+0lLViMZ4PJyPs7UunKo1SYfu6ybBZgE M3jeHvitcN9jjCn+OiFVrXs6n8SJb1Hsy74ZLDPHAA8aHe7G72w35Rjp1bGkRR7ihXWY 9OqekpTje0m0i4LQJQ/Od+7cW1RIfOoQ/QOQ0+bBBH+VofMXTXd7XSXOxT++WGTR/ikM ZQeA== X-Gm-Message-State: APt69E0b1YKM1XxOkvaWYQqpb0Y65oe2RfUCkT+kYVaNJ+jZ3aNPfe9H WRqI0lctJuxFa37sMp73ACGmtgNbWis= X-Received: by 2002:a62:5c06:: with SMTP id q6-v6mr12205885pfb.118.1528599944880; Sat, 09 Jun 2018 20:05:44 -0700 (PDT) Received: from cloudburst.twiddle.net (rrcs-173-198-77-219.west.biz.rr.com. [173.198.77.219]) by smtp.gmail.com with ESMTPSA id y17-v6sm31712718pfe.33.2018.06.09.20.05.43 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 09 Jun 2018 20:05:44 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sat, 9 Jun 2018 17:02:09 -1000 Message-Id: <20180610030220.3777-98-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180610030220.3777-1-richard.henderson@linaro.org> References: <20180610030220.3777-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c00::243 Subject: [Qemu-devel] [PATCH v2 097/108] linux-user: Split out eventfd, eventfd2 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: laurent@vivier.eu Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" All targets define eventfd2; remove the ifdefs. Signed-off-by: Richard Henderson --- linux-user/syscall.c | 64 +++++++++++++++++++++++++------------------- 1 file changed, 37 insertions(+), 27 deletions(-) -- 2.17.1 diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 8548f113d1..1158afde27 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -7903,6 +7903,37 @@ IMPL(dup3) return ret; } +#ifdef CONFIG_EVENTFD +# ifdef TARGET_NR_eventfd +IMPL(eventfd) +{ + abi_long ret = get_errno(eventfd(arg1, 0)); + if (ret >= 0) { + fd_trans_register(ret, &target_eventfd_trans); + } + return ret; +} +# endif + +IMPL(eventfd2) +{ + int host_flags = arg2 & (~(TARGET_O_NONBLOCK | TARGET_O_CLOEXEC)); + abi_long ret; + + 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)); + if (ret >= 0) { + fd_trans_register(ret, &target_eventfd_trans); + } + return ret; +} +#endif /* CONFIG_EVENTFD */ + IMPL(execve) { abi_ulong *guest_ptrs; @@ -12767,33 +12798,6 @@ static abi_long do_syscall1(void *cpu_env, unsigned num, abi_long arg1, abi_long ret; switch(num) { -#ifdef CONFIG_EVENTFD -#if defined(TARGET_NR_eventfd) - case TARGET_NR_eventfd: - ret = get_errno(eventfd(arg1, 0)); - if (ret >= 0) { - fd_trans_register(ret, &target_eventfd_trans); - } - return ret; -#endif -#if defined(TARGET_NR_eventfd2) - case TARGET_NR_eventfd2: - { - 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)); - if (ret >= 0) { - fd_trans_register(ret, &target_eventfd_trans); - } - return ret; - } -#endif -#endif /* CONFIG_EVENTFD */ #if defined(CONFIG_FALLOCATE) && defined(TARGET_NR_fallocate) case TARGET_NR_fallocate: #if TARGET_ABI_BITS == 32 @@ -13314,6 +13318,12 @@ static impl_fn *syscall_table(unsigned num) SYSCALL(dup2); #endif SYSCALL(dup3); +#ifdef CONFIG_EVENTFD +# ifdef TARGET_NR_eventfd + SYSCALL(eventfd); +# endif + SYSCALL(eventfd2); +#endif SYSCALL(execve); SYSCALL(exit); #ifdef __NR_exit_group