Size of sigset_t is 128 bytes?

Denys Vlasenko vda.linux at googlemail.com
Sat Nov 22 17:36:42 UTC 2008


Hi Bernhard, folks,

I stumbled over this code in libc/sysdeps/linux/common/bits/sigset.h:

/* A `sigset_t' has a bit for each signal.  */

# define _SIGSET_NWORDS (1024 / (8 * sizeof (unsigned long int)))
typedef struct
  {
    unsigned long int __val[_SIGSET_NWORDS];
  } __sigset_t;

Wow. Our sigset_t take 1024 bits!

I an not aware or any architecture having more than 64 signals,
and there are strong reasons to suspect that there is no
(and will never be) arch with more than 128 signals:
waitpid() and WTERMSIG() internals restrict signo to 8 bits,
ptrace restricts signo to 7 bits. Maybe more.

Do we need to maintain sizeof(sigset_t) equal to glibc's?
If not, lets shrink it. If yes, do you have any examples
why is it a problem?

From what I see, kernel treats sigset_t* as an array of longs
and ignores elements of the array which do not correspond
to any signals. In practice, on most architectures kernel
treats it as a two-element array.
--
vda



More information about the uClibc mailing list