From patchwork Fri Nov 3 21:40:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 117965 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp214322qgn; Fri, 3 Nov 2017 14:42:06 -0700 (PDT) X-Google-Smtp-Source: ABhQp+TJPB804CZwR2S0JGGkFIIHG50JpLFb+zyoERfAJDV9YjtxPCp1R6rXlVS7hWisu6cRE1DI X-Received: by 10.84.236.12 with SMTP id q12mr7941213plk.314.1509745326714; Fri, 03 Nov 2017 14:42:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509745326; cv=none; d=google.com; s=arc-20160816; b=HbxczTo9l/acfdOX+N4a0JMjyy8PffOms+pasHFr7b627RvSrwOqUVAx9gqd60c1Mf d6YQZJIk4ha1N0HxoPFRXOkq8kWi3tUAAuUcgpPxRgtuAzyJI0kOePJaurXcMu1ksNvq t6Pfw6BAINifqVj2Qyytw0mBnDmcWs3wQ+400CJqg/9nwAZMtuX4V5Jp74St2FmECjyo Qx6Vn9/Ka8SKvYcVpCwinan2/Km1GB+r1V8b27egqXDso9chCNwdnQaUYgPGONwYxYjq ktgmVpVw7Pevy5ewnTUz1ceCrhL/hT82RQT+KlwVb6oP85uIO+NDOix+wfA4OdYoEdBS F44Q== 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=3l7+yspJC4LaeFVnz2D5Rmamb0AtBF407lwLW2BX6M8=; b=mfIooScLY5fCGy+T79P1+KIceZyyLUAA4GNyMguE1UHrZ+8fxKuFohVMcXCP7N9cnL xHOHiyKAllDSjnk8PXJ+zv0it5S7JQnX/cbltjdzL2nlko3FthLpQzQrrW3lPpt2R5VV iVuATZoONO1/kK4o/Vl2hBjD2dUZl6gvVxdRfxbqKhUWyhMjakdWMkhxcNmDRX/uXXzU Z5/NyXKpQxpxIc/9qc/Xc16iinpopWM4VVDEs5iMQ6g8xEsonUHaRfZxEoG30cCCNDOf XLUX3koJaUlJjTWLR0EXfSUk87SUweClyVQ2esf5wFu5zISOuLPkZuECEGBpwSgUEjuu Ak9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=LTXFSCUB; spf=pass (google.com: domain of libc-alpha-return-86730-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-86730-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 h128si7298381pfb.121.2017.11.03.14.42.06 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 Nov 2017 14:42:06 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-86730-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=LTXFSCUB; spf=pass (google.com: domain of libc-alpha-return-86730-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-86730-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=kqUzIcqiJjbBtx0xDRE4GnB2tmbiHaw 1JqaEwbejV/VACk9CN4SIR9jPApEjxdRC0KCZeN6AFq8hjZmCBANevmFYtBKXn4w RDjFfYmlDDbXJweHlhUrXYNTGQz5QB5SjlzkyFeuuvUCDnt0cQuOrrAvLXvoNVPk hDPSnHyxQRn4= 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=qw97PcsGyWzGFZye5I9wJ3/Z5fk=; b=LTXFS CUB+VN0IpiDtcvm1s1XlPg9mtqZQzh3pOL1pGGUWlhE/4f+CbPKYEoQx+GVvBqla jZb0WhYtMlyqn2PbCxsukam5si7opZy20Kym6TTpkpNMnWyh7EpWMWfvLpEJXv22 EXDmWmaGODQjgJW7C230lvW8g+oiKkf/V6dEyA= Received: (qmail 38168 invoked by alias); 3 Nov 2017 21:41:07 -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 38114 invoked by uid 89); 3 Nov 2017 21:41:06 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.4 required=5.0 tests=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-qt0-f193.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=3l7+yspJC4LaeFVnz2D5Rmamb0AtBF407lwLW2BX6M8=; b=ZJd9xtdbAhasJ9+kUAurL+MAAq05ySzrTTHZL5civQbcZIbQ0Fb62+cli6kBNDcQGP /dpaLGPhqOJDkuxi0ieigCCLz0chjmpqRG2RdenFSKnoN0brcBBm3/3ms//3B9+sMfeg HaSbdc2Hb9HlPuD3LZQIyz7/wSZNBJ3gkfV8FixNYaP/fg7fVlvSxUO0txMK3tF6rdJb 86clDcaOP8i7OTa2P/b8IDmDhIEfdJ3IUYKIUymafLkU8s2ccfyB14Al9XFvF2d9SYuB ktHGaQVGSfMRHiYp5hYkQ9zLrSfGXstMu5lJeWpTSkP6Ott8T+0ymHV/U477+VaHpszb 1udg== X-Gm-Message-State: AMCzsaXcYgmxwq7QNMwM5pnkQVZ8namjadWSWz7cMUHFTGhQMu038HmA rmAtPRl+0ns/nM8H9OabzQHcOMQNPZg= X-Received: by 10.237.36.130 with SMTP id t2mr12124575qtc.148.1509745263776; Fri, 03 Nov 2017 14:41:03 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 5/6] Optimize sighold implementation Date: Fri, 3 Nov 2017 19:40:48 -0200 Message-Id: <1509745249-11404-5-git-send-email-adhemerval.zanella@linaro.org> In-Reply-To: <1509745249-11404-1-git-send-email-adhemerval.zanella@linaro.org> References: <1509745249-11404-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/sighold.c | 10 ++-------- 2 files changed, 4 insertions(+), 8 deletions(-) -- 2.7.4 diff --git a/signal/sighold.c b/signal/sighold.c index 2e32e47..955ac5b 100644 --- a/signal/sighold.c +++ b/signal/sighold.c @@ -26,14 +26,8 @@ sighold (int sig) { sigset_t set; - /* Retrieve current signal set. */ - if (__sigprocmask (SIG_SETMASK, NULL, &set) < 0) - return -1; - - /* Add the specified signal. */ + sigemptyset (&set); if (sigaddset (&set, sig) < 0) return -1; - - /* Set the new mask. */ - return __sigprocmask (SIG_SETMASK, &set, NULL); + return __sigprocmask (SIG_BLOCK, &set, NULL); }