Print this page
OS-4300 increase RT signal count
Reviewed by: Robert Mustacchi <rm@joyent.com>
| Split |
Close |
| Expand all |
| Collapse all |
--- old/usr/src/uts/common/sys/signal.h
+++ new/usr/src/uts/common/sys/signal.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
↓ open down ↓ |
14 lines elided |
↑ open up ↑ |
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21
22 22 /*
23 23 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
24 24 * Use is subject to license terms.
25 + * Copyright 2015, Joyent, Inc.
25 26 */
26 27
27 28 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
28 29 /* All Rights Reserved */
29 30
30 31 /*
31 32 * University Copyright- Copyright (c) 1982, 1986, 1988
32 33 * The Regents of the University of California
33 34 * All Rights Reserved
34 35 *
35 36 * University Acknowledgment- Portions of this document are derived from
36 37 * software developed by the University of California, Berkeley, and its
37 38 * contributors.
38 39 */
39 40
40 41 #ifndef _SYS_SIGNAL_H
41 42 #define _SYS_SIGNAL_H
42 43
43 44 #include <sys/feature_tests.h>
44 45 #include <sys/iso/signal_iso.h>
45 46
46 47 #ifdef __cplusplus
47 48 extern "C" {
48 49 #endif
49 50
50 51 #if defined(__EXTENSIONS__) || defined(_KERNEL) || !defined(_STRICT_STDC) || \
51 52 defined(__XOPEN_OR_POSIX)
52 53
53 54 #if defined(__EXTENSIONS__) || defined(_KERNEL) || \
54 55 (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \
55 56 (_POSIX_C_SOURCE > 2) || defined(_XPG4_2)
56 57 /*
57 58 * We need <sys/siginfo.h> for the declaration of siginfo_t.
58 59 */
59 60 #include <sys/siginfo.h>
60 61 #endif
61 62
62 63 /* Duplicated in <sys/ucontext.h> as a result of XPG4v2 requirements */
63 64 #ifndef _SIGSET_T
64 65 #define _SIGSET_T
65 66 typedef struct { /* signal set type */
66 67 unsigned int __sigbits[4];
67 68 } sigset_t;
68 69 #endif /* _SIGSET_T */
69 70
70 71 typedef struct {
71 72 unsigned int __sigbits[3];
72 73 } k_sigset_t;
73 74
74 75 /*
75 76 * The signal handler routine can have either one or three arguments.
76 77 * Existing C code has used either form so not specifing the arguments
77 78 * neatly finesses the problem. C++ doesn't accept this. To C++
78 79 * "(*sa_handler)()" indicates a routine with no arguments (ANSI C would
79 80 * specify this as "(*sa_handler)(void)"). One or the other form must be
80 81 * used for C++ and the only logical choice is "(*sa_handler)(int)" to allow
81 82 * the SIG_* defines to work. "(*sa_sigaction)(int, siginfo_t *, void *)"
82 83 * can be used for the three argument form.
83 84 */
84 85
85 86 /*
86 87 * Note: storage overlap by sa_handler and sa_sigaction
87 88 */
88 89 struct sigaction {
89 90 int sa_flags;
90 91 union {
91 92 #ifdef __cplusplus
92 93 void (*_handler)(int);
93 94 #else
94 95 void (*_handler)();
95 96 #endif
96 97 #if defined(__EXTENSIONS__) || defined(_KERNEL) || \
97 98 (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \
98 99 (_POSIX_C_SOURCE > 2) || defined(_XPG4_2)
99 100 void (*_sigaction)(int, siginfo_t *, void *);
100 101 #endif
101 102 } _funcptr;
102 103 sigset_t sa_mask;
103 104 #ifndef _LP64
104 105 int sa_resv[2];
105 106 #endif
106 107 };
107 108 #define sa_handler _funcptr._handler
108 109 #define sa_sigaction _funcptr._sigaction
109 110
110 111 #if defined(_SYSCALL32)
111 112
112 113 /* Kernel view of the ILP32 user sigaction structure */
113 114
114 115 struct sigaction32 {
115 116 int32_t sa_flags;
116 117 union {
117 118 caddr32_t _handler;
118 119 caddr32_t _sigaction;
119 120 } _funcptr;
120 121 sigset_t sa_mask;
121 122 int32_t sa_resv[2];
122 123 };
123 124
124 125 #endif /* _SYSCALL32 */
125 126
126 127 /* this is only valid for SIGCLD */
127 128 #define SA_NOCLDSTOP 0x00020000 /* don't send job control SIGCLD's */
128 129 #endif
129 130
130 131 #if defined(__EXTENSIONS__) || defined(_KERNEL) || \
131 132 (!defined(_STRICT_STDC) && !defined(_POSIX_C_SOURCE)) || \
132 133 defined(_XPG4_2)
133 134
134 135 /* non-conformant ANSI compilation */
135 136
136 137 /* definitions for the sa_flags field */
137 138 #define SA_ONSTACK 0x00000001
138 139 #define SA_RESETHAND 0x00000002
139 140 #define SA_RESTART 0x00000004
140 141 #endif
141 142
142 143 #if defined(__EXTENSIONS__) || defined(_KERNEL) || \
143 144 (!defined(_STRICT_STDC) && !defined(_POSIX_C_SOURCE)) || \
144 145 (_POSIX_C_SOURCE > 2) || defined(_XPG4_2)
145 146 #define SA_SIGINFO 0x00000008
146 147 #endif
147 148
148 149 #if defined(__EXTENSIONS__) || defined(_KERNEL) || \
149 150 (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \
150 151 defined(_XPG4_2)
|
↓ open down ↓ |
116 lines elided |
↑ open up ↑ |
151 152 #define SA_NODEFER 0x00000010
152 153
153 154 /* this is only valid for SIGCLD */
154 155 #define SA_NOCLDWAIT 0x00010000 /* don't save zombie children */
155 156
156 157 #if defined(__EXTENSIONS__) || !defined(_XPG4_2)
157 158 /*
158 159 * use of these symbols by applications is injurious
159 160 * to binary compatibility
160 161 */
161 -#define NSIG 74 /* valid signals range from 1 to NSIG-1 */
162 -#define MAXSIG 73 /* size of u_signal[], NSIG-1 <= MAXSIG */
162 +#define NSIG 75 /* valid signals range from 1 to NSIG-1 */
163 +#define MAXSIG 74 /* size of u_signal[], NSIG-1 <= MAXSIG */
163 164 #endif /* defined(__EXTENSIONS__) || !defined(_XPG4_2) */
164 165
165 166 #define MINSIGSTKSZ 2048
166 167 #define SIGSTKSZ 8192
167 168
168 169 #define SS_ONSTACK 0x00000001
169 170 #define SS_DISABLE 0x00000002
170 171
171 172 /* Duplicated in <sys/ucontext.h> as a result of XPG4v2 requirements. */
172 173 #ifndef _STACK_T
173 174 #define _STACK_T
174 175 #if defined(__EXTENSIONS__) || !defined(_XPG4_2)
175 176 typedef struct sigaltstack {
176 177 #else
177 178 typedef struct {
178 179 #endif
179 180 void *ss_sp;
180 181 size_t ss_size;
181 182 int ss_flags;
182 183 } stack_t;
183 184
184 185 #if defined(_SYSCALL32)
185 186
186 187 /* Kernel view of the ILP32 user sigaltstack structure */
187 188
188 189 typedef struct sigaltstack32 {
189 190 caddr32_t ss_sp;
190 191 size32_t ss_size;
191 192 int32_t ss_flags;
192 193 } stack32_t;
193 194
194 195 #endif /* _SYSCALL32 */
195 196
196 197 #endif /* _STACK_T */
197 198
198 199 #endif /* defined(__EXTENSIONS__) || defined(_KERNEL) ... */
199 200
200 201 #if defined(__EXTENSIONS__) || defined(_KERNEL) || \
201 202 (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX))
202 203
203 204 /* signotify id used only by libc for mq_notify()/aio_notify() */
204 205 typedef struct signotify_id { /* signotify id struct */
205 206 pid_t sn_pid; /* pid of proc to be notified */
206 207 int sn_index; /* index in preallocated pool */
207 208 int sn_pad; /* reserved */
208 209 } signotify_id_t;
209 210
210 211 #if defined(_SYSCALL32)
211 212
212 213 /* Kernel view of the ILP32 user signotify_id structure */
213 214
214 215 typedef struct signotify32_id {
215 216 pid32_t sn_pid; /* pid of proc to be notified */
216 217 int32_t sn_index; /* index in preallocated pool */
217 218 int32_t sn_pad; /* reserved */
218 219 } signotify32_id_t;
219 220
220 221 #endif /* _SYSCALL32 */
221 222
222 223 /* Command codes for sig_notify call */
223 224
224 225 #define SN_PROC 1 /* queue signotify for process */
225 226 #define SN_CANCEL 2 /* cancel the queued signotify */
226 227 #define SN_SEND 3 /* send the notified signal */
227 228
228 229 #endif /* defined(__EXTENSIONS__) || defined(_KERNEL) ... */
229 230
230 231 /* Added as per XPG4v2 */
231 232 #if defined(__EXTENSIONS__) || defined(_KERNEL) || \
232 233 (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \
233 234 defined(_XPG4_2)
234 235 struct sigstack {
235 236 void *ss_sp;
236 237 int ss_onstack;
237 238 };
238 239 #endif /* defined(__EXTENSIONS__) || defined(_KERNEL) ... */
239 240
240 241 /*
241 242 * For definition of ucontext_t; must follow struct definition
242 243 * for sigset_t
243 244 */
244 245 #if defined(_XPG4_2)
245 246 #include <sys/ucontext.h>
246 247 #endif /* defined(_XPG4_2) */
247 248
248 249 #ifdef _KERNEL
249 250 #include <sys/t_lock.h>
250 251
251 252 extern const k_sigset_t nullsmask; /* a null signal mask */
252 253 extern const k_sigset_t fillset; /* all signals, guaranteed contiguous */
253 254 extern const k_sigset_t cantmask; /* cannot be caught or ignored */
254 255 extern const k_sigset_t cantreset; /* cannot be reset after catching */
255 256 extern const k_sigset_t ignoredefault; /* ignored by default */
256 257 extern const k_sigset_t stopdefault; /* stop by default */
257 258 extern const k_sigset_t coredefault; /* dumps core by default */
258 259 extern const k_sigset_t holdvfork; /* held while doing vfork */
259 260
260 261 #define sigmask(n) ((unsigned int)1 << (((n) - 1) & (32 - 1)))
261 262 #define sigword(n) (((unsigned int)((n) - 1))>>5)
262 263
263 264 #if ((MAXSIG > (2 * 32)) && (MAXSIG <= (3 * 32)))
264 265 #define FILLSET0 0xffffffffu
265 266 #define FILLSET1 0xffffffffu
266 267 #define FILLSET2 ((1u << (MAXSIG - 64)) - 1)
267 268 #else
268 269 #error "fix me: MAXSIG out of bounds"
269 270 #endif
270 271
271 272 #define CANTMASK0 (sigmask(SIGKILL)|sigmask(SIGSTOP))
272 273 #define CANTMASK1 0
273 274 #define CANTMASK2 0
274 275
275 276 #define sigemptyset(s) (*(s) = nullsmask)
276 277 #define sigfillset(s) (*(s) = fillset)
277 278 #define sigaddset(s, n) ((s)->__sigbits[sigword(n)] |= sigmask(n))
278 279 #define sigdelset(s, n) ((s)->__sigbits[sigword(n)] &= ~sigmask(n))
279 280 #define sigismember(s, n) (sigmask(n) & (s)->__sigbits[sigword(n)])
280 281 #define sigisempty(s) (!((s)->__sigbits[0] | (s)->__sigbits[1] | \
281 282 (s)->__sigbits[2]))
282 283 #define sigutok(us, ks) \
283 284 ((ks)->__sigbits[0] = (us)->__sigbits[0] & (FILLSET0 & ~CANTMASK0), \
284 285 (ks)->__sigbits[1] = (us)->__sigbits[1] & (FILLSET1 & ~CANTMASK1), \
285 286 (ks)->__sigbits[2] = (us)->__sigbits[2] & (FILLSET2 & ~CANTMASK2))
286 287 #define sigktou(ks, us) ((us)->__sigbits[0] = (ks)->__sigbits[0], \
287 288 (us)->__sigbits[1] = (ks)->__sigbits[1], \
288 289 (us)->__sigbits[2] = (ks)->__sigbits[2], \
289 290 (us)->__sigbits[3] = 0)
290 291 typedef struct {
291 292 int sig; /* signal no. */
292 293 int perm; /* flag for EPERM */
293 294 int checkperm; /* check perm or not */
294 295 int sicode; /* has siginfo.si_code */
295 296 union sigval value; /* user specified value */
296 297 } sigsend_t;
297 298
298 299 typedef struct {
299 300 sigqueue_t sn_sigq; /* sigq struct for notification */
300 301 u_longlong_t sn_snid; /* unique id for notification */
301 302 } signotifyq_t;
302 303
303 304 typedef struct sigqhdr { /* sigqueue pool header */
304 305 sigqueue_t *sqb_free; /* free sigq struct list */
305 306 int sqb_count; /* sigq free count */
306 307 uint_t sqb_maxcount; /* sigq max free count */
307 308 size_t sqb_size; /* size of header+free structs */
308 309 uchar_t sqb_pexited; /* process has exited */
309 310 uint_t sqb_sent; /* number of sigq sent */
310 311 kcondvar_t sqb_cv; /* waiting for a sigq struct */
311 312 kmutex_t sqb_lock; /* lock for sigq pool */
312 313 } sigqhdr_t;
313 314
314 315 #define _SIGQUEUE_SIZE_BASIC 128 /* basic limit */
315 316 #define _SIGQUEUE_SIZE_PRIVILEGED 512 /* privileged limit */
316 317
317 318 #define _SIGNOTIFY_MAX 32
318 319
319 320 extern void setsigact(int, void (*)(int), const k_sigset_t *, int);
320 321 extern void sigorset(k_sigset_t *, const k_sigset_t *);
321 322 extern void sigandset(k_sigset_t *, const k_sigset_t *);
322 323 extern void sigdiffset(k_sigset_t *, const k_sigset_t *);
323 324 extern void sigintr(k_sigset_t *, int);
324 325 extern void sigunintr(k_sigset_t *);
325 326 extern void sigreplace(k_sigset_t *, k_sigset_t *);
326 327
327 328 extern int kill(pid_t, int);
328 329
329 330 #endif /* _KERNEL */
330 331
331 332 #ifdef __cplusplus
332 333 }
333 334 #endif
334 335
335 336 #endif /* _SYS_SIGNAL_H */
|
↓ open down ↓ |
163 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX