1 | @c |
---|
2 | @c COPYRIGHT (c) 1988-1998. |
---|
3 | @c On-Line Applications Research Corporation (OAR). |
---|
4 | @c All rights reserved. |
---|
5 | @c |
---|
6 | @c $Id$ |
---|
7 | @c |
---|
8 | |
---|
9 | @chapter Signal Manager |
---|
10 | |
---|
11 | @section Introduction |
---|
12 | |
---|
13 | The signal manager ... |
---|
14 | |
---|
15 | The directives provided by the signal manager are: |
---|
16 | |
---|
17 | @itemize @bullet |
---|
18 | @item @code{sigaddset} - |
---|
19 | @item @code{sigdelset} - |
---|
20 | @item @code{sigfillset} - |
---|
21 | @item @code{sigismember} - |
---|
22 | @item @code{sigemptyset} - |
---|
23 | @item @code{sigaction} - |
---|
24 | @item @code{pthread_kill} - |
---|
25 | @item @code{sigprocmask} - |
---|
26 | @item @code{pthread_sigmask} - |
---|
27 | @item @code{kill} - |
---|
28 | @item @code{sigpending} - |
---|
29 | @item @code{sigsuspend} - |
---|
30 | @item @code{pause} - |
---|
31 | @item @code{sigwait} - |
---|
32 | @item @code{sigwaitinfo} - |
---|
33 | @item @code{sigtimedwait} - |
---|
34 | @item @code{sigqueue} - |
---|
35 | @item @code{alarm} - |
---|
36 | @end itemize |
---|
37 | |
---|
38 | @section Background |
---|
39 | |
---|
40 | @subsection Signal Delivery |
---|
41 | |
---|
42 | Signals directed at a thread are delivered to the specified thread. |
---|
43 | |
---|
44 | Signals directed at a process are delivered to a thread which is selected |
---|
45 | based on the following algorithm: |
---|
46 | |
---|
47 | @enumerate |
---|
48 | @item If the action for this signal is currently SIG_IGN, then the signal |
---|
49 | is simply ignored. |
---|
50 | |
---|
51 | @item If the currently executing thread has the signal unblocked, then |
---|
52 | the signal is delivered to it. |
---|
53 | |
---|
54 | @item If any threads are currently blocked waiting for this signal |
---|
55 | (sigwait()), then the signal is delivered to the highest priority |
---|
56 | thread waiting for this signal. |
---|
57 | |
---|
58 | @item If any other threads are willing to accept delivery of the signal, then |
---|
59 | the signal is delivered to the highest priority thread of this set. In the |
---|
60 | event, multiple threads of the same priority are willing to accept this |
---|
61 | signal, then priority is given first to ready threads, then to threads |
---|
62 | blocked on calls which may be interrupted, and finally to threads blocked |
---|
63 | on non-interruptible calls. |
---|
64 | |
---|
65 | @item In the event the signal still can not be delivered, then it is left |
---|
66 | pending. The first thread to unblock the signal (sigprocmask() or |
---|
67 | pthread_sigprocmask()) or to wait for this signal (sigwait()) will be |
---|
68 | the recipient of the signal. |
---|
69 | |
---|
70 | @end enumerate |
---|
71 | |
---|
72 | @section Operations |
---|
73 | |
---|
74 | @section Directives |
---|
75 | |
---|
76 | This section details the signal manager's directives. |
---|
77 | A subsection is dedicated to each of this manager's directives |
---|
78 | and describes the calling sequence, related constants, usage, |
---|
79 | and status codes. |
---|
80 | |
---|
81 | @page |
---|
82 | @subsection sigaddset |
---|
83 | |
---|
84 | @subheading CALLING SEQUENCE: |
---|
85 | |
---|
86 | @example |
---|
87 | #include <signal.h> |
---|
88 | |
---|
89 | int sigaddset( |
---|
90 | sigset_t *set, |
---|
91 | int signo |
---|
92 | ); |
---|
93 | @end example |
---|
94 | |
---|
95 | @subheading STATUS CODES: |
---|
96 | |
---|
97 | @table @b |
---|
98 | @item EINVAL |
---|
99 | Invalid argument passed. |
---|
100 | |
---|
101 | @end table |
---|
102 | |
---|
103 | @subheading DESCRIPTION: |
---|
104 | |
---|
105 | @subheading NOTES: |
---|
106 | |
---|
107 | @page |
---|
108 | @subsection sigdelset |
---|
109 | |
---|
110 | @subheading CALLING SEQUENCE: |
---|
111 | |
---|
112 | @example |
---|
113 | #include <signal.h> |
---|
114 | |
---|
115 | int sigdelset( |
---|
116 | sigset_t *set, |
---|
117 | int signo |
---|
118 | ); |
---|
119 | @end example |
---|
120 | |
---|
121 | @subheading STATUS CODES: |
---|
122 | |
---|
123 | @table @b |
---|
124 | @item EINVAL |
---|
125 | Invalid argument passed. |
---|
126 | |
---|
127 | @end table |
---|
128 | |
---|
129 | @subheading DESCRIPTION: |
---|
130 | |
---|
131 | @subheading NOTES: |
---|
132 | |
---|
133 | @page |
---|
134 | @subsection sigfillset |
---|
135 | |
---|
136 | @subheading CALLING SEQUENCE: |
---|
137 | |
---|
138 | @example |
---|
139 | #include <signal.h> |
---|
140 | |
---|
141 | int sigfillset( |
---|
142 | sigset_t *set |
---|
143 | ); |
---|
144 | @end example |
---|
145 | |
---|
146 | @subheading STATUS CODES: |
---|
147 | @table @b |
---|
148 | @item EINVAL |
---|
149 | Invalid argument passed. |
---|
150 | |
---|
151 | @end table |
---|
152 | |
---|
153 | @subheading DESCRIPTION: |
---|
154 | |
---|
155 | @subheading NOTES: |
---|
156 | |
---|
157 | @page |
---|
158 | @subsection sigismember |
---|
159 | |
---|
160 | @subheading CALLING SEQUENCE: |
---|
161 | |
---|
162 | @example |
---|
163 | #include <signal.h> |
---|
164 | |
---|
165 | int sigismember( |
---|
166 | const sigset_t *set, |
---|
167 | int signo |
---|
168 | ); |
---|
169 | @end example |
---|
170 | |
---|
171 | @subheading STATUS CODES: |
---|
172 | @table @b |
---|
173 | @item EINVAL |
---|
174 | Invalid argument passed. |
---|
175 | |
---|
176 | @end table |
---|
177 | |
---|
178 | @subheading DESCRIPTION: |
---|
179 | |
---|
180 | @subheading NOTES: |
---|
181 | |
---|
182 | @page |
---|
183 | @subsection sigemptyset |
---|
184 | |
---|
185 | @subheading CALLING SEQUENCE: |
---|
186 | |
---|
187 | @example |
---|
188 | #include <signal.h> |
---|
189 | |
---|
190 | int sigemptyset( |
---|
191 | sigset_t *set |
---|
192 | ); |
---|
193 | @end example |
---|
194 | |
---|
195 | @subheading STATUS CODES: |
---|
196 | |
---|
197 | @table @b |
---|
198 | @item EINVAL |
---|
199 | Invalid argument passed. |
---|
200 | |
---|
201 | @end table |
---|
202 | |
---|
203 | @subheading DESCRIPTION: |
---|
204 | |
---|
205 | @subheading NOTES: |
---|
206 | |
---|
207 | @page |
---|
208 | @subsection sigaction |
---|
209 | |
---|
210 | @subheading CALLING SEQUENCE: |
---|
211 | |
---|
212 | @example |
---|
213 | #include <signal.h> |
---|
214 | |
---|
215 | int sigaction( |
---|
216 | int sig, |
---|
217 | const struct sigaction *act, |
---|
218 | struct sigaction *oact |
---|
219 | ); |
---|
220 | @end example |
---|
221 | |
---|
222 | @subheading STATUS CODES: |
---|
223 | |
---|
224 | @table @b |
---|
225 | @item EINVAL |
---|
226 | Invalid argument passed. |
---|
227 | |
---|
228 | @item ENOTSUP |
---|
229 | Realtime Signals Extension option not supported. |
---|
230 | |
---|
231 | @end table |
---|
232 | |
---|
233 | @subheading DESCRIPTION: |
---|
234 | |
---|
235 | @subheading NOTES: |
---|
236 | |
---|
237 | The signal number cannot be SIGKILL. |
---|
238 | @page |
---|
239 | @subsection pthread_kill |
---|
240 | |
---|
241 | @subheading CALLING SEQUENCE: |
---|
242 | |
---|
243 | @example |
---|
244 | #include <signal.h> |
---|
245 | |
---|
246 | int pthread_kill( |
---|
247 | pthread_t thread, |
---|
248 | int sig |
---|
249 | ); |
---|
250 | @end example |
---|
251 | |
---|
252 | @subheading STATUS CODES: |
---|
253 | @table @b |
---|
254 | @item ESRCH |
---|
255 | The thread indicated by the parameter thread is invalid. |
---|
256 | |
---|
257 | @item EINVAL |
---|
258 | Invalid argument passed. |
---|
259 | |
---|
260 | @end table |
---|
261 | |
---|
262 | @subheading DESCRIPTION: |
---|
263 | |
---|
264 | @subheading NOTES: |
---|
265 | |
---|
266 | @page |
---|
267 | @subsection sigprocmask |
---|
268 | |
---|
269 | @subheading CALLING SEQUENCE: |
---|
270 | |
---|
271 | @example |
---|
272 | #include <signal.h> |
---|
273 | |
---|
274 | int sigprocmask( |
---|
275 | int how, |
---|
276 | const sigset_t *set, |
---|
277 | sigset_t *oset |
---|
278 | ); |
---|
279 | @end example |
---|
280 | |
---|
281 | @subheading STATUS CODES: |
---|
282 | @table @b |
---|
283 | @item EINVAL |
---|
284 | Invalid argument passed. |
---|
285 | |
---|
286 | @end table |
---|
287 | |
---|
288 | @subheading DESCRIPTION: |
---|
289 | |
---|
290 | @subheading NOTES: |
---|
291 | |
---|
292 | |
---|
293 | @page |
---|
294 | @subsection pthread_sigmask |
---|
295 | |
---|
296 | @subheading CALLING SEQUENCE: |
---|
297 | |
---|
298 | @example |
---|
299 | #include <signal.h> |
---|
300 | |
---|
301 | int pthread_sigmask( |
---|
302 | int how, |
---|
303 | const sigset_t *set, |
---|
304 | sigset_t *oset |
---|
305 | ); |
---|
306 | @end example |
---|
307 | |
---|
308 | @subheading STATUS CODES: |
---|
309 | @table @b |
---|
310 | @item EINVAL |
---|
311 | Invalid argument passed. |
---|
312 | |
---|
313 | @end table |
---|
314 | |
---|
315 | @subheading DESCRIPTION: |
---|
316 | |
---|
317 | @subheading NOTES: |
---|
318 | |
---|
319 | |
---|
320 | @page |
---|
321 | @subsection kill |
---|
322 | |
---|
323 | @subheading CALLING SEQUENCE: |
---|
324 | |
---|
325 | @example |
---|
326 | #include <sys/types.h> |
---|
327 | #include <signal.h> |
---|
328 | |
---|
329 | int kill( |
---|
330 | pid_t pid, |
---|
331 | int sig |
---|
332 | ); |
---|
333 | @end example |
---|
334 | |
---|
335 | @subheading STATUS CODES: |
---|
336 | @table @b |
---|
337 | @item EINVAL |
---|
338 | Invalid argument passed. |
---|
339 | |
---|
340 | @item EPERM |
---|
341 | Process does not have permission to send the signal to any receiving process. |
---|
342 | |
---|
343 | @item ESRCH |
---|
344 | The process indicated by the parameter pid is invalid. |
---|
345 | |
---|
346 | @end table |
---|
347 | |
---|
348 | @subheading DESCRIPTION: |
---|
349 | |
---|
350 | @subheading NOTES: |
---|
351 | |
---|
352 | |
---|
353 | @page |
---|
354 | @subsection sigpending |
---|
355 | |
---|
356 | @subheading CALLING SEQUENCE: |
---|
357 | |
---|
358 | @example |
---|
359 | #include <signal.h> |
---|
360 | |
---|
361 | int sigpending( |
---|
362 | const sigset_t *set |
---|
363 | ); |
---|
364 | @end example |
---|
365 | |
---|
366 | @subheading STATUS CODES: |
---|
367 | |
---|
368 | On error, this routine returns -1 and sets errno to one of the following: |
---|
369 | |
---|
370 | @table @b |
---|
371 | @item EFAULT |
---|
372 | Invalid address for set. |
---|
373 | |
---|
374 | @end table |
---|
375 | |
---|
376 | @subheading DESCRIPTION: |
---|
377 | |
---|
378 | @subheading NOTES: |
---|
379 | |
---|
380 | @page |
---|
381 | @subsection sigsuspend |
---|
382 | |
---|
383 | @subheading CALLING SEQUENCE: |
---|
384 | |
---|
385 | @example |
---|
386 | #include <signal.h> |
---|
387 | |
---|
388 | int sigsuspend( |
---|
389 | const sigset_t *sigmask |
---|
390 | ); |
---|
391 | @end example |
---|
392 | |
---|
393 | @subheading STATUS CODES: |
---|
394 | @table @b |
---|
395 | Returns -1 and sets errno. |
---|
396 | |
---|
397 | @item EINTR |
---|
398 | Signal interrupted this function. |
---|
399 | |
---|
400 | @end table |
---|
401 | |
---|
402 | @subheading DESCRIPTION: |
---|
403 | |
---|
404 | @subheading NOTES: |
---|
405 | |
---|
406 | @page |
---|
407 | @subsection pause |
---|
408 | |
---|
409 | @subheading CALLING SEQUENCE: |
---|
410 | |
---|
411 | @example |
---|
412 | #include <signal.h> |
---|
413 | |
---|
414 | int pause( void ); |
---|
415 | @end example |
---|
416 | |
---|
417 | @subheading STATUS CODES: |
---|
418 | @table @b |
---|
419 | Returns -1 and sets errno. |
---|
420 | |
---|
421 | @item EINTR |
---|
422 | Signal interrupted this function. |
---|
423 | |
---|
424 | @end table |
---|
425 | |
---|
426 | @subheading DESCRIPTION: |
---|
427 | |
---|
428 | @subheading NOTES: |
---|
429 | |
---|
430 | @page |
---|
431 | @subsection sigwait |
---|
432 | |
---|
433 | @subheading CALLING SEQUENCE: |
---|
434 | |
---|
435 | @example |
---|
436 | #include <signal.h> |
---|
437 | |
---|
438 | int sigwait( |
---|
439 | const sigset_t *set, |
---|
440 | int *sig |
---|
441 | ); |
---|
442 | @end example |
---|
443 | |
---|
444 | @subheading STATUS CODES: |
---|
445 | @table @b |
---|
446 | @item EINVAL |
---|
447 | Invalid argument passed. |
---|
448 | |
---|
449 | @item EINTR |
---|
450 | Signal interrupted this function. |
---|
451 | |
---|
452 | @end table |
---|
453 | |
---|
454 | @subheading DESCRIPTION: |
---|
455 | |
---|
456 | @subheading NOTES: |
---|
457 | |
---|
458 | @page |
---|
459 | @subsection sigwaitinfo |
---|
460 | |
---|
461 | @subheading CALLING SEQUENCE: |
---|
462 | |
---|
463 | @example |
---|
464 | #include <signal.h> |
---|
465 | |
---|
466 | int sigwaitinfo( |
---|
467 | const sigset_t *set, |
---|
468 | siginfo_t *info |
---|
469 | ); |
---|
470 | @end example |
---|
471 | |
---|
472 | @subheading STATUS CODES: |
---|
473 | @table @b |
---|
474 | @item EINTR |
---|
475 | Signal interrupted this function. |
---|
476 | |
---|
477 | @end table |
---|
478 | |
---|
479 | @subheading DESCRIPTION: |
---|
480 | |
---|
481 | @subheading NOTES: |
---|
482 | |
---|
483 | @page |
---|
484 | @subsection sigtimedwait |
---|
485 | |
---|
486 | @subheading CALLING SEQUENCE: |
---|
487 | |
---|
488 | @example |
---|
489 | #include <signal.h> |
---|
490 | |
---|
491 | int sigtimedwait( |
---|
492 | const sigset_t *set, |
---|
493 | siginfo_t *info, |
---|
494 | const struct timespec *timeout |
---|
495 | ); |
---|
496 | @end example |
---|
497 | |
---|
498 | @subheading STATUS CODES: |
---|
499 | @table @b |
---|
500 | @item EAGAIN |
---|
501 | Timed out while waiting for the specified signal set. |
---|
502 | |
---|
503 | @item EINVAL |
---|
504 | Nanoseconds field of the timeout argument is invalid. |
---|
505 | |
---|
506 | @item EINTR |
---|
507 | Signal interrupted this function. |
---|
508 | |
---|
509 | @end table |
---|
510 | |
---|
511 | @subheading DESCRIPTION: |
---|
512 | |
---|
513 | @subheading NOTES: |
---|
514 | |
---|
515 | If timeout is NULL, then the thread will wait forever for the specified |
---|
516 | signal set. |
---|
517 | |
---|
518 | @page |
---|
519 | @subsection sigqueue |
---|
520 | |
---|
521 | @subheading CALLING SEQUENCE: |
---|
522 | |
---|
523 | @example |
---|
524 | #include <signal.h> |
---|
525 | |
---|
526 | int sigqueue( |
---|
527 | pid_t pid, |
---|
528 | int signo, |
---|
529 | const union sigval value |
---|
530 | ); |
---|
531 | @end example |
---|
532 | |
---|
533 | @subheading STATUS CODES: |
---|
534 | |
---|
535 | @table @b |
---|
536 | |
---|
537 | @item EAGAIN |
---|
538 | No resources available to queue the signal. The process has already |
---|
539 | queued SIGQUEUE_MAX signals that are still pending at the receiver |
---|
540 | or the systemwide resource limit has been exceeded. |
---|
541 | |
---|
542 | @item EINVAL |
---|
543 | The value of the signo argument is an invalid or unsupported signal |
---|
544 | number. |
---|
545 | |
---|
546 | @item EPERM |
---|
547 | The process does not have the appropriate privilege to send the signal |
---|
548 | to the receiving process. |
---|
549 | |
---|
550 | @item ESRCH |
---|
551 | The process pid does not exist. |
---|
552 | |
---|
553 | @end table |
---|
554 | |
---|
555 | @subheading DESCRIPTION: |
---|
556 | |
---|
557 | @subheading NOTES: |
---|
558 | |
---|
559 | |
---|
560 | @page |
---|
561 | @subsection alarm |
---|
562 | |
---|
563 | @subheading CALLING SEQUENCE: |
---|
564 | |
---|
565 | @example |
---|
566 | #include <signal.h> |
---|
567 | |
---|
568 | unsigned int alarm( |
---|
569 | unsigned int seconds |
---|
570 | ); |
---|
571 | @end example |
---|
572 | |
---|
573 | @subheading STATUS CODES: |
---|
574 | |
---|
575 | If there was a previous alarm() request with time remaining, then this routine |
---|
576 | returns the number of seconds until that outstanding alarm would have fired. |
---|
577 | If no previous alarm() request was outstanding, then zero is returned. |
---|
578 | |
---|
579 | @subheading DESCRIPTION: |
---|
580 | |
---|
581 | @subheading NOTES: |
---|
582 | |
---|
583 | |
---|