summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/common/bits
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-11-29 15:35:51 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-11-29 15:35:51 +0000
commit35ae1599438a15568818bf09b493d7b49039d452 (patch)
tree04cc734828b1dd978fbf6d6fd509168a5dd2bb58 /libc/sysdeps/linux/common/bits
parentd4cb8007c785edaaba9f707bc83d6a33f562a059 (diff)
reduce sigset_t size for 128 bytes to 64 bits:
text data bss dec hex filename - 38457 18352 8636 65445 ffa5 lib/libpthread-0.9.30-svn.so + 38015 18096 8636 64747 fceb lib/libpthread-0.9.30-svn.so - 8205 280 12 8497 2131 lib/libthread_db-0.9.30-svn.so + 8193 280 12 8485 2125 lib/libthread_db-0.9.30-svn.so - 275208 1823 19132 296163 484e3 lib/libuClibc-0.9.30-svn.so + 274787 1823 19012 295622 482c6 lib/libuClibc-0.9.30-svn.so
Diffstat (limited to 'libc/sysdeps/linux/common/bits')
-rw-r--r--libc/sysdeps/linux/common/bits/sigset.h16
1 files changed, 11 insertions, 5 deletions
diff --git a/libc/sysdeps/linux/common/bits/sigset.h b/libc/sysdeps/linux/common/bits/sigset.h
index 9a16e5cb9..14497671d 100644
--- a/libc/sysdeps/linux/common/bits/sigset.h
+++ b/libc/sysdeps/linux/common/bits/sigset.h
@@ -22,9 +22,14 @@
typedef int __sig_atomic_t;
-/* A `sigset_t' has a bit for each signal. */
-
-# define _SIGSET_NWORDS (1024 / (8 * sizeof (unsigned long int)))
+/* A 'sigset_t' has a bit for each signal.
+ * Signal 0 does not exist, so we have signals 1..64.
+ * glibc has space for 1024 signals (!), but all arches supported
+ * by Linux have 64 signals only.
+ * See, for example, _NSIG (defined to 65) in signum.h
+ */
+
+# define _SIGSET_NWORDS (64 / (8 * sizeof (unsigned long int)))
typedef struct
{
unsigned long int __val[_SIGSET_NWORDS];
@@ -47,11 +52,12 @@ typedef struct
# endif
/* Return a mask that includes the bit for SIG only. */
+/* Unsigned cast ensures shift/mask insns are used. */
# define __sigmask(sig) \
- (((unsigned long int) 1) << (((sig) - 1) % (8 * sizeof (unsigned long int))))
+ (((unsigned long int) 1) << ((unsigned)((sig) - 1) % (8 * sizeof (unsigned long int))))
/* Return the word index for SIG. */
-# define __sigword(sig) (((sig) - 1) / (8 * sizeof (unsigned long int)))
+# define __sigword(sig) ((unsigned)((sig) - 1) / (8 * sizeof (unsigned long int)))
# if defined __GNUC__ && __GNUC__ >= 2
# define __sigemptyset(set) \