summary refs log tree commit diff
path: root/sysdeps/unix/sysv/linux/internal-signals.h
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/unix/sysv/linux/internal-signals.h')
-rw-r--r--sysdeps/unix/sysv/linux/internal-signals.h63
1 files changed, 30 insertions, 33 deletions
diff --git a/sysdeps/unix/sysv/linux/internal-signals.h b/sysdeps/unix/sysv/linux/internal-signals.h
index f9efb6a159..b624a080f7 100644
--- a/sysdeps/unix/sysv/linux/internal-signals.h
+++ b/sysdeps/unix/sysv/linux/internal-signals.h
@@ -19,10 +19,11 @@
 #ifndef __INTERNAL_SIGNALS_H
 # define __INTERNAL_SIGNALS_H
 
+#include <internal-sigset.h>
+#include <limits.h>
 #include <signal.h>
 #include <sigsetops.h>
 #include <stdbool.h>
-#include <limits.h>
 #include <stddef.h>
 #include <sysdep.h>
 
@@ -47,67 +48,63 @@
 
 /* Return is sig is used internally.  */
 static inline bool
-__is_internal_signal (int sig)
+is_internal_signal (int sig)
 {
   return (sig == SIGCANCEL) || (sig == SIGSETXID);
 }
 
 /* Remove internal glibc signal from the mask.  */
 static inline void
-__clear_internal_signals (sigset_t *set)
+clear_internal_signals (sigset_t *set)
 {
   __sigdelset (set, SIGCANCEL);
   __sigdelset (set, SIGSETXID);
 }
 
-static const sigset_t sigall_set = {
-   .__val = {[0 ...  _SIGSET_NWORDS-1 ] =  -1 }
-};
-
-static const sigset_t sigtimer_set = {
-  .__val = { [0]                      = __sigmask (SIGTIMER),
-             [1 ... _SIGSET_NWORDS-1] = 0 }
+static const internal_sigset_t sigall_set = {
+   .__val = {[0 ...  __NSIG_WORDS-1 ] =  -1 }
 };
 
-/* Block all signals, including internal glibc ones.  */
-static inline void
-__libc_signal_block_all (sigset_t *set)
+/* Obtain and change blocked signals, including internal glibc ones.  */
+static inline int
+internal_sigprocmask (int how, const internal_sigset_t *set,
+		      internal_sigset_t *oldset)
 {
-  INTERNAL_SYSCALL_CALL (rt_sigprocmask, SIG_BLOCK, &sigall_set, set,
-			 __NSIG_BYTES);
+  return INTERNAL_SYSCALL_CALL (rt_sigprocmask, how, set, oldset,
+				__NSIG_BYTES);
 }
 
-/* Block all application signals (excluding internal glibc ones).  */
+/* Block all signals, including internal glibc ones.  */
 static inline void
-__libc_signal_block_app (sigset_t *set)
+internal_signal_block_all (internal_sigset_t *oset)
 {
-  sigset_t allset = sigall_set;
-  __clear_internal_signals (&allset);
-  INTERNAL_SYSCALL_CALL (rt_sigprocmask, SIG_BLOCK, &allset, set,
+  INTERNAL_SYSCALL_CALL (rt_sigprocmask, SIG_BLOCK, &sigall_set, oset,
 			 __NSIG_BYTES);
 }
 
-/* Block only SIGTIMER and return the previous set on SET.  */
+/* Restore current process signal mask.  */
 static inline void
-__libc_signal_block_sigtimer (sigset_t *set)
+internal_signal_restore_set (const internal_sigset_t *set)
 {
-  INTERNAL_SYSCALL_CALL (rt_sigprocmask, SIG_BLOCK, &sigtimer_set, set,
+  INTERNAL_SYSCALL_CALL (rt_sigprocmask, SIG_SETMASK, set, NULL,
 			 __NSIG_BYTES);
 }
 
-/* Unblock only SIGTIMER and return the previous set on SET.  */
-static inline void
-__libc_signal_unblock_sigtimer (sigset_t *set)
-{
-  INTERNAL_SYSCALL_CALL (rt_sigprocmask, SIG_UNBLOCK, &sigtimer_set, set,
-			 __NSIG_BYTES);
-}
 
-/* Restore current process signal mask.  */
+/* It is used on timer_create code directly on sigwaitinfo call, so it can not
+   use the internal_sigset_t definitions.  */
+static const sigset_t sigtimer_set = {
+  .__val = { [0]                      = __sigmask (SIGTIMER),
+             [1 ... _SIGSET_NWORDS-1] = 0
+  }
+};
+
+/* Unblock only SIGTIMER.  */
 static inline void
-__libc_signal_restore_set (const sigset_t *set)
+signal_unblock_sigtimer (void)
 {
-  INTERNAL_SYSCALL_CALL (rt_sigprocmask, SIG_SETMASK, set, NULL,
+  INTERNAL_SYSCALL_CALL (rt_sigprocmask, SIG_UNBLOCK, &sigtimer_set, NULL,
 			 __NSIG_BYTES);
 }
+
 #endif