From patchwork Fri Jun 1 07:30:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 137490 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp622079lji; Fri, 1 Jun 2018 00:56:56 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKAxNuIznAZGThn+QzvxMm/LX2r3SG1NBFVTYKhBi68ZkVzcu4poM/kWHBovAKJsno6Q+mq X-Received: by 2002:ac8:297b:: with SMTP id z56-v6mr9475928qtz.387.1527839816564; Fri, 01 Jun 2018 00:56:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527839816; cv=none; d=google.com; s=arc-20160816; b=xPnOv2VpEhs7joCygKFjngCiarBSBQ5RetOtUC3wbsXJjYyxhgr1+sOE8BUQH3Wq5/ VrYLKYrhasSrbIp44SORt2KdlxqWVZKUMKhksyvtOayf5ri9+qLPsaBODKw5OWQPEXCu 6ZRkMTkBz5AvFkrNy1qezuVnIOIZ/U8ymTS3cZ95Ec7UQqI5sf42vaQLb+uqcHndUHOC TSTfQRvXK+3mhyDnEZ4nwtZQt/2fZtd4U3w0YlnouxIMBdY01utsD7JpsnN10n5HxaIt K3dUT7jdguhgoHhOMfeGpmGwS4Pxs2+vZ1GwMfOarFRufhDrenXbkuD5TOhj290qyrA/ 8rig== 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=GTf9MSiiJ4Qqy1WwqDmsIQJpuZBlo7vT5dRWz1aobAY=; b=repVkKldDH083I2R1i4xF0O6kUGsdUbVjszNjJ6q3p3DA1OXB0ni6eslkdAIpVRYI7 O/cUd0xh+1wcCL0V9hvMhufq1+pCIIWmQuIt3Dso3S+Qu5fI87IO6UF2bWgxRPPGlRrz qKgvOtKlj3u7wsivpIqD9i/Veg6+fed0BKKIlXW+Or/CqtXGMVMaAaM521VrfxgBYWo9 zbcbROavGYnKhQrbwcNyFTFQARW7HyJfCzT8Amfh7sSq49RsStY7iZgYuuXFJcLu9kWn 0wzoTFqoAx1PL32a3PcIsS7VutWqo44F0BekaHmtshUr76lZiE/YjdYK3tAtdKdoCvMQ C5kg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Cxn2ujVI; 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 e21-v6si501762qtp.63.2018.06.01.00.56.56 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 01 Jun 2018 00:56:56 -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=Cxn2ujVI; 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]:47941 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fOevf-0007qY-Ui for patch@linaro.org; Fri, 01 Jun 2018 03:56:56 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57759) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fOeXH-0005ye-MP for qemu-devel@nongnu.org; Fri, 01 Jun 2018 03:31:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fOeXF-0000vD-RL for qemu-devel@nongnu.org; Fri, 01 Jun 2018 03:31:42 -0400 Received: from mail-pf0-x241.google.com ([2607:f8b0:400e:c00::241]:37620) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fOeXF-0000uX-Id for qemu-devel@nongnu.org; Fri, 01 Jun 2018 03:31:41 -0400 Received: by mail-pf0-x241.google.com with SMTP id e9-v6so12083458pfi.4 for ; Fri, 01 Jun 2018 00:31:41 -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=GTf9MSiiJ4Qqy1WwqDmsIQJpuZBlo7vT5dRWz1aobAY=; b=Cxn2ujVIq38XK8o+y3/QwS8C535jNklmwc9oeIgs7yYa0iS3WRPHh6bVuJFbFGh6uK xBMWbsSmLbPTPSv1SAxaYMKtqS6HHQE7eJ/vgSXJM20iBMsv/R2yWBGy/ojVnlWRHxOs Bdv9ZLmcB63p4GMZ74C7eq0KpuCWMhUfMKmm8= 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=GTf9MSiiJ4Qqy1WwqDmsIQJpuZBlo7vT5dRWz1aobAY=; b=RQZEWNVpoQK5+Cbu9Mu9h82frRRVz0FqefQ6rmh/qZm3Z9x0pMrMu9kyL2YnkhsIWz 0lmisBhN1MRXv0HixFo2u7/Txx9DPY4kIv02PdRa68QQaZbgzU49/RgSvn0XMeRRgPAe peHt+ffoDjulrxtGoArlNjvK72e7DROWe3yeHtUsVQT6dYmqlBmG3Tg0qvpDVj32TqPH KD08gkVjT+Op0qN8xRVPldHvyERRlF3wOi72Ay0CVbjniDvkGQdgk176lxJanxSQ9nyX BL6DYliuu2FcaJZ+ykaf7+T24/r0W+wP1x+1cGZslKlDxxL8SjOlR7sqYlFWbcohpJ9W XyOw== X-Gm-Message-State: ALKqPweI17dgPrkuydGYbMIhIXL6CEnSjHqFd2PvUK4KORoIV2yUQdX6 /p45n6A6P9Z4WtJk8YDzJLl6ElmWsSU= X-Received: by 2002:a63:87c8:: with SMTP id i191-v6mr8094575pge.124.1527838300376; Fri, 01 Jun 2018 00:31:40 -0700 (PDT) Received: from cloudburst.twiddle.net (97-126-112-211.tukw.qwest.net. [97.126.112.211]) by smtp.gmail.com with ESMTPSA id c4-v6sm4431782pgv.86.2018.06.01.00.31.39 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 01 Jun 2018 00:31:39 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 1 Jun 2018 00:30:50 -0700 Message-Id: <20180601073050.8054-34-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180601073050.8054-1-richard.henderson@linaro.org> References: <20180601073050.8054-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::241 Subject: [Qemu-devel] [PATCH 33/33] 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.0 diff --git a/linux-user/syscall.c b/linux-user/syscall.c index c3bd625965..b9e07c2d3f 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -8876,6 +8876,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); @@ -8899,6 +8913,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) { @@ -9393,68 +9457,6 @@ IMPL(everything_else) char *fn; 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()) { @@ -13132,7 +13134,10 @@ static impl_fn * const syscall_table[] = { [TARGET_NR_rt_sigaction] = impl_rt_sigaction, [TARGET_NR_rt_sigpending] = impl_rt_sigpending, [TARGET_NR_rt_sigprocmask] = impl_rt_sigprocmask, + [TARGET_NR_rt_sigqueueinfo] = impl_rt_sigqueueinfo, [TARGET_NR_rt_sigsuspend] = impl_rt_sigsuspend, + [TARGET_NR_rt_sigtimedwait] = impl_rt_sigtimedwait, + [TARGET_NR_rt_tgsigqueueinfo] = impl_rt_tgsigqueueinfo, #ifdef TARGET_NR_sgetmask [TARGET_NR_sgetmask] = impl_sgetmask, #endif