summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/common/bits
diff options
context:
space:
mode:
Diffstat (limited to 'libc/sysdeps/linux/common/bits')
-rw-r--r--libc/sysdeps/linux/common/bits/kernel_sigaction.h11
-rw-r--r--libc/sysdeps/linux/common/bits/sigset.h31
2 files changed, 29 insertions, 13 deletions
diff --git a/libc/sysdeps/linux/common/bits/kernel_sigaction.h b/libc/sysdeps/linux/common/bits/kernel_sigaction.h
index 99148e608..89aa2bb88 100644
--- a/libc/sysdeps/linux/common/bits/kernel_sigaction.h
+++ b/libc/sysdeps/linux/common/bits/kernel_sigaction.h
@@ -7,6 +7,10 @@
#undef NO_OLD_SIGACTION
#if defined(__mips__)
+/* We have libc/sysdeps/linux/mips/bits/kernel_sigaction.h,
+ * so this should never be used. Lets see whether it is true. */
+struct BUG_is_here { char BUG_is_here[-1]; };
+
#undef HAVE_SA_RESTORER
/* This is the sigaction structure from the Linux 2.1.24 kernel. */
#include <sgidefs.h>
@@ -18,11 +22,9 @@ struct old_kernel_sigaction {
#define _KERNEL_NSIG 128
#define _KERNEL_NSIG_BPW 32
#define _KERNEL_NSIG_WORDS (_KERNEL_NSIG / _KERNEL_NSIG_BPW)
-
typedef struct {
unsigned long sig[_KERNEL_NSIG_WORDS];
} kernel_sigset_t;
-
/* This is the sigaction structure from the Linux 2.1.68 kernel. */
struct kernel_sigaction {
unsigned int sa_flags;
@@ -31,7 +33,9 @@ struct kernel_sigaction {
void (*sa_restorer)(void);
int s_resv[1]; /* reserved */
};
+
#elif defined(__ia64__)
+
#define NO_OLD_SIGACTION
#undef HAVE_SA_RESTORER
struct kernel_sigaction {
@@ -39,7 +43,9 @@ struct kernel_sigaction {
unsigned long sa_flags;
sigset_t sa_mask;
};
+
#else
+
#define HAVE_SA_RESTORER
/* This is the sigaction structure from the Linux 2.1.20 kernel. */
struct old_kernel_sigaction {
@@ -55,6 +61,7 @@ struct kernel_sigaction {
void (*sa_restorer) (void);
sigset_t sa_mask;
};
+
#endif
#ifndef NO_OLD_SIGACTION
diff --git a/libc/sysdeps/linux/common/bits/sigset.h b/libc/sysdeps/linux/common/bits/sigset.h
index 964b09178..7ec87eb1d 100644
--- a/libc/sysdeps/linux/common/bits/sigset.h
+++ b/libc/sysdeps/linux/common/bits/sigset.h
@@ -23,15 +23,24 @@
typedef int __sig_atomic_t;
/* 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
+ * glibc has space for 1024 signals (!), but most arches supported
+ * by Linux have 64 signals, and only MIPS has 128.
+ * There seems to be some historical baggage in sparc[64]
+ * where they might have (or had in the past) 32 signals only,
+ * I hope it's irrelevant now.
+ * Signal 0 does not exist, so we have signals 1..64, not 0..63.
+ * Note that struct sigaction has embedded sigset_t,
+ * and this necessitates translation in sigaction()
+ * to convert it to struct kernel_sigaction.
+ * See libc/.../sigaction.c, libc/.../kernel_sigaction.h
*/
-
-# define _SIGSET_NWORDS (64 / (8 * sizeof (unsigned long int)))
+#if defined(__mips__)
+# define _SIGSET_NWORDS (128 / (8 * sizeof (unsigned long)))
+#else
+# define _SIGSET_NWORDS (64 / (8 * sizeof (unsigned long)))
+#endif
typedef struct {
- unsigned long int __val[_SIGSET_NWORDS];
+ unsigned long __val[_SIGSET_NWORDS];
} __sigset_t;
#endif
@@ -53,10 +62,10 @@ typedef struct {
/* 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) << ((unsigned)((sig) - 1) % (8 * sizeof (unsigned long int))))
+ (((unsigned long) 1) << ((unsigned)((sig) - 1) % (8 * sizeof (unsigned long))))
/* Return the word index for SIG. */
-# define __sigword(sig) ((unsigned)((sig) - 1) / (8 * sizeof (unsigned long int)))
+# define __sigword(sig) ((unsigned)((sig) - 1) / (8 * sizeof (unsigned long)))
/* gcc 4.3.1 is not clever enough to optimize for _SIGSET_NWORDS == 1 and 2,
* which are about the only values which can be there */
@@ -161,8 +170,8 @@ libc_hidden_proto(__sigdelset)
_EXTERN_INLINE int \
NAME (CONST __sigset_t *__set, int __sig) \
{ \
- unsigned long int __mask = __sigmask (__sig); \
- unsigned long int __word = __sigword (__sig); \
+ unsigned long __mask = __sigmask (__sig); \
+ unsigned long __word = __sigword (__sig); \
return BODY; \
}