]>
Commit | Line | Data |
---|---|---|
2aa62f2b | 1 | /* $NetBSD: sigtypes.h,v 1.8 2005/12/11 12:25:21 christos Exp $ */\r |
2 | \r | |
3 | /*\r | |
4 | * Copyright (c) 1982, 1986, 1989, 1991, 1993\r | |
5 | * The Regents of the University of California. All rights reserved.\r | |
6 | * (c) UNIX System Laboratories, Inc.\r | |
7 | * All or some portions of this file are derived from material licensed\r | |
8 | * to the University of California by American Telephone and Telegraph\r | |
9 | * Co. or Unix System Laboratories, Inc. and are reproduced herein with\r | |
10 | * the permission of UNIX System Laboratories, Inc.\r | |
11 | *\r | |
12 | * Redistribution and use in source and binary forms, with or without\r | |
13 | * modification, are permitted provided that the following conditions\r | |
14 | * are met:\r | |
15 | * 1. Redistributions of source code must retain the above copyright\r | |
16 | * notice, this list of conditions and the following disclaimer.\r | |
17 | * 2. Redistributions in binary form must reproduce the above copyright\r | |
18 | * notice, this list of conditions and the following disclaimer in the\r | |
19 | * documentation and/or other materials provided with the distribution.\r | |
20 | * 3. Neither the name of the University nor the names of its contributors\r | |
21 | * may be used to endorse or promote products derived from this software\r | |
22 | * without specific prior written permission.\r | |
23 | *\r | |
24 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\r | |
25 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r | |
26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r | |
27 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\r | |
28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r | |
29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r | |
30 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r | |
31 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r | |
32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r | |
33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r | |
34 | * SUCH DAMAGE.\r | |
35 | *\r | |
36 | * @(#)signal.h 8.4 (Berkeley) 5/4/95\r | |
37 | */\r | |
38 | \r | |
39 | #ifndef _SYS_SIGTYPES_H_\r | |
40 | #define _SYS_SIGTYPES_H_\r | |
41 | \r | |
42 | /*\r | |
43 | * This header file defines various signal-related types. We also keep\r | |
44 | * the macros to manipulate sigset_t here, to encapsulate knowledge of\r | |
45 | * its internals.\r | |
46 | */\r | |
47 | \r | |
48 | #include <sys/featuretest.h>\r | |
49 | #include <machine/int_types.h>\r | |
50 | #include <machine/ansi.h>\r | |
51 | \r | |
52 | #ifdef _EFI_SIZE_T_\r | |
53 | typedef _EFI_SIZE_T_ size_t;\r | |
54 | #undef _EFI_SIZE_T_\r | |
55 | #undef _BSD_SIZE_T_\r | |
56 | #endif\r | |
57 | \r | |
58 | #if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \\r | |
59 | defined(_NETBSD_SOURCE)\r | |
60 | \r | |
61 | typedef struct {\r | |
62 | __uint32_t __bits[4];\r | |
63 | } sigset_t;\r | |
64 | \r | |
65 | /*\r | |
66 | * Macro for manipulating signal masks.\r | |
67 | */\r | |
68 | #define __sigmask(n) (1 << (((unsigned int)(n) - 1) & 31))\r | |
69 | #define __sigword(n) (((unsigned int)(n) - 1) >> 5)\r | |
70 | #define __sigaddset(s, n) ((s)->__bits[__sigword(n)] |= __sigmask(n))\r | |
71 | #define __sigdelset(s, n) ((s)->__bits[__sigword(n)] &= ~__sigmask(n))\r | |
72 | #define __sigismember(s, n) (((s)->__bits[__sigword(n)] & __sigmask(n)) != 0)\r | |
73 | #define __sigemptyset(s) ((s)->__bits[0] = 0x00000000, \\r | |
74 | (s)->__bits[1] = 0x00000000, \\r | |
75 | (s)->__bits[2] = 0x00000000, \\r | |
76 | (s)->__bits[3] = 0x00000000)\r | |
77 | #define __sigsetequal(s1,s2) ((s1)->__bits[0] == (s2)->__bits[0] && \\r | |
78 | (s1)->__bits[1] == (s2)->__bits[1] && \\r | |
79 | (s1)->__bits[2] == (s2)->__bits[2] && \\r | |
80 | (s1)->__bits[3] == (s2)->__bits[3])\r | |
81 | #define __sigfillset(s) ((s)->__bits[0] = 0xffffffff, \\r | |
82 | (s)->__bits[1] = 0xffffffff, \\r | |
83 | (s)->__bits[2] = 0xffffffff, \\r | |
84 | (s)->__bits[3] = 0xffffffff)\r | |
85 | #define __sigplusset(s, t) \\r | |
86 | do { \\r | |
87 | (t)->__bits[0] |= (s)->__bits[0]; \\r | |
88 | (t)->__bits[1] |= (s)->__bits[1]; \\r | |
89 | (t)->__bits[2] |= (s)->__bits[2]; \\r | |
90 | (t)->__bits[3] |= (s)->__bits[3]; \\r | |
91 | } while (/* CONSTCOND */ 0)\r | |
92 | #define __sigminusset(s, t) \\r | |
93 | do { \\r | |
94 | (t)->__bits[0] &= ~(s)->__bits[0]; \\r | |
95 | (t)->__bits[1] &= ~(s)->__bits[1]; \\r | |
96 | (t)->__bits[2] &= ~(s)->__bits[2]; \\r | |
97 | (t)->__bits[3] &= ~(s)->__bits[3]; \\r | |
98 | } while (/* CONSTCOND */ 0)\r | |
99 | #define __sigandset(s, t) \\r | |
100 | do { \\r | |
101 | (t)->__bits[0] &= (s)->__bits[0]; \\r | |
102 | (t)->__bits[1] &= (s)->__bits[1]; \\r | |
103 | (t)->__bits[2] &= (s)->__bits[2]; \\r | |
104 | (t)->__bits[3] &= (s)->__bits[3]; \\r | |
105 | } while (/* CONSTCOND */ 0)\r | |
106 | \r | |
107 | #if (defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED)) || \\r | |
108 | (_XOPEN_SOURCE - 0) >= 500 || defined(_NETBSD_SOURCE)\r | |
109 | typedef struct\r | |
110 | #if defined(_NETBSD_SOURCE)\r | |
111 | sigaltstack\r | |
112 | #endif /* _NETBSD_SOURCE */\r | |
113 | {\r | |
114 | void *ss_sp; /* signal stack base */\r | |
115 | size_t ss_size; /* signal stack length */\r | |
116 | int ss_flags; /* SS_DISABLE and/or SS_ONSTACK */\r | |
117 | } stack_t;\r | |
118 | \r | |
119 | #endif /* _XOPEN_SOURCE_EXTENDED || XOPEN_SOURCE >= 500 || _NETBSD_SOURCE */\r | |
120 | \r | |
121 | #endif /* _POSIX_C_SOURCE || _XOPEN_SOURCE || ... */\r | |
122 | \r | |
123 | #endif /* !_SYS_SIGTYPES_H_ */\r |