summaryrefslogtreecommitdiff
path: root/pfinet/linux-src/include/linux/signal.h
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2000-02-04 03:21:18 +0000
committerRoland McGrath <roland@gnu.org>2000-02-04 03:21:18 +0000
commit8880a73970b23f10c720011cb910c0e0e1e02975 (patch)
treed1ce76577a1ace5312fc0576a93d4d8db1e89323 /pfinet/linux-src/include/linux/signal.h
parent8399aa4ab7b849da57f4c59039f091526c9e2f98 (diff)
parent9fd51e9b0ad33a89a83fdbbb66bd20d85f7893fb (diff)
Merge from vendor branch Linux:
Import of Linux 2.2.12 subset (ipv4 stack and related)
Diffstat (limited to 'pfinet/linux-src/include/linux/signal.h')
-rw-r--r--pfinet/linux-src/include/linux/signal.h212
1 files changed, 212 insertions, 0 deletions
diff --git a/pfinet/linux-src/include/linux/signal.h b/pfinet/linux-src/include/linux/signal.h
new file mode 100644
index 00000000..d6e82ae0
--- /dev/null
+++ b/pfinet/linux-src/include/linux/signal.h
@@ -0,0 +1,212 @@
+#ifndef _LINUX_SIGNAL_H
+#define _LINUX_SIGNAL_H
+
+#include <asm/signal.h>
+#include <asm/siginfo.h>
+
+#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;
+ }
+}
+
+extern char * render_sigset_t(sigset_t *set, char *buffer);
+
+/* 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 int sigtestsetmask(sigset_t *set, unsigned long mask)
+{
+ return (set->sig[0] & mask) != 0;
+}
+
+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 */