summaryrefslogtreecommitdiffstats
path: root/include/linux/signal.h
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>1997-12-16 05:34:03 +0000
committerRalf Baechle <ralf@linux-mips.org>1997-12-16 05:34:03 +0000
commit967c65a99059fd459b956c1588ce0ba227912c4e (patch)
tree8224d013ff5d255420713d05610c7efebd204d2a /include/linux/signal.h
parente20c1cc1656a66a2773bca4591a895cbc12696ff (diff)
Merge with Linux 2.1.72, part 1.
Diffstat (limited to 'include/linux/signal.h')
-rw-r--r--include/linux/signal.h201
1 files changed, 200 insertions, 1 deletions
diff --git a/include/linux/signal.h b/include/linux/signal.h
index 9d1afa91c..0dd75b886 100644
--- a/include/linux/signal.h
+++ b/include/linux/signal.h
@@ -2,5 +2,204 @@
#define _LINUX_SIGNAL_H
#include <asm/signal.h>
+#include <asm/siginfo.h>
-#endif
+#ifdef __KERNEL__
+/*
+ * Real Time signals may be queued.
+ */
+
+struct signal_queue
+{
+ struct signal_queue *next;
+ siginfo_t info;
+};
+
+/*
+ * Define some primitives to manipulate sigset_t.
+ */
+
+#ifndef __HAVE_ARCH_SIG_BITOPS
+#include <asm/bitops.h>
+
+/* We don't use <asm/bitops.h> for these because there is no need to
+ be atomic. */
+extern inline void sigaddset(sigset_t *set, int _sig)
+{
+ unsigned long sig = _sig - 1;
+ if (_NSIG_WORDS == 1)
+ set->sig[0] |= 1UL << sig;
+ else
+ set->sig[sig / _NSIG_BPW] |= 1UL << (sig % _NSIG_BPW);
+}
+
+extern inline void sigdelset(sigset_t *set, int _sig)
+{
+ unsigned long sig = _sig - 1;
+ if (_NSIG_WORDS == 1)
+ set->sig[0] &= ~(1UL << sig);
+ else
+ set->sig[sig / _NSIG_BPW] &= ~(1UL << (sig % _NSIG_BPW));
+}
+
+extern inline int sigismember(sigset_t *set, int _sig)
+{
+ unsigned long sig = _sig - 1;
+ if (_NSIG_WORDS == 1)
+ return 1 & (set->sig[0] >> sig);
+ else
+ return 1 & (set->sig[sig / _NSIG_BPW] >> (sig % _NSIG_BPW));
+}
+
+extern inline int sigfindinword(unsigned long word)
+{
+ return ffz(~word);
+}
+
+#define sigmask(sig) (1UL << ((sig) - 1))
+
+#endif /* __HAVE_ARCH_SIG_BITOPS */
+
+#ifndef __HAVE_ARCH_SIG_SETOPS
+#include <linux/string.h>
+
+#define _SIG_SET_BINOP(name, op) \
+extern inline void name(sigset_t *r, const sigset_t *a, const sigset_t *b) \
+{ \
+ unsigned long a0, a1, a2, a3, b0, b1, b2, b3; \
+ unsigned long i; \
+ \
+ for (i = 0; i < _NSIG_WORDS/4; ++i) { \
+ a0 = a->sig[4*i+0]; a1 = a->sig[4*i+1]; \
+ a2 = a->sig[4*i+2]; a3 = a->sig[4*i+3]; \
+ b0 = b->sig[4*i+0]; b1 = b->sig[4*i+1]; \
+ b2 = b->sig[4*i+2]; b3 = b->sig[4*i+3]; \
+ r->sig[4*i+0] = op(a0, b0); \
+ r->sig[4*i+1] = op(a1, b1); \
+ r->sig[4*i+2] = op(a2, b2); \
+ r->sig[4*i+3] = op(a3, b3); \
+ } \
+ switch (_NSIG_WORDS % 4) { \
+ case 3: \
+ a0 = a->sig[4*i+0]; a1 = a->sig[4*i+1]; a2 = a->sig[4*i+2]; \
+ b0 = b->sig[4*i+0]; b1 = b->sig[4*i+1]; b2 = b->sig[4*i+2]; \
+ r->sig[4*i+0] = op(a0, b0); \
+ r->sig[4*i+1] = op(a1, b1); \
+ r->sig[4*i+2] = op(a2, b2); \
+ break; \
+ case 2: \
+ a0 = a->sig[4*i+0]; a1 = a->sig[4*i+1]; \
+ b0 = b->sig[4*i+0]; b1 = b->sig[4*i+1]; \
+ r->sig[4*i+0] = op(a0, b0); \
+ r->sig[4*i+1] = op(a1, b1); \
+ break; \
+ case 1: \
+ a0 = a->sig[4*i+0]; b0 = b->sig[4*i+0]; \
+ r->sig[4*i+0] = op(a0, b0); \
+ break; \
+ } \
+}
+
+#define _sig_or(x,y) ((x) | (y))
+_SIG_SET_BINOP(sigorsets, _sig_or)
+
+#define _sig_and(x,y) ((x) & (y))
+_SIG_SET_BINOP(sigandsets, _sig_and)
+
+#define _sig_nand(x,y) ((x) & ~(y))
+_SIG_SET_BINOP(signandsets, _sig_nand)
+
+#undef _SIG_SET_BINOP
+#undef _sig_or
+#undef _sig_and
+#undef _sig_nand
+
+#define _SIG_SET_OP(name, op) \
+extern inline void name(sigset_t *set) \
+{ \
+ unsigned long i; \
+ \
+ for (i = 0; i < _NSIG_WORDS/4; ++i) { \
+ set->sig[4*i+0] = op(set->sig[4*i+0]); \
+ set->sig[4*i+1] = op(set->sig[4*i+1]); \
+ set->sig[4*i+2] = op(set->sig[4*i+2]); \
+ set->sig[4*i+3] = op(set->sig[4*i+3]); \
+ } \
+ switch (_NSIG_WORDS % 4) { \
+ case 3: set->sig[4*i+2] = op(set->sig[4*i+2]); \
+ case 2: set->sig[4*i+1] = op(set->sig[4*i+1]); \
+ case 1: set->sig[4*i+0] = op(set->sig[4*i+0]); \
+ } \
+}
+
+#define _sig_not(x) (~(x))
+_SIG_SET_OP(signotset, _sig_not)
+
+#undef _SIG_SET_OP
+#undef _sig_not
+
+extern inline void sigemptyset(sigset_t *set)
+{
+ switch (_NSIG_WORDS) {
+ default:
+ memset(set, 0, sizeof(sigset_t));
+ break;
+ case 2: set->sig[1] = 0;
+ case 1: set->sig[0] = 0;
+ break;
+ }
+}
+
+extern inline void sigfillset(sigset_t *set)
+{
+ switch (_NSIG_WORDS) {
+ default:
+ memset(set, -1, sizeof(sigset_t));
+ break;
+ case 2: set->sig[1] = -1;
+ case 1: set->sig[0] = -1;
+ break;
+ }
+}
+
+/* Some extensions for manipulating the low 32 signals in particular. */
+
+extern inline void sigaddsetmask(sigset_t *set, unsigned long mask)
+{
+ set->sig[0] |= mask;
+}
+
+extern inline void sigdelsetmask(sigset_t *set, unsigned long mask)
+{
+ set->sig[0] &= ~mask;
+}
+
+extern inline void siginitset(sigset_t *set, unsigned long mask)
+{
+ set->sig[0] = mask;
+ switch (_NSIG_WORDS) {
+ default:
+ memset(&set->sig[1], 0, sizeof(long)*(_NSIG_WORDS-1));
+ break;
+ case 2: set->sig[1] = 0;
+ case 1:
+ }
+}
+
+extern inline void siginitsetinv(sigset_t *set, unsigned long mask)
+{
+ set->sig[0] = ~mask;
+ switch (_NSIG_WORDS) {
+ default:
+ memset(&set->sig[1], -1, sizeof(long)*(_NSIG_WORDS-1));
+ break;
+ case 2: set->sig[1] = -1;
+ case 1:
+ }
+}
+
+#endif /* __HAVE_ARCH_SIG_SETOPS */
+
+#endif /* __KERNEL__ */
+
+#endif /* _LINUX_SIGNAL_H */