diff mbox series

[2/7] Add a constant data object for __libc_signal_block_app signal mask

Message ID 20191210183221.26912-2-adhemerval.zanella@linaro.org
State New
Headers show
Series [v3,1/7] Fix __libc_signal_block_all on sparc64 | expand

Commit Message

Adhemerval Zanella Netto Dec. 10, 2019, 6:32 p.m. UTC
It allows some minor optimization and less stack usage.

Checked on x86_64-linux-gnu and i686-linux-gnu.
---
 sysdeps/unix/sysv/linux/internal-signals.h | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

-- 
2.17.1
diff mbox series

Patch

diff --git a/sysdeps/unix/sysv/linux/internal-signals.h b/sysdeps/unix/sysv/linux/internal-signals.h
index a496c7174c..4b70109c14 100644
--- a/sysdeps/unix/sysv/linux/internal-signals.h
+++ b/sysdeps/unix/sysv/linux/internal-signals.h
@@ -58,6 +58,18 @@  static const sigset_t sigall_set = {
    .__val = {[0 ...  _SIGSET_NWORDS-1 ] =  -1 }
 };
 
+static const sigset_t sigapp_set = {
+#if ULONG_MAX == 0xffffffff
+  .__val = { [0]                      = ~0UL & ~(__sigmask (SIGCANCEL)),
+             [1]                      = ~0UL & ~(__sigmask (SIGSETXID)),
+             [2 ... _SIGSET_NWORDS-1] = ~0UL }
+#else
+  .__val = { [0]                      = ~0UL & ~(__sigmask (SIGCANCEL)
+                                                 | __sigmask (SIGSETXID)),
+             [1 ... _SIGSET_NWORDS-1] = ~0UL }
+#endif
+};
+
 /* Block all signals, including internal glibc ones.  */
 static inline int
 __libc_signal_block_all (sigset_t *set)
@@ -71,10 +83,8 @@  __libc_signal_block_all (sigset_t *set)
 static inline int
 __libc_signal_block_app (sigset_t *set)
 {
-  sigset_t allset = sigall_set;
-  __clear_internal_signals (&allset);
   INTERNAL_SYSCALL_DECL (err);
-  return INTERNAL_SYSCALL (rt_sigprocmask, err, 4, SIG_BLOCK, &allset,
+  return INTERNAL_SYSCALL (rt_sigprocmask, err, 4, SIG_BLOCK, &sigapp_set,
 			   set, _NSIG / 8);
 }