From patchwork Mon Nov 6 13:37:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 118050 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp2776391qgn; Mon, 6 Nov 2017 05:38:51 -0800 (PST) X-Google-Smtp-Source: ABhQp+QdwHNzQ/2wboKdM9AAM+DqzAbRNMRpGb9Bx+GkkvLx9jtX3rZRbCJ3F3gwMHtrgio+7/mD X-Received: by 10.99.117.29 with SMTP id q29mr15541732pgc.61.1509975531734; Mon, 06 Nov 2017 05:38:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1509975531; cv=none; d=google.com; s=arc-20160816; b=g8Vo9WUlvS49vmDl2gBTozsYUDPLF/W+L38T8zJWCNAWYAXuR5vWHnBcMrLsgG3B95 9CoC7ApElztfy6VoHx3E99RzhUCuJZ9CnOQAIUuuyZnXr6B9rW92RrXUr3Gdvi7ZIAXf D2zI8fbV2QAj6a0Uuu2/BnBXHVvcijjytwijwuxzDorIK12anIAmHVo8X2oB6e0W1aXL lwg/WyF+9+ane7QQtzEgSg4XdAkUjgCXOYqjwjzsFQtSVS2ATZg8XykhHCvGey0ticqe Cw2XHh7ACaDLe2uRwrHa4dtzRO6Xku4aSSpf8xhxo/Yey2VrkxuCc5QLCAg/ObM0B1xj 74yg== 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:delivered-to :sender:list-help:list-post:list-archive:list-subscribe :list-unsubscribe:list-id:precedence:mailing-list:dkim-signature :domainkey-signature:arc-authentication-results; bh=33EK0PEZRpn5cnTeYV6UfjtzyU0oM/Hx806B8FL3c84=; b=BTdA94L4f5PWtGzRRqGrSOPa1w5KyGy/rKweNmk718WkMUptHyeIzc2cC1K9tA2IXU vmFj/1TWdYaF+BrHYZ2Qgu8D8kg0sG0MK9nLMQ7abZwj4912pPBXUjl0tJ/5QvyuNrFS dDmG1dCmbJMW+ma0OV70/a06tI6FLflni354kcpD0VR8kSaP0G39e6Mx3PwAWh3cT79+ QqNpKoWx4zn/v3h25TLO8PcLSJnlHzOe2XWgvxNPBZK7tMntk+rJCfvFikTHgRjYwx4L 0qH9+8z6il/p9EpIFStmh7FvXm5NPWeHiOGOkp0AvQq9YZKbSxCJ6PtePwrtMPd54hOl rK5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=r9J0eqcN; spf=pass (google.com: domain of libc-alpha-return-86799-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-86799-patch=linaro.org@sourceware.org; dmarc=fail (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 r7si9782902plo.348.2017.11.06.05.38.51 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Nov 2017 05:38:51 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-return-86799-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=r9J0eqcN; spf=pass (google.com: domain of libc-alpha-return-86799-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-86799-patch=linaro.org@sourceware.org; dmarc=fail (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=noo5K+LarLhWSV63EobKlOn0JVE5CDJ 9+l9lEL1tGbvdX/ZCCqeRJVwke2f1CAfrqIlrg04xRSZL9hD+fH72+JobGXjvPZ8 cLqHgLU6zteLH1n5tFtcMf/VKRIexO/amSIzLYfyeLKrnWD5oPo8jd8frKM3dlaW vO6D2WDitX1A= 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=GD1g3H4JCFDV2f2cIMoq4g26Hgc=; b=r9J0e qcNpzyQrQ1Fvrdz9mjrcy0JpIfXlnaUCJ3ntaf/ooOwyvHNVsQQj0+BKSzkJB4Gx FsrI42CrsrJh/AQRuxMK6CdAAPhQP1Hl1UlE/Y4y6uvS18myBVy2apJBZkKVpRam Xhj/lredlHNpG7tU+sHAr6HapwrPt9MPKPOVC0= Received: (qmail 34627 invoked by alias); 6 Nov 2017 13:37:29 -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 34557 invoked by uid 89); 6 Nov 2017 13:37:28 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.7 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-qk0-f196.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=33EK0PEZRpn5cnTeYV6UfjtzyU0oM/Hx806B8FL3c84=; b=QljWSewNQb4vnwWBkqxKWequih9FzANg6LEmDPqIrC+SOwsBjF3pKukctNw3M/+75U 30a+fqQR5TAwlNA4RzbFPFvjgNidTwTyKUt+BJfS3mYzpwMH07buvmdcOQV9EEjTFxT7 YBEsZwwOfhuP6d3pmNWHhizthbZDwHeqT74x29CesUnih9l9MSrMJ6++4mrGGOHXbDy0 zQEHqj3XMRvMXcERnD2/hBelbsvpUeDKMibXMQNIYKQBvkpWNL0u5MbcpToLELyaPGm+ sM36m6YCc6abam71PPiBm5E51uvKMt0h2ZM2Mn3ZCizArV4gzHb9ecPJOdOArVI4bQDk /FMA== X-Gm-Message-State: AJaThX5lM/mVpswHByQUEJN1Tc8tEKtPjVaGN/BInXo9QoE82ODbR+i7 0AdoCkYPdGEgr33/rWPTabFdtPKwkGw= X-Received: by 10.55.21.135 with SMTP id 7mr9966090qkv.216.1509975445293; Mon, 06 Nov 2017 05:37:25 -0800 (PST) From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH v2 8/8] Optimize sigrelse implementation Date: Mon, 6 Nov 2017 11:37:06 -0200 Message-Id: <1509975426-1772-8-git-send-email-adhemerval.zanella@linaro.org> In-Reply-To: <1509975426-1772-1-git-send-email-adhemerval.zanella@linaro.org> References: <1509975426-1772-1-git-send-email-adhemerval.zanella@linaro.org> This patch simplifies sighold a bit by removing an extra sigprocmask and using SIG_BLOCK (which union of the current set and the set argument). Checked on x86_64-linux-gnu. * signal/sighold.c (sighold): Optimize implementation. Signed-off-by: Adhemerval Zanella --- ChangeLog | 2 ++ signal/sigrelse.c | 12 +++--------- 2 files changed, 5 insertions(+), 9 deletions(-) -- 2.7.4 diff --git a/signal/sigrelse.c b/signal/sigrelse.c index e41c2bd..61f240b 100644 --- a/signal/sigrelse.c +++ b/signal/sigrelse.c @@ -26,14 +26,8 @@ sigrelse (int sig) { sigset_t set; - /* Retrieve current signal set. */ - if (__sigprocmask (SIG_SETMASK, NULL, &set) < 0) + sigemptyset (&set); + if (sigaddset (&set, sig) < 0) return -1; - - /* Remove the specified signal. */ - if (sigdelset (&set, sig) < 0) - return -1; - - /* Set the new mask. */ - return __sigprocmask (SIG_SETMASK, &set, NULL); + return __sigprocmask (SIG_UNBLOCK, &set, NULL); }