From patchwork Fri Mar 13 19:48:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 38558 X-Patchwork-Delegate: azanella@linux.vnet.ibm.com Return-Path: X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qk1-x743.google.com (mail-qk1-x743.google.com [IPv6:2607:f8b0:4864:20::743]) by sourceware.org (Postfix) with ESMTPS id 03D9B38A2417 for ; Fri, 13 Mar 2020 19:48:36 +0000 (GMT) Received: by mail-qk1-x743.google.com with SMTP id j2so1804715qkl.7 for ; Fri, 13 Mar 2020 12:48:36 -0700 (PDT) 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=BPXAzU5rDpcWpxDZqmnY5s5C9Ndj/XK7ciWxanObJww=; b=O2fkFG92yJIg8UU+eeh88LalC7lBGCrtv1ik2Hxzm8dzxbFkkVImur/E+q4dz89ZGN 4gWm6w+2ZoN793M7nebluotGEtg6i4LTIwYmhunbkXEgqo6KhwA8pPHLej7Xs0hoT1FL BA1vk2xwY1QaAe8twtxH25HJu7F1O2aJDu6wGrbg+saZU9lxw9WNoRZBSVX3D8ym0jjo fcBLN7M6Ol+kWURs7J4Kz6v/DPT4UP9Gfam2XKC5Nfa65nwdbc5PZDjKDomYLoPuzycn H1UixdzydDZFb94DSUzP1kimCvGKbDf83cIiDIWgrRwnHieGae9oLIL9vkDabw9Wpz3y WXcQ== X-Gm-Message-State: ANhLgQ0NDif0fklrXpB5MaEF0PRQjMu55wTUNizUt4byaBlKlHRFbjCL s7hKOytxG3/jvMcXzuv2dJw05dVt12g= X-Google-Smtp-Source: ADFU+vumo9Yb40+pTjy1GlCiKMWgG4PoYYfaPMb7FF4b2nknPGJgV/Vkna36uKcL/ocdxSGcSz4sdw== X-Received: by 2002:a37:b903:: with SMTP id j3mr14849530qkf.62.1584128915229; Fri, 13 Mar 2020 12:48:35 -0700 (PDT) Received: from localhost.localdomain ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id r10sm29497900qkm.23.2020.03.13.12.48.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Mar 2020 12:48:34 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH v2 3/4] linux: Use pthread_sigmask on sigprocmask Date: Fri, 13 Mar 2020 16:48:26 -0300 Message-Id: <20200313194827.4467-3-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200313194827.4467-1-adhemerval.zanella@linaro.org> References: <20200313194827.4467-1-adhemerval.zanella@linaro.org> X-Spam-Status: No, score=-25.2 required=5.0 tests=DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Mar 2020 19:48:36 -0000 With pthread_sigmask on libc.so, it allows consolidate both implementations. Checked on x86_64-linux-gnu. --- nptl/pthreadP.h | 1 + nptl/pthread_sigmask.c | 2 ++ sysdeps/unix/sysv/linux/sigprocmask.c | 20 +++++--------------- 3 files changed, 8 insertions(+), 15 deletions(-) diff --git a/nptl/pthreadP.h b/nptl/pthreadP.h index edec8d0501..c6d8fc69be 100644 --- a/nptl/pthreadP.h +++ b/nptl/pthreadP.h @@ -484,6 +484,7 @@ extern int __pthread_clockjoin_ex (pthread_t, void **, clockid_t, attribute_hidden; extern int __pthread_sigmask (int how, const sigset_t *newmask, sigset_t *oldmask); +libc_hidden_proto (__pthread_sigmask) #if IS_IN (libpthread) diff --git a/nptl/pthread_sigmask.c b/nptl/pthread_sigmask.c index 0e326d610c..c6c6e83c08 100644 --- a/nptl/pthread_sigmask.c +++ b/nptl/pthread_sigmask.c @@ -46,6 +46,8 @@ __pthread_sigmask (int how, const sigset_t *newmask, sigset_t *oldmask) ? INTERNAL_SYSCALL_ERRNO (result) : 0); } +libc_hidden_def (__pthread_sigmask) + versioned_symbol (libc, __pthread_sigmask, pthread_sigmask, GLIBC_2_32); #if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_32) strong_alias (__pthread_sigmask, __pthread_sigmask_2); diff --git a/sysdeps/unix/sysv/linux/sigprocmask.c b/sysdeps/unix/sysv/linux/sigprocmask.c index eb9e4d5e83..6ed0ab1e6a 100644 --- a/sysdeps/unix/sysv/linux/sigprocmask.c +++ b/sysdeps/unix/sysv/linux/sigprocmask.c @@ -22,21 +22,11 @@ int __sigprocmask (int how, const sigset_t *set, sigset_t *oset) { - sigset_t local_newmask; - - /* The only thing we have to make sure here is that SIGCANCEL and - SIGSETXID are not blocked. */ - if (set != NULL - && __glibc_unlikely (__sigismember (set, SIGCANCEL) - || __glibc_unlikely (__sigismember (set, SIGSETXID)))) - { - local_newmask = *set; - __sigdelset (&local_newmask, SIGCANCEL); - __sigdelset (&local_newmask, SIGSETXID); - set = &local_newmask; - } - - return INLINE_SYSCALL_CALL (rt_sigprocmask, how, set, oset, _NSIG / 8); + int result = __pthread_sigmask (how, set, oset); + if (result == 0) + return 0; + __set_errno (result); + return result; } libc_hidden_def (__sigprocmask) weak_alias (__sigprocmask, sigprocmask)