1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-08-01 10:06:57 +03:00

Refactor internal-signals.h

The main drive is to optimize the internal usage and required size
when sigset_t is embedded in other data structures.  On Linux, the
current supported signal set requires up to 8 bytes (16 on mips),
was lower than the user defined sigset_t (128 bytes).

A new internal type internal_sigset_t is added, along with the
functions to operate on it similar to the ones for sigset_t.  The
internal-signals.h is also refactored to remove unused functions

Besides small stack usage on some functions (posix_spawn, abort)
it lower the struct pthread by about 120 bytes (112 on mips).

Checked on x86_64-linux-gnu.

Reviewed-by: Arjun Shankar <arjun@redhat.com>
This commit is contained in:
Adhemerval Zanella
2022-04-21 09:41:59 -03:00
parent c22d2021a9
commit a1bdd81664
18 changed files with 184 additions and 98 deletions

View File

@ -29,39 +29,20 @@
#define RESERVED_SIGRT 0
static inline bool
__is_internal_signal (int sig)
is_internal_signal (int sig)
{
return false;
}
static inline void
__clear_internal_signals (sigset_t *set)
clear_internal_signals (sigset_t *set)
{
}
static inline void
__libc_signal_block_all (sigset_t *set)
{
sigset_t allset;
__sigfillset (&allset);
__sigprocmask (SIG_BLOCK, &allset, set);
}
static inline void
__libc_signal_block_app (sigset_t *set)
{
sigset_t allset;
__sigfillset (&allset);
__clear_internal_signals (&allset);
__sigprocmask (SIG_BLOCK, &allset, set);
}
/* Restore current process signal mask. */
static inline void
__libc_signal_restore_set (const sigset_t *set)
{
__sigprocmask (SIG_SETMASK, set, NULL);
}
typedef sigset_t internal_sigset_t;
#define internal_sigemptyset(__s) sigemptyset (__s)
#define internal_sigaddset(__s, __i) sigaddset (__s, __i)
#define internal_sigprocmask(__h, __s, __o) sigprocmask (__h, __s, __o)
#endif /* __INTERNAL_SIGNALS_H */