diff options
author | Mike Frysinger <vapier@gentoo.org> | 2005-12-01 07:40:02 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2005-12-01 07:40:02 +0000 |
commit | 9e25f3a5c5892d3a9a792d9c95dc32b7561c1895 (patch) | |
tree | 572237c735b607e84ee2fbe7ad937898499c0ac1 /libc/signal/sigblock.c | |
parent | 592add99c335354bd84367614acbcc9febd86309 (diff) |
sync with glibc (and shrinks the object code nicely by like half)
Diffstat (limited to 'libc/signal/sigblock.c')
-rw-r--r-- | libc/signal/sigblock.c | 41 |
1 files changed, 12 insertions, 29 deletions
diff --git a/libc/signal/sigblock.c b/libc/signal/sigblock.c index c02c234b6..62ef060ac 100644 --- a/libc/signal/sigblock.c +++ b/libc/signal/sigblock.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 94, 95, 96, 97, 98, 2001 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1994-1998, 2001-2002 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -19,37 +19,20 @@ #include <errno.h> #include <signal.h> +#include "sigset-cvt-mask.h" + /* Block signals in MASK, returning the old mask. */ int __sigblock (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_BLOCK, &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_BLOCK, &set, &oset) < 0) + return -1; + + return sigset_get_old_mask (&oset); } strong_alias (__sigblock, sigblock) |