summary refs log tree commit diff
path: root/stdlib
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2022-04-21 09:41:59 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2022-06-30 14:56:21 -0300
commita1bdd81664aa681364da368154c48501db249df9 (patch)
tree29f01a9ad8bcda2794869dd0555537a2de16fa38 /stdlib
parentc22d2021a9f9bdea62398976eea4f0e6ef668b7d (diff)
downloadglibc-a1bdd81664aa681364da368154c48501db249df9.tar.gz
glibc-a1bdd81664aa681364da368154c48501db249df9.tar.xz
glibc-a1bdd81664aa681364da368154c48501db249df9.zip
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>
Diffstat (limited to 'stdlib')
-rw-r--r--stdlib/abort.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/stdlib/abort.c b/stdlib/abort.c
index bcf72f9356..9c1065af0e 100644
--- a/stdlib/abort.c
+++ b/stdlib/abort.c
@@ -21,7 +21,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
-#include <sigsetops.h>
+#include <internal-signals.h>
 
 /* Try to get a machine dependent instruction which will make the
    program crash.  This is used in case everything else fails.  */
@@ -48,7 +48,6 @@ void
 abort (void)
 {
   struct sigaction act;
-  sigset_t sigs;
 
   /* First acquire the lock.  */
   __libc_lock_lock_recursive (lock);
@@ -59,9 +58,10 @@ abort (void)
   if (stage == 0)
     {
       ++stage;
-      __sigemptyset (&sigs);
-      __sigaddset (&sigs, SIGABRT);
-      __sigprocmask (SIG_UNBLOCK, &sigs, 0);
+      internal_sigset_t sigs;
+      internal_sigemptyset (&sigs);
+      internal_sigaddset (&sigs, SIGABRT);
+      internal_sigprocmask (SIG_UNBLOCK, &sigs, NULL);
     }
 
   /* Send signal which possibly calls a user handler.  */