From patchwork Sun Jun 10 03:01:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 138122 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp2592814lji; Sat, 9 Jun 2018 20:37:06 -0700 (PDT) X-Google-Smtp-Source: ADUXVKI22NS3VdQHz1HGQfow+1fh3HHzsHkAF+ze3aiX66MiLP6LL0tzL/6xoancO4a8gAecErwq X-Received: by 2002:a37:f508:: with SMTP id l8-v6mr10233756qkk.434.1528601826773; Sat, 09 Jun 2018 20:37:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528601826; cv=none; d=google.com; s=arc-20160816; b=vQ1RCjW5GqinrKCB+sVQf2HOA04dwWnFZ0ZUWmA4Yq6dSCwy7FkyISvLG+kbuapCDH acqwbKKI75henBG0AlnfzX4t7rVCAnKACTXjl6h3dt9n0n8jsOD6oxGoSqsSKF2KbPkU 4X9YiJcpmH6U8V+k6HtncizTsjU/R73Pwe6iQx9Ru6wY8+QAi+sxGc7QWN/ZqVeCQM67 ZAp0zZx1fA092q3MazU2vB6HDszygURvwrzTo8qzR8xU/u4Oeu0Kzk05YnsxJpnFNo2k WbGCiZJ0fVhAclMOhvBYKt2qe5IU7U4BDiN0dM+HJOQCGJ96XT6K4+ROb/qXeNx4yWv0 G0wA== 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=kZiVKj8/cdfgXpzW3ZGZCU7l5FhYHkHiIZvXR8y2SAk=; b=m1xiVSTyxYxc0AEKJUoLreMTAC4LMmk29k4Wiatyst3V/onumiWc6D2hKOfr6IoFdb MaS4GXXLG+sEmGteQX6kRmujlK38/3cCzLcfvJhKWhNoKlQviOs4W9qbzx6vzVYR5W9S pObWdLiIdkC0f7W/kIlZOOLe2K7/ff1eCb8zHQWUVoZo2IMMSXYoHJde9dcXcSmvoNHz lMp3jJPzwOGwWUAauqRjTYUM0mokQGGOABRTQmqrNxiEAJ5C+fdgGCLVqoXfxQSXjV78 cbysnrO/+X15tAeE/3bUYpAT1T3q+pXK7btUAdUeExEKkicjmERQFvklg4kOYpJidtqh l8pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=YCGGipmQ; 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 x21-v6si4333139qtk.211.2018.06.09.20.37.06 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sat, 09 Jun 2018 20:37:06 -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=YCGGipmQ; 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]:42364 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fRrAA-0006oV-4k for patch@linaro.org; Sat, 09 Jun 2018 23:37:06 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40500) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fRqdm-0002Tl-Fx for qemu-devel@nongnu.org; Sat, 09 Jun 2018 23:03:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fRqdl-0003Wy-Al for qemu-devel@nongnu.org; Sat, 09 Jun 2018 23:03:38 -0400 Received: from mail-pg0-x243.google.com ([2607:f8b0:400e:c05::243]:40843) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fRqdl-0003Wg-2d for qemu-devel@nongnu.org; Sat, 09 Jun 2018 23:03:37 -0400 Received: by mail-pg0-x243.google.com with SMTP id l2-v6so8127521pgc.7 for ; Sat, 09 Jun 2018 20:03:36 -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=kZiVKj8/cdfgXpzW3ZGZCU7l5FhYHkHiIZvXR8y2SAk=; b=YCGGipmQat2J/HCX67HQX2KFBKqJMh0M2DLlKlI87MezEObE3WUWRd6i6kjpz+em+M nBj+aDlmE/nPI+y/B6maNcZLyMYzEFUavlXqzH/Hrw9SZSjlSVOsMi2Q9PNbFMkE+XrO YjCvvOC+hwGxv8QvOUNDSpCnoxUrtd6O72Zfg= 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=kZiVKj8/cdfgXpzW3ZGZCU7l5FhYHkHiIZvXR8y2SAk=; b=tnNy2rtjGC+bPQz97JEka1N1nd2HBJ9sjraBsn54Z+ukoTVujeLXOrXjKzIIg/V1Ks wTu73KIcV8F5EZcRDV6i4S3hREBPIIgCcs5tpLGyb/1njHXI9UGpuY+hwZ9RLNRAZN4D t/7T9vUDmIEfoL+w5/3s480Wgj6+hxtoGm/BxyYBX80xU+sOdo9R8DI/+2ZKEshPsV/p WWK3nVpr3ZTBM1vSursY19c9wLXhB0VlIie64ar8u1+QloP3tVVyzhA+zd1HreQH/5Lf yNT04WoHQ85v/7TsN9Bc1wcz6VGOIwsOyyQqAPoAax3ApiehilpAQqv+Mywu6cwx+sbY hTjQ== X-Gm-Message-State: APt69E1YP17rfzyzBtEyEcGHkoQX7U956oXOmis5dguAAq1R8S2hQyD6 67Kl66aMkseXhHqF7cWKnZ+Ms0bTZ78= X-Received: by 2002:a65:60d2:: with SMTP id r18-v6mr5029092pgv.306.1528599815828; Sat, 09 Jun 2018 20:03:35 -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.03.33 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 09 Jun 2018 20:03:35 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sat, 9 Jun 2018 17:01:04 -1000 Message-Id: <20180610030220.3777-33-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:c05::243 Subject: [Qemu-devel] [PATCH v2 032/108] linux-user: Split out rt_sigqueueinfo, rt_sigtimedwait, rt_tgsigqueueinfo 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" Signed-off-by: Richard Henderson --- linux-user/syscall.c | 129 ++++++++++++++++++++++--------------------- 1 file changed, 67 insertions(+), 62 deletions(-) -- 2.17.1 diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 6869a0db47..94dc773b4c 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -8768,6 +8768,20 @@ IMPL(rt_sigprocmask) return ret; } +IMPL(rt_sigqueueinfo) +{ + siginfo_t uinfo; + target_siginfo_t *p; + + p = lock_user(VERIFY_READ, arg3, sizeof(target_siginfo_t), 1); + if (!p) { + return -TARGET_EFAULT; + } + target_to_host_siginfo(&uinfo, p); + unlock_user(p, arg3, 0); + return get_errno(sys_rt_sigqueueinfo(arg1, arg2, &uinfo)); +} + IMPL(rt_sigsuspend) { CPUState *cpu = ENV_GET_CPU(cpu_env); @@ -8791,6 +8805,56 @@ IMPL(rt_sigsuspend) return ret; } +IMPL(rt_sigtimedwait) +{ + sigset_t set; + struct timespec uts, *puts = NULL; + void *p; + siginfo_t uinfo; + abi_long ret; + + if (arg4 != sizeof(target_sigset_t)) { + return -TARGET_EINVAL; + } + p = lock_user(VERIFY_READ, arg1, sizeof(target_sigset_t), 1); + if (!p) { + return -TARGET_EFAULT; + } + target_to_host_sigset(&set, p); + unlock_user(p, arg1, 0); + if (arg3) { + puts = &uts; + target_to_host_timespec(puts, arg3); + } + ret = get_errno(safe_rt_sigtimedwait(&set, &uinfo, puts, SIGSET_T_SIZE)); + if (!is_error(ret)) { + if (arg2) { + p = lock_user(VERIFY_WRITE, arg2, sizeof(target_siginfo_t), 0); + if (!p) { + return -TARGET_EFAULT; + } + host_to_target_siginfo(p, &uinfo); + unlock_user(p, arg2, sizeof(target_siginfo_t)); + } + ret = host_to_target_signal(ret); + } + return ret; +} + +IMPL(rt_tgsigqueueinfo) +{ + siginfo_t uinfo; + target_siginfo_t *p; + + p = lock_user(VERIFY_READ, arg4, sizeof(target_siginfo_t), 1); + if (!p) { + return -TARGET_EFAULT; + } + target_to_host_siginfo(&uinfo, p); + unlock_user(p, arg4, 0); + return get_errno(sys_rt_tgsigqueueinfo(arg1, arg2, arg3, &uinfo)); +} + #ifdef TARGET_NR_sgetmask IMPL(sgetmask) { @@ -9275,68 +9339,6 @@ static abi_long do_syscall1(void *cpu_env, unsigned num, abi_long arg1, void *p; switch(num) { - case TARGET_NR_rt_sigtimedwait: - { - sigset_t set; - struct timespec uts, *puts; - siginfo_t uinfo; - - if (arg4 != sizeof(target_sigset_t)) { - return -TARGET_EINVAL; - } - - if (!(p = lock_user(VERIFY_READ, arg1, sizeof(target_sigset_t), 1))) - return -TARGET_EFAULT; - target_to_host_sigset(&set, p); - unlock_user(p, arg1, 0); - if (arg3) { - puts = &uts; - target_to_host_timespec(puts, arg3); - } else { - puts = NULL; - } - ret = get_errno(safe_rt_sigtimedwait(&set, &uinfo, puts, - SIGSET_T_SIZE)); - if (!is_error(ret)) { - if (arg2) { - p = lock_user(VERIFY_WRITE, arg2, sizeof(target_siginfo_t), - 0); - if (!p) { - return -TARGET_EFAULT; - } - host_to_target_siginfo(p, &uinfo); - unlock_user(p, arg2, sizeof(target_siginfo_t)); - } - ret = host_to_target_signal(ret); - } - } - return ret; - case TARGET_NR_rt_sigqueueinfo: - { - siginfo_t uinfo; - - p = lock_user(VERIFY_READ, arg3, sizeof(target_siginfo_t), 1); - if (!p) { - return -TARGET_EFAULT; - } - target_to_host_siginfo(&uinfo, p); - unlock_user(p, arg3, 0); - ret = get_errno(sys_rt_sigqueueinfo(arg1, arg2, &uinfo)); - } - return ret; - case TARGET_NR_rt_tgsigqueueinfo: - { - siginfo_t uinfo; - - p = lock_user(VERIFY_READ, arg4, sizeof(target_siginfo_t), 1); - if (!p) { - return -TARGET_EFAULT; - } - target_to_host_siginfo(&uinfo, p); - unlock_user(p, arg4, 0); - ret = get_errno(sys_rt_tgsigqueueinfo(arg1, arg2, arg3, &uinfo)); - } - return ret; #ifdef TARGET_NR_sigreturn case TARGET_NR_sigreturn: if (block_signals()) { @@ -12775,7 +12777,10 @@ static impl_fn *syscall_table(unsigned num) SYSCALL(rt_sigaction); SYSCALL(rt_sigpending); SYSCALL(rt_sigprocmask); + SYSCALL(rt_sigqueueinfo); SYSCALL(rt_sigsuspend); + SYSCALL(rt_sigtimedwait); + SYSCALL(rt_tgsigqueueinfo); #ifdef TARGET_NR_sgetmask SYSCALL(sgetmask); #endif