diff options
Diffstat (limited to 'src/signal/sigaddset.c')
-rw-r--r-- | src/signal/sigaddset.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/signal/sigaddset.c b/src/signal/sigaddset.c new file mode 100644 index 0000000..23e655d --- /dev/null +++ b/src/signal/sigaddset.c @@ -0,0 +1,13 @@ +#include <signal.h> +#include <errno.h> + +int sigaddset(sigset_t *set, int sig) +{ + unsigned s = sig-1; + if (s >= 8*sizeof(sigset_t)) { + errno = EINVAL; + return -1; + } + set->__bits[s/8/sizeof *set->__bits] |= 1UL<<(s&8*sizeof *set->__bits-1); + return 0; +} |