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