1 /* Special use of signals internally.  Stub version.
2    Copyright (C) 2014-2021 Free Software Foundation, Inc.
3    This file is part of the GNU C Library.
4 
5    The GNU C Library is free software; you can redistribute it and/or
6    modify it under the terms of the GNU Lesser General Public
7    License as published by the Free Software Foundation; either
8    version 2.1 of the License, or (at your option) any later version.
9 
10    The GNU C Library is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13    Lesser General Public License for more details.
14 
15    You should have received a copy of the GNU Lesser General Public
16    License along with the GNU C Library; if not, see
17    <https://www.gnu.org/licenses/>.  */
18 
19 #ifndef __INTERNAL_SIGNALS_H
20 # define __INTERNAL_SIGNALS_H
21 
22 #include <signal.h>
23 #include <sigsetops.h>
24 #include <stdbool.h>
25 #include <stddef.h>
26 
27 /* How many signal numbers need to be reserved for libpthread's private uses
28    (SIGCANCEL and SIGSETXID).  */
29 #define RESERVED_SIGRT  0
30 
31 static inline bool
__is_internal_signal(int sig)32 __is_internal_signal (int sig)
33 {
34   return false;
35 }
36 
37 static inline void
__clear_internal_signals(sigset_t * set)38 __clear_internal_signals (sigset_t *set)
39 {
40 }
41 
42 static inline void
__libc_signal_block_all(sigset_t * set)43 __libc_signal_block_all (sigset_t *set)
44 {
45   sigset_t allset;
46   __sigfillset (&allset);
47   __sigprocmask (SIG_BLOCK, &allset, set);
48 }
49 
50 static inline void
__libc_signal_block_app(sigset_t * set)51 __libc_signal_block_app (sigset_t *set)
52 {
53   sigset_t allset;
54   __sigfillset (&allset);
55   __clear_internal_signals (&allset);
56   __sigprocmask (SIG_BLOCK, &allset, set);
57 }
58 
59 /* Restore current process signal mask.  */
60 static inline void
__libc_signal_restore_set(const sigset_t * set)61 __libc_signal_restore_set (const sigset_t *set)
62 {
63   __sigprocmask (SIG_SETMASK, set, NULL);
64 }
65 
66 
67 #endif /* __INTERNAL_SIGNALS_H  */
68