summaryrefslogtreecommitdiff
path: root/libc/signal/sigsetmask.c
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2005-12-01 07:40:02 +0000
committerMike Frysinger <vapier@gentoo.org>2005-12-01 07:40:02 +0000
commit9e25f3a5c5892d3a9a792d9c95dc32b7561c1895 (patch)
tree572237c735b607e84ee2fbe7ad937898499c0ac1 /libc/signal/sigsetmask.c
parent592add99c335354bd84367614acbcc9febd86309 (diff)
sync with glibc (and shrinks the object code nicely by like half)
Diffstat (limited to 'libc/signal/sigsetmask.c')
-rw-r--r--libc/signal/sigsetmask.c45
1 files changed, 16 insertions, 29 deletions
diff --git a/libc/signal/sigsetmask.c b/libc/signal/sigsetmask.c
index 4c7a43e5f..4b27b54a9 100644
--- a/libc/signal/sigsetmask.c
+++ b/libc/signal/sigsetmask.c
@@ -19,35 +19,22 @@
#include <errno.h>
#include <signal.h>
+#include "sigset-cvt-mask.h"
+
/* Set the mask of blocked signals to MASK, returning the old mask. */
-int sigsetmask (int mask)
+int
+__sigsetmask (int mask)
{
- register unsigned int sig;
- sigset_t set, oset;
-
- if (__sigemptyset (&set) < 0)
- return -1;
-
- if (sizeof (mask) == sizeof (set))
- *(int *) &set = mask;
- else if (sizeof (unsigned long int) == sizeof (set))
- *(unsigned long int *) &set = (unsigned int) mask;
- else
- for (sig = 1; sig < NSIG && sig <= sizeof (mask) * 8; ++sig)
- if ((mask & sigmask (sig)) && __sigaddset (&set, sig) < 0)
- return -1;
-
- if (sigprocmask (SIG_SETMASK, &set, &oset) < 0)
- return -1;
-
- if (sizeof (mask) == sizeof (oset))
- mask = *(int *) &oset;
- else if (sizeof (unsigned long int) == sizeof (oset))
- mask = *(unsigned long int *) &oset;
- else
- for (sig = 1, mask = 0; sig < NSIG && sig <= sizeof (mask) * 8; ++sig)
- if (__sigismember (&oset, sig))
- mask |= sigmask (sig);
-
- return mask;
+ sigset_t set, oset;
+
+ if (sigset_set_old_mask (&set, mask) < 0)
+ return -1;
+
+ if (sigprocmask (SIG_SETMASK, &set, &oset) < 0)
+ return -1;
+
+
+ return sigset_get_old_mask (&oset);
}
+
+weak_alias (__sigsetmask, sigsetmask)