public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
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	[thread overview]
Message-ID: <20200313194827.4467-3-adhemerval.zanella@linaro.org> (raw)
In-Reply-To: <20200313194827.4467-1-adhemerval.zanella@linaro.org>

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)
-- 
2.17.1


  parent reply	other threads:[~2020-03-13 19:48 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-13 19:48 [PATCH v2 1/4] nptl: Move pthread_sigmask implementation to libc Adhemerval Zanella
2020-03-13 19:48 ` [PATCH 2/4] ia64: Remove sigprocmask/sigblock objects from libpthread Adhemerval Zanella
2020-04-17 13:25   ` Adhemerval Zanella
2020-04-21 11:56   ` Florian Weimer
2020-04-21 12:06     ` Adhemerval Zanella
2020-03-13 19:48 ` Adhemerval Zanella [this message]
2020-04-17 13:25   ` [PATCH v2 3/4] linux: Use pthread_sigmask on sigprocmask Adhemerval Zanella
2020-04-21 12:01   ` Florian Weimer
2020-04-21 12:30     ` Adhemerval Zanella
2020-04-21 12:35       ` Florian Weimer
2020-04-21 13:01         ` Adhemerval Zanella
2020-03-13 19:48 ` [PATCH 4/4] signal: Only handle on NSIG signals on signal functions (BZ #25657) Adhemerval Zanella
2020-04-17 13:25   ` Adhemerval Zanella
2020-04-21 12:53   ` Florian Weimer
2020-04-21 13:11     ` Adhemerval Zanella
2020-04-21 13:14       ` Florian Weimer
2020-04-21 13:29         ` Adhemerval Zanella
2020-04-21 13:47           ` Florian Weimer
2020-04-21 14:02             ` Adhemerval Zanella
2020-04-21 14:07               ` Florian Weimer
2020-04-21 14:10                 ` Adhemerval Zanella
2020-04-21 14:35                   ` Florian Weimer
2020-04-21 14:36                     ` Adhemerval Zanella
2020-04-21 15:05                   ` Andreas Schwab
2020-04-21 17:28                     ` Florian Weimer
2020-04-21 17:49                       ` Adhemerval Zanella
2020-04-21 18:40                         ` Andreas Schwab
2020-04-21 19:00                           ` Adhemerval Zanella
2020-04-21 21:14                             ` Andreas Schwab
2020-04-22  8:32                               ` Florian Weimer
2020-04-22 11:34                                 ` Adhemerval Zanella
2020-04-17 13:25 ` [PATCH v2 1/4] nptl: Move pthread_sigmask implementation to libc Adhemerval Zanella
2020-04-21 11:50 ` Florian Weimer
2020-04-21 14:06   ` Adhemerval Zanella

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200313194827.4467-3-adhemerval.zanella@linaro.org \
    --to=adhemerval.zanella@linaro.org \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).