This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]