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