From patchwork Mon Nov 6 13:37:05 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: 118049 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp2776263qgn; Mon, 6 Nov 2017 05:38:41 -0800 (PST) X-Google-Smtp-Source: ABhQp+REHEH2lob4prRp3DyGyf/V9duyajZJH9glVjcfCVp6MJ0ig3Lz1uworToqRlgcQb6lP5I6 X-Received: by 10.98.56.204 with SMTP id f195mr17022843pfa.188.1509975521441; Mon, 06 Nov 2017 05:38:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1509975521; cv=none; d=google.com; s=arc-20160816; b=nDa4tFihXRysH5bajVVmlvHsOVwaIYVIyPHAggtBKu5cyFIftK3vASG/FurygDGykt xVAJZO7rSck+ZMbkDlkI6AnKGXBE5XeCiVVSqop+99oJX/YK78droqF/E8un0wL13l26 hOP6t4NxoCqZ74VkqaYn1Mrw8M6hzxGRs4prglJZrujg3yXK+PSc+rYwAFpIZZjmZoBw WAwnLf/N3oT6ckJc6AszukN16evm3bToTO/2VuAuM2UgJoT8f7sri5GvymbuZy1tflFx Y0V8U36/klw3WRHSFLnJAFmkI5BpV794BbN2L0BjQSbc40ovVQn8u4PMKrfkGQ51pIBa ekFA== 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=b7wXfSr7SeNsv9K+Zmic9yzAhi92y+B+49e0AmSLZuc=; b=gnq2/KlrwbIaJhOUL3hnBtRdwB6wzP5ndVSWU3gGlU3QYGEeRLyPLiuftXtYAxKQe1 1niNBsE4iNZFhwCanVx+OPMap834Jdub/qBRjaHNYtgznvSOH+ggk2NprSjVGCqmn5K+ JSTtehoxWvanCyWgEtyfGrvN+R/qmStl1ilunfmbOUJ+i5wKAchE0083LSow89wcBqFu uvTJrbzJuyznLKGZnKSJdwkymSQq6gDxRCFaOo7fB8PkosNMUEt/SGfRTW5TaPff5T7e QoYEVsiANpp8kpRL2aQQiRHxy7/+HoVKEoo65AGRIo4wtMB+5HQD+/ZO22L6jELd5Htj 8shw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=PzTSB52P; spf=pass (google.com: domain of libc-alpha-return-86798-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-86798-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 w6si11116641pgb.291.2017.11.06.05.38.41 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Nov 2017 05:38:41 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-return-86798-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=PzTSB52P; spf=pass (google.com: domain of libc-alpha-return-86798-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-86798-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=MonwHCa0hxJ2k8MCP++kmttKOs+5+pq DZRrYUl/XMJf4cIPoqgaCz9CKYR19jZ6A+qn/kXFaJxRmgHfBn1fqM2ouF4I88RO m3V4T4CI7qIdWksy8BdKO0CQDZa6seVoJJ0HbUhkOb47hsdS2yDcjpcKQsQpA5Pu lXDjbWWBRKOw= 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=xsuoJKdQzFbZwZ3RgeXmVKfA1ME=; b=PzTSB 52PFKTjFlGxRobSKpYV/+sOU3/TI1UA1+wTXwMvwzYthDUwRWTzGIPnB6u5uWTL8 TVUMTz/oJEi3y4XbgVf45encARS6B07ZiBCCo5WJ/upKTB4s269QYCOYY5xYgYc2 m+6ow0BjbEO9AI8NFCJeika5/XcmlMEHrRCel8= Received: (qmail 34467 invoked by alias); 6 Nov 2017 13:37:28 -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 34351 invoked by uid 89); 6 Nov 2017 13:37:27 -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=arrive 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=b7wXfSr7SeNsv9K+Zmic9yzAhi92y+B+49e0AmSLZuc=; b=unc8ftWEPx3CjVnVpoyo5L/2GRpU5nqqMOtvV/1ILSjobVDrE0A9mVqUjFrLL382rp GQHgJrYQCiDLDmHeVoz7CQQbWyfL9/5aOejv9gbYTaEVVm5XwhsUr9oiVDd39PimXgZE okRIhdoYls8QQMtBZvG2OOV8HflZV0v7tLA0DUqrElwd0P37EaPp1nRR4Q7B+IFT9f1T MdabqFNzytPxU1/71B5OZQk+DHlIsiQSJrtKfok+7ChPFVNBxgf1yccES4h6W51Ubqca /pRNxa6Pz7XxN2XcpdRIvF99rcGirMpd3em5L8PqWOjedv9eMDRUuIbS5k+JveJPAkZn zP+g== X-Gm-Message-State: AJaThX5IZlCm+LJ2gKkRdQJRGWRnwIoC6CyxhS7HwneHdGpJhs5SA5e+ QOGRXHXsgJIwnQcbnHugKM5RXtpgf4I= X-Received: by 10.55.5.139 with SMTP id 133mr915685qkf.220.1509975443929; Mon, 06 Nov 2017 05:37:23 -0800 (PST) From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH v2 7/8] Cleanup sigpause implementation Date: Mon, 6 Nov 2017 11:37:05 -0200 Message-Id: <1509975426-1772-7-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 simplify sigpause by remobing the single thread optimization since it will be handled already by the __sigsuspend call. Checked on x86_64-linux-gnu. * sysdeps/posix/sigpause.c (do_sigpause): Remove. (__sigpause): Rely on __sigsuspend to implement single thread optimization. Add LIBC_CANCEL_HANDLED for cancellation marking. Signed-off-by: Adhemerval Zanella Reviewed-by: Zack Weinberg --- ChangeLog | 4 ++++ sysdeps/posix/sigpause.c | 26 ++++++-------------------- 2 files changed, 10 insertions(+), 20 deletions(-) -- 2.7.4 diff --git a/sysdeps/posix/sigpause.c b/sysdeps/posix/sigpause.c index 9038ed3..a61e056 100644 --- a/sysdeps/posix/sigpause.c +++ b/sysdeps/posix/sigpause.c @@ -19,15 +19,13 @@ #include #include #include /* For NULL. */ -#include #undef sigpause #include +#include -/* Set the mask of blocked signals to MASK, - wait for a signal to arrive, and then restore the mask. */ -static int -do_sigpause (int sig_or_mask, int is_sig) +int +__sigpause (int sig_or_mask, int is_sig) { sigset_t set; @@ -46,21 +44,6 @@ do_sigpause (int sig_or_mask, int is_sig) to do anything here. */ return __sigsuspend (&set); } - -int -__sigpause (int sig_or_mask, int is_sig) -{ - if (SINGLE_THREAD_P) - return do_sigpause (sig_or_mask, is_sig); - - int oldtype = LIBC_CANCEL_ASYNC (); - - int result = do_sigpause (sig_or_mask, is_sig); - - LIBC_CANCEL_RESET (oldtype); - - return result; -} libc_hidden_def (__sigpause) /* We have to provide a default version of this function since the @@ -87,3 +70,6 @@ __xpg_sigpause (int sig) return __sigpause (sig, 1); } strong_alias (__xpg_sigpause, __libc___xpg_sigpause) + +/* __sigsuspend handles cancellation. */ +LIBC_CANCEL_HANDLED ();