@@ -53,36 +53,47 @@ __clear_internal_signals (sigset_t *set)
__sigdelset (set, SIGSETXID);
}
-#define SIGALL_SET \
- ((__sigset_t) { .__val = {[0 ... _SIGSET_NWORDS-1 ] = -1 } })
+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
+static inline void
__libc_signal_block_all (sigset_t *set)
{
INTERNAL_SYSCALL_DECL (err);
- return INTERNAL_SYSCALL (rt_sigprocmask, err, 4, SIG_BLOCK, &SIGALL_SET,
- set, _NSIG / 8);
+ INTERNAL_SYSCALL_CALL (rt_sigprocmask, err, SIG_BLOCK, &sigall_set, set,
+ _NSIG / 8);
}
/* Block all application signals (excluding internal glibc ones). */
-static inline int
+static inline void
__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, set,
- _NSIG / 8);
+ INTERNAL_SYSCALL_CALL (rt_sigprocmask, err, SIG_BLOCK, &sigapp_set, set,
+ _NSIG / 8);
}
/* Restore current process signal mask. */
-static inline int
+static inline void
__libc_signal_restore_set (const sigset_t *set)
{
INTERNAL_SYSCALL_DECL (err);
- return INTERNAL_SYSCALL (rt_sigprocmask, err, 4, SIG_SETMASK, set, NULL,
- _NSIG / 8);
+ INTERNAL_SYSCALL_CALL (rt_sigprocmask, err, SIG_SETMASK, set, NULL,
+ _NSIG / 8);
}
/* Used to communicate with signal handler. */