coverity appeasement - redundant check
[minix.git] / include / sys / sigtypes.h
blob7e8c5bfbca9e2a4edc9afd8a2d045db22149c0cd
1 #ifndef _SYS_SIGTYPES_H_
2 #define _SYS_SIGTYPES_H_
4 /*
5 * This header file defines various signal-related types. We also keep
6 * the macros to manipulate sigset_t here, to encapsulate knowledge of
7 * its internals.
8 */
10 #include <sys/featuretest.h>
11 #include <machine/int_types.h>
12 #include <machine/ansi.h>
14 #ifdef _BSD_SIZE_T_
15 typedef _BSD_SIZE_T_ size_t;
16 #undef _BSD_SIZE_T_
17 #endif
19 #if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
20 defined(_NETBSD_SOURCE)
21 typedef unsigned long sigset_t;
24 * Macro for manipulating signal masks.
26 #ifndef __minix
27 #define __sigmask(n) (1 << (((unsigned int)(n) - 1)))
28 #else /* __minix */
29 #define __sigmask(n) (1 << (unsigned int)(n))
30 #endif /* !__minix */
31 #define __sigaddset(s, n) \
32 do { \
33 *(s) = *(unsigned long *)(s) | __sigmask(n); \
34 } while(0)
35 #define __sigdelset(s, n) \
36 do { \
37 *(s) = *(unsigned long *)(s) & ~__sigmask(n); \
38 } while (0)
40 #define __sigismember(s, n) (((*(const unsigned long *)(s)) & __sigmask(n)) != 0)
41 #define __sigemptyset(s) (*(unsigned long *)(s) = 0)
42 #define __sigsetequal(s1, s2) (*(unsigned long *)(s1) = *(unsigned long *)(s2))
43 #define __sigfillset(s) (*(long *)(s) = -1L)
44 #define __sigplusset(s, t) \
45 do { \
46 *(t) = *(unsigned long *)(t) | *(unsigned long *)(s); \
47 } while (0)
48 #define __sigminusset(s, t) \
49 do { \
50 *(t) = *(unsigned long *)(t) & ~*(unsigned long *)(s); \
51 } while (0)
52 #define __sigandset(s, t) \
53 do { \
54 *(t) = *(unsigned long *)(t) & *(unsigned long *)(s); \
55 } while (0)
57 #if (defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED)) || \
58 (_XOPEN_SOURCE - 0) >= 500 || defined(_NETBSD_SOURCE)
59 typedef struct
60 #if defined(_NETBSD_SOURCE)
61 sigaltstack
62 #endif /* _NETBSD_SOURCE */
64 void *ss_sp; /* signal stack base */
65 size_t ss_size; /* signal stack length */
66 int ss_flags; /* SS_DISABLE and/or SS_ONSTACK */
67 } stack_t;
69 #endif /* _XOPEN_SOURCE_EXTENDED || XOPEN_SOURCE >= 500 || _NETBSD_SOURCE */
71 #endif /* _POSIX_C_SOURCE || _XOPEN_SOURCE || ... */
72 #endif /* !_SYS_SIGTYPES_H_ */