From patchwork Sun Jun 10 03:02:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 138180 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp2618048lji; Sat, 9 Jun 2018 21:21:28 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKTnmhiYMbXqm9SjbmIpAAefvT+pNnEXmfFGCXBM6LGFAbNkKhIT28Px4pxu4yjBv4KfYi8 X-Received: by 2002:ac8:7159:: with SMTP id h25-v6mr11789754qtp.41.1528604488683; Sat, 09 Jun 2018 21:21:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528604488; cv=none; d=google.com; s=arc-20160816; b=zhBC0rjhgHbV5QbK8tKza37vm8V4GTLwi/RNrYnpZc5JxImg1SDeh3wYqu7yhRrrLw gPyi8Wgk9LqAtvSV3fcoLJFu37bqDmiznnVl14ac+IcSW8FaE+9Kh/f9oLZ6pGVXSEex E3Q3Np0r7eogneswze33p4F5AIRw++2LusgVL4kYw3VYbAbwPyhor+mMVijFA7aNaVtG JE7pIGf8qrh5PAvnqAc8+caCgK6ueeCOsenDyybBh6m91uaoRPBsWx1Ei2oNbdESDEDV aZvyuTVbKhVJIL3ic5yfKP9L0BmeZYz43NCaOl//G57SlHnwQ6bnaO4QLWGKsOjdt9KE /s2g== 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=9SHjCyudDplJJKhsvCL5EBrclmSvQ/P/jBgFLd2La54=; b=XtpYbz8Ww74dVe70ykKg63Kf4mFffLnXBqbfImNlBpEIiQYf6zlozns3A5fP0B/fSf mcqigqvUJzNOx34E0BXfr+EkSZBHA3bC2I06o+l3npE9F4uD3jCLl1GPY3Pn6i4V/Bk0 Z36c4AxD3F+TzkgGcj6BSHMp/D3yqH7FeFyG59oNtku8PPw+rXeKzlnYySS6ZWk9ENvw BHZJJg5gahuAiaZ54xJ/7VHy06H5dxdQ+Ypa3y6WQxMOnJQeftLXDzKgCNKAh1vYt268 J6LRl4hr+N6wfWEjYNnf5gqX2dx0uIOzX8eb+cAlYv7bc485lZR75KYsaGp9m38V01da lE1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=O6M+WlOg; 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 p50-v6si28711qtk.213.2018.06.09.21.21.28 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sat, 09 Jun 2018 21:21:28 -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=O6M+WlOg; 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]:42625 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fRrr6-0006Mx-7P for patch@linaro.org; Sun, 10 Jun 2018 00:21:28 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41493) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fRqfv-0004ZS-27 for qemu-devel@nongnu.org; Sat, 09 Jun 2018 23:05:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fRqft-0004js-Kd for qemu-devel@nongnu.org; Sat, 09 Jun 2018 23:05:51 -0400 Received: from mail-pf0-x244.google.com ([2607:f8b0:400e:c00::244]:46990) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fRqft-0004jh-E8 for qemu-devel@nongnu.org; Sat, 09 Jun 2018 23:05:49 -0400 Received: by mail-pf0-x244.google.com with SMTP id q1-v6so8483697pff.13 for ; Sat, 09 Jun 2018 20:05:49 -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=9SHjCyudDplJJKhsvCL5EBrclmSvQ/P/jBgFLd2La54=; b=O6M+WlOg5xkW0XLqP1xRprGNWgWHNyxjexYugV+yySEQvGEMko+CvYQd3JAdbcwoh+ QGSdOHr75/M3ON79kb291Ti6GC5Nyv1eKQ3VEGEWTxsnzz2Gri2fyv/jc2eu0NWZHlS2 3rmLinMsSMThHyr8wmNeveFZplQcscsUV4xcQ= 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=9SHjCyudDplJJKhsvCL5EBrclmSvQ/P/jBgFLd2La54=; b=oVG/w6WhRfMDjpCbbWvIoKTHa/zhz2JVw+OYn+Yf0Adtpk6yr1E6/2qpEBnmxIXWSh pI2/MJaBILrm3T1W/2IX/T+sl12lnVO5B4s80A71ImSqZRsf/tvqw0rFoniNsXTIoH3y o1TmGrsNa9HUVHz4m8k4vxZCMFUUUmAXE3CeSVoV2DLev187OeU8ITMZm6YQKLm8IsuM eaMr+tgfoqbUSfjECwOxVz1WTzrUiSA1xsoSQVR/DfIlHyx1WN1Ci4cU4nv5tD6EteN6 2+Eo1bI/G7CE1WMXMieo9aQXlLIUrT19sTLshU3UIbQKWy6mHQGZWQbTqcADF0fod2ih l9gg== X-Gm-Message-State: APt69E0tPpQF1dErOS94g6EDMJQxhPCiz0b+xEigotTe75islFX9rdpN FCfpq5zWt9CgXnllYJ0LAlatBYYNZaU= X-Received: by 2002:a65:4146:: with SMTP id x6-v6mr10426832pgp.221.1528599948291; Sat, 09 Jun 2018 20:05:48 -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.46 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 09 Jun 2018 20:05:47 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sat, 9 Jun 2018 17:02:11 -1000 Message-Id: <20180610030220.3777-100-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::244 Subject: [Qemu-devel] [PATCH v2 099/108] linux-user: Split out signalfd, signalfd4 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 signalfd4; remove the ifdefs. In do_signalfd4, unlock the target sigmask earlier and use is_error. Signed-off-by: Richard Henderson --- linux-user/syscall.c | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) -- 2.17.1 diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 5edcb39b73..e630a43f97 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -6975,8 +6975,6 @@ static abi_long host_to_target_statfs64(abi_ulong target_addr, } #endif -#if defined(TARGET_NR_signalfd) || defined(TARGET_NR_signalfd4) - /* signalfd siginfo conversion */ static void @@ -7045,21 +7043,17 @@ static abi_long do_signalfd4(int fd, abi_long mask, int flags) if (!lock_user_struct(VERIFY_READ, target_mask, mask, 1)) { return -TARGET_EFAULT; } - target_to_host_sigset(&host_mask, target_mask); + unlock_user_struct(target_mask, mask, 0); host_flags = target_to_host_bitmask(flags, fcntl_flags_tbl); ret = get_errno(signalfd(fd, &host_mask, host_flags)); - if (ret >= 0) { + if (!is_error(ret)) { fd_trans_register(ret, &target_signalfd_trans); } - - unlock_user_struct(target_mask, mask, 0); - return ret; } -#endif /* Map host to target signal numbers for the wait family of syscalls. Assume all other status bits are the same. */ @@ -11884,6 +11878,18 @@ IMPL(sigaltstack) return do_sigaltstack(arg1, arg2, get_sp_from_cpustate(cpu_env)); } +#ifdef TARGET_NR_signalfd +IMPL(signalfd) +{ + return do_signalfd4(arg1, arg2, 0); +} +#endif + +IMPL(signalfd4) +{ + return do_signalfd4(arg1, arg2, arg4); +} + #ifdef TARGET_NR_sigpending IMPL(sigpending) { @@ -12850,14 +12856,6 @@ static abi_long do_syscall1(void *cpu_env, unsigned num, abi_long arg1, abi_long ret; switch(num) { -#if defined(TARGET_NR_signalfd4) - case TARGET_NR_signalfd4: - return do_signalfd4(arg1, arg2, arg4); -#endif -#if defined(TARGET_NR_signalfd) - case TARGET_NR_signalfd: - return do_signalfd4(arg1, arg2, 0); -#endif #if defined(CONFIG_EPOLL) #if defined(TARGET_NR_epoll_create) case TARGET_NR_epoll_create: @@ -13808,6 +13806,10 @@ static impl_fn *syscall_table(unsigned num) SYSCALL(sigaction); #endif SYSCALL(sigaltstack); +#ifdef TARGET_NR_signalfd + SYSCALL(signalfd); +#endif + SYSCALL(signalfd4); #ifdef TARGET_NR_sigpending SYSCALL(sigpending); #endif