From patchwork Tue Dec 10 18:32:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 181145 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp6241523ile; Tue, 10 Dec 2019 10:32:50 -0800 (PST) X-Google-Smtp-Source: APXvYqyR4hGFVKdYXE3vXPs/LYLH+76GygEYV7FC+Y132oqCCQD0GLKrK6CAxuyujdR8L2qT28hc X-Received: by 2002:a05:6830:4a7:: with SMTP id l7mr25666482otd.372.1576002770210; Tue, 10 Dec 2019 10:32:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576002770; cv=none; d=google.com; s=arc-20160816; b=ql9K660dsk6rDRxra1TeCr7aALwLUFAF5MrbL7VMokwvqbcZxx1WycINP4EifYsUkA qYm8e5e/xY2qUMmg/ua5bNBxTlQkw3Lfo8Wr/hjh5dVDB82kg5xtJzy/x5qg9IxkToWp 3xG5liLzH8fvBf2f49ehzf23Egz9I4mXnnT7bLC7j3MRFHvoUNK7YdZlYIA7NLbzVMOF WmZJGeqFeN37avSv7Tz76CGRnbss75yqrUs9kw3TJEI1sFQdGwkzl1BZrULitW6PIWZQ x944+GJIM63bclt0EkY1ZkSSUl+nqWiAUnrBXYfcYTzGUgyzlymMImP/q+fU7fN8aa/i Ie4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:to:from :dkim-signature:delivered-to:sender:list-help:list-post:list-archive :list-subscribe:list-unsubscribe:list-id:precedence:mailing-list :dkim-signature:domainkey-signature; bh=MLojER/go87pkZ54n+gOkr5WyhYQUD/MekehsNYLQBI=; b=twDyk+7at2qzqgB0SkybpO6uv+liceCYmrquO4OXzhRlSBqMRzfaAIx005EzZ3DPZZ QaDWR0ezGscwkiyuVQBZOuB63xNRnstvkZ1qI2PMv01r09ITZHtM2UYNrqy2exl3QQwc ojRrN7rZNoenOuePNmQFXSs1sHpSnu2oymybLJir59KYxdjDmPw2vEjLXaSBzpGhOB92 wbAhlYTXbolPknZQMjZ1Yc6fIW5FRuM4bi2ROf3gLwG546czK2TJFu0cjEsN7s4MDTfZ 9iTS/wAiDLFHmAK3cpJhIilsSBl4jQine5AMBcnV1p7n2b/6c4lKNaoq8JVHJCHVGdbF fznQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=kmtZvj02; dkim=pass header.i=@linaro.org header.s=google header.b=kFRiS1Hd; spf=pass (google.com: domain of libc-alpha-return-107896-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-107896-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id v67si2328961oia.26.2019.12.10.10.32.50 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 10 Dec 2019 10:32:50 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-return-107896-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=kmtZvj02; dkim=pass header.i=@linaro.org header.s=google header.b=kFRiS1Hd; spf=pass (google.com: domain of libc-alpha-return-107896-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-107896-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=H/dHxsQ0EJqzrA3jsxboP4K7BnLLNwl RLS34dMzHDl4V09Rc0dXlLMPuc51oEO80kVelrCxjY7WZUO3iz9XAa1z+YWaj1sH FZH63KG79brVX8F2b1Zxw/EEBtXnWAzZkYMcpTMbVCjzsiXkqqMB+8RG9lXK8pla bGMLy/7F+MpA= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; s=default; bh=iNiUtOntKiBG0LsOfQABQQI4MJQ=; b=kmtZv j02KYQ55G5GK3tpKi2LTRxPkRu6zivW6JUMZ4OA7Y9Oe6sa4bjg/Gd2rx6JMapf0 noutXpiig77uhX2mbOFPh1cgYs5ozc/DdUvSdaBJPfsgKXMYTMlN8c8hW09Y3KE4 aN+JXIE01Lmk7WiNmHR5O87StFWwUgROhyRS28= Received: (qmail 39023 invoked by alias); 10 Dec 2019 18:32:31 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 38968 invoked by uid 89); 10 Dec 2019 18:32:31 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.7 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=5818, __val X-HELO: mail-vs1-f47.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=MLojER/go87pkZ54n+gOkr5WyhYQUD/MekehsNYLQBI=; b=kFRiS1HdRJpvXxJM7Oi24pzm3QVGDFm+GF0w0n0M4rpOcc3Ij5we72Kmbz87C1LSdc SCybTxpMy9+qKQ8wMpKafmDn9xmjjha9sMK1qBvmr0wP8Aoem/JaVCJ20dNttxDHv7tw jlYBHrL2gGIq5isZZtZnX5oVIC4+0BK7w6HMPO8nlwUD1PmFtYTVTjy/ZhSVaY3Py2M7 KNCceAa7jC3HgGc+FMHbb6MIEcyRRX1I823jG5LBb3vA8ev6I5PCY484PsBtXm7PIn5a IDC8ObScAC3Bvrc8+W1S2ZAjlWFEqm/JJtOvNb6a/DFMRcVSPuxlcYc5WFVAh8/YWT3J 544w== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 2/7] Add a constant data object for __libc_signal_block_app signal mask Date: Tue, 10 Dec 2019 15:32:16 -0300 Message-Id: <20191210183221.26912-2-adhemerval.zanella@linaro.org> In-Reply-To: <20191210183221.26912-1-adhemerval.zanella@linaro.org> References: <20191210183221.26912-1-adhemerval.zanella@linaro.org> It allows some minor optimization and less stack usage. Checked on x86_64-linux-gnu and i686-linux-gnu. --- sysdeps/unix/sysv/linux/internal-signals.h | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) -- 2.17.1 diff --git a/sysdeps/unix/sysv/linux/internal-signals.h b/sysdeps/unix/sysv/linux/internal-signals.h index a496c7174c..4b70109c14 100644 --- a/sysdeps/unix/sysv/linux/internal-signals.h +++ b/sysdeps/unix/sysv/linux/internal-signals.h @@ -58,6 +58,18 @@ static const sigset_t sigall_set = { .__val = {[0 ... _SIGSET_NWORDS-1 ] = -1 } }; +static const sigset_t sigapp_set = { +#if ULONG_MAX == 0xffffffff + .__val = { [0] = ~0UL & ~(__sigmask (SIGCANCEL)), + [1] = ~0UL & ~(__sigmask (SIGSETXID)), + [2 ... _SIGSET_NWORDS-1] = ~0UL } +#else + .__val = { [0] = ~0UL & ~(__sigmask (SIGCANCEL) + | __sigmask (SIGSETXID)), + [1 ... _SIGSET_NWORDS-1] = ~0UL } +#endif +}; + /* Block all signals, including internal glibc ones. */ static inline int __libc_signal_block_all (sigset_t *set) @@ -71,10 +83,8 @@ __libc_signal_block_all (sigset_t *set) static inline int __libc_signal_block_app (sigset_t *set) { - sigset_t allset = sigall_set; - __clear_internal_signals (&allset); INTERNAL_SYSCALL_DECL (err); - return INTERNAL_SYSCALL (rt_sigprocmask, err, 4, SIG_BLOCK, &allset, + return INTERNAL_SYSCALL (rt_sigprocmask, err, 4, SIG_BLOCK, &sigapp_set, set, _NSIG / 8); }