]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - lib/libc/sys/sigaction.2
Update mandoc to 1.14.2
[FreeBSD/FreeBSD.git] / lib / libc / sys / sigaction.2
1 .\" Copyright (c) 1980, 1990, 1993
2 .\"     The Regents of the University of California.  All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\"    notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\"    notice, this list of conditions and the following disclaimer in the
11 .\"    documentation and/or other materials provided with the distribution.
12 .\" 3. Neither the name of the University nor the names of its contributors
13 .\"    may be used to endorse or promote products derived from this software
14 .\"    without specific prior written permission.
15 .\"
16 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 .\" SUCH DAMAGE.
27 .\"
28 .\"     From: @(#)sigaction.2   8.2 (Berkeley) 4/3/94
29 .\" $FreeBSD$
30 .\"
31 .Dd September 30, 2016
32 .Dt SIGACTION 2
33 .Os
34 .Sh NAME
35 .Nm sigaction
36 .Nd software signal facilities
37 .Sh LIBRARY
38 .Lb libc
39 .Sh SYNOPSIS
40 .In signal.h
41 .Bd -literal
42 struct  sigaction {
43         void    (*sa_handler)(int);
44         void    (*sa_sigaction)(int, siginfo_t *, void *);
45         int     sa_flags;               /* see signal options below */
46         sigset_t sa_mask;               /* signal mask to apply */
47 };
48 .Ed
49 .Ft int
50 .Fo sigaction
51 .Fa "int sig"
52 .Fa "const struct sigaction * restrict act"
53 .Fa "struct sigaction * restrict oact"
54 .Fc
55 .Sh DESCRIPTION
56 The system defines a set of signals that may be delivered to a process.
57 Signal delivery resembles the occurrence of a hardware interrupt:
58 the signal is normally blocked from further occurrence, the current thread
59 context is saved, and a new one is built.
60 A process may specify a
61 .Em handler
62 to which a signal is delivered, or specify that a signal is to be
63 .Em ignored .
64 A process may also specify that a default action is to be taken
65 by the system when a signal occurs.
66 A signal may also be
67 .Em blocked
68 for a thread,
69 in which case it will not be delivered to that thread until it is
70 .Em unblocked .
71 The action to be taken on delivery is determined at the time
72 of delivery.
73 Normally, signal handlers execute on the current stack
74 of the thread.
75 This may be changed, on a per-handler basis,
76 so that signals are taken on a special
77 .Em "signal stack" .
78 .Pp
79 Signal routines normally execute with the signal that caused their
80 invocation
81 .Em blocked ,
82 but other signals may yet occur.
83 A global
84 .Em "signal mask"
85 defines the set of signals currently blocked from delivery
86 to a thread.
87 The signal mask for a thread is initialized
88 from that of its parent (normally empty).
89 It may be changed with a
90 .Xr sigprocmask 2
91 or
92 .Xr pthread_sigmask 3
93 call, or when a signal is delivered to the thread.
94 .Pp
95 When a signal
96 condition arises for a process or thread, the signal is added to a set of
97 signals pending for the process or thread.
98 Whether the signal is directed at the process in general or at a specific
99 thread depends on how it is generated.
100 For signals directed at a specific thread,
101 if the signal is not currently
102 .Em blocked
103 by the thread then it is delivered to the thread.
104 For signals directed at the process,
105 if the signal is not currently
106 .Em blocked
107 by all threads then it is delivered to one thread that does not have it blocked
108 (the selection of which is unspecified).
109 Signals may be delivered any time a thread enters the operating system
110 (e.g., during a system call, page fault or trap, or clock interrupt).
111 If multiple signals are ready to be delivered at the same time,
112 any signals that could be caused by traps are delivered first.
113 Additional signals may be processed at the same time, with each
114 appearing to interrupt the handlers for the previous signals
115 before their first instructions.
116 The set of pending signals is returned by the
117 .Xr sigpending 2
118 system call.
119 When a caught signal
120 is delivered, the current state of the thread is saved,
121 a new signal mask is calculated (as described below),
122 and the signal handler is invoked.
123 The call to the handler
124 is arranged so that if the signal handling routine returns
125 normally the thread will resume execution in the context
126 from before the signal's delivery.
127 If the thread wishes to resume in a different context, then it
128 must arrange to restore the previous context itself.
129 .Pp
130 When a signal is delivered to a thread a new signal mask is
131 installed for the duration of the process' signal handler
132 (or until a
133 .Xr sigprocmask 2
134 system call is made).
135 This mask is formed by taking the union of the current signal mask set,
136 the signal to be delivered, and
137 the signal mask associated with the handler to be invoked.
138 .Pp
139 The
140 .Fn sigaction
141 system call
142 assigns an action for a signal specified by
143 .Fa sig .
144 If
145 .Fa act
146 is non-zero, it
147 specifies an action
148 .Dv ( SIG_DFL ,
149 .Dv SIG_IGN ,
150 or a handler routine) and mask
151 to be used when delivering the specified signal.
152 If
153 .Fa oact
154 is non-zero, the previous handling information for the signal
155 is returned to the user.
156 .Pp
157 The above declaration of
158 .Vt "struct sigaction"
159 is not literal.
160 It is provided only to list the accessible members.
161 See
162 .In sys/signal.h
163 for the actual definition.
164 In particular, the storage occupied by sa_handler and sa_sigaction overlaps,
165 and an application can not use both simultaneously.
166 .Pp
167 Once a signal handler is installed, it normally remains installed
168 until another
169 .Fn sigaction
170 system call is made, or an
171 .Xr execve 2
172 is performed.
173 A signal-specific default action may be reset by
174 setting
175 .Va sa_handler
176 to
177 .Dv SIG_DFL .
178 The defaults are process termination, possibly with core dump;
179 no action; stopping the process; or continuing the process.
180 See the signal list below for each signal's default action.
181 If
182 .Va sa_handler
183 is
184 .Dv SIG_DFL ,
185 the default action for the signal is to discard the signal,
186 and if a signal is pending,
187 the pending signal is discarded even if the signal is masked.
188 If
189 .Va sa_handler
190 is set to
191 .Dv SIG_IGN
192 current and pending instances
193 of the signal are ignored and discarded.
194 .Pp
195 Options may be specified by setting
196 .Va sa_flags .
197 The meaning of the various bits is as follows:
198 .Bl -tag -offset indent -width SA_RESETHANDXX
199 .It Dv SA_NOCLDSTOP
200 If this bit is set when installing a catching function
201 for the
202 .Dv SIGCHLD
203 signal,
204 the
205 .Dv SIGCHLD
206 signal will be generated only when a child process exits,
207 not when a child process stops.
208 .It Dv SA_NOCLDWAIT
209 If this bit is set when calling
210 .Fn sigaction
211 for the
212 .Dv SIGCHLD
213 signal, the system will not create zombie processes when children of
214 the calling process exit.
215 If the calling process subsequently issues a
216 .Xr wait 2
217 (or equivalent), it blocks until all of the calling process's child
218 processes terminate, and then returns a value of \-1 with
219 .Va errno
220 set to
221 .Er ECHILD .
222 The same effect of avoiding zombie creation can also be achieved by setting
223 .Va sa_handler
224 for
225 .Dv SIGCHLD
226 to
227 .Dv SIG_IGN .
228 .It Dv SA_ONSTACK
229 If this bit is set, the system will deliver the signal to the process
230 on a
231 .Em "signal stack" ,
232 specified by each thread with
233 .Xr sigaltstack 2 .
234 .It Dv SA_NODEFER
235 If this bit is set, further occurrences of the delivered signal are
236 not masked during the execution of the handler.
237 .It Dv SA_RESETHAND
238 If this bit is set, the handler is reset back to
239 .Dv SIG_DFL
240 at the moment the signal is delivered.
241 .It Dv SA_RESTART
242 See paragraph below.
243 .It Dv SA_SIGINFO
244 If this bit is set, the handler function is assumed to be pointed to by the
245 .Va sa_sigaction
246 member of
247 .Vt "struct sigaction"
248 and should match the prototype shown above or as below in
249 .Sx EXAMPLES .
250 This bit should not be set when assigning
251 .Dv SIG_DFL
252 or
253 .Dv SIG_IGN .
254 .El
255 .Pp
256 If a signal is caught during the system calls listed below,
257 the call may be forced to terminate
258 with the error
259 .Er EINTR ,
260 the call may return with a data transfer shorter than requested,
261 or the call may be restarted.
262 Restart of pending calls is requested
263 by setting the
264 .Dv SA_RESTART
265 bit in
266 .Va sa_flags .
267 The affected system calls include
268 .Xr open 2 ,
269 .Xr read 2 ,
270 .Xr write 2 ,
271 .Xr sendto 2 ,
272 .Xr recvfrom 2 ,
273 .Xr sendmsg 2
274 and
275 .Xr recvmsg 2
276 on a communications channel or a slow device (such as a terminal,
277 but not a regular file)
278 and during a
279 .Xr wait 2
280 or
281 .Xr ioctl 2 .
282 However, calls that have already committed are not restarted,
283 but instead return a partial success (for example, a short read count).
284 .Pp
285 After a
286 .Xr pthread_create 3
287 the signal mask is inherited by the new thread and
288 the set of pending signals and the signal stack for the new thread are empty.
289 .Pp
290 After a
291 .Xr fork 2
292 or
293 .Xr vfork 2
294 all signals, the signal mask, the signal stack,
295 and the restart/interrupt flags are inherited by the child.
296 .Pp
297 The
298 .Xr execve 2
299 system call reinstates the default
300 action for all signals which were caught and
301 resets all signals to be caught on the user stack.
302 Ignored signals remain ignored;
303 the signal mask remains the same;
304 signals that restart pending system calls continue to do so.
305 .Pp
306 The following is a list of all signals
307 with names as in the include file
308 .In signal.h :
309 .Bl -column SIGVTALARMXX "create core imagexxx"
310 .It Sy NAME Ta Sy Default Action Ta Sy Description
311 .It Dv SIGHUP Ta terminate process Ta terminal line hangup
312 .It Dv SIGINT Ta terminate process Ta interrupt program
313 .It Dv SIGQUIT Ta create core image Ta quit program
314 .It Dv SIGILL Ta create core image Ta illegal instruction
315 .It Dv SIGTRAP Ta create core image Ta trace trap
316 .It Dv SIGABRT Ta create core image Ta Xr abort 3 call (formerly Dv SIGIOT )
317 .It Dv SIGEMT Ta create core image Ta emulate instruction executed
318 .It Dv SIGFPE Ta create core image Ta floating-point exception
319 .It Dv SIGKILL Ta terminate process Ta kill program
320 .It Dv SIGBUS Ta create core image Ta bus error
321 .It Dv SIGSEGV Ta create core image Ta segmentation violation
322 .It Dv SIGSYS Ta create core image Ta non-existent system call invoked
323 .It Dv SIGPIPE Ta terminate process Ta write on a pipe with no reader
324 .It Dv SIGALRM Ta terminate process Ta real-time timer expired
325 .It Dv SIGTERM Ta terminate process Ta software termination signal
326 .It Dv SIGURG Ta discard signal Ta urgent condition present on socket
327 .It Dv SIGSTOP Ta stop process Ta stop (cannot be caught or ignored)
328 .It Dv SIGTSTP Ta stop process Ta stop signal generated from keyboard
329 .It Dv SIGCONT Ta discard signal Ta continue after stop
330 .It Dv SIGCHLD Ta discard signal Ta child status has changed
331 .It Dv SIGTTIN Ta stop process Ta background read attempted from control terminal
332 .It Dv SIGTTOU Ta stop process Ta background write attempted to control terminal
333 .It Dv SIGIO Ta discard signal Ta I/O is possible on a descriptor (see Xr fcntl 2 )
334 .It Dv SIGXCPU Ta terminate process Ta cpu time limit exceeded (see Xr setrlimit 2 )
335 .It Dv SIGXFSZ Ta terminate process Ta file size limit exceeded (see Xr setrlimit 2 )
336 .It Dv SIGVTALRM Ta terminate process Ta virtual time alarm (see Xr setitimer 2 )
337 .It Dv SIGPROF Ta terminate process Ta profiling timer alarm (see Xr setitimer 2 )
338 .It Dv SIGWINCH Ta discard signal Ta window size change
339 .It Dv SIGINFO Ta discard signal Ta status request from keyboard
340 .It Dv SIGUSR1 Ta terminate process Ta user defined signal 1
341 .It Dv SIGUSR2 Ta terminate process Ta user defined signal 2
342 .El
343 .Sh NOTE
344 The
345 .Va sa_mask
346 field specified in
347 .Fa act
348 is not allowed to block
349 .Dv SIGKILL
350 or
351 .Dv SIGSTOP .
352 Any attempt to do so will be silently ignored.
353 .Pp
354 The following functions are either reentrant or not interruptible
355 by signals and are async-signal safe.
356 Therefore applications may
357 invoke them, without restriction, from signal-catching functions
358 or from a child process after calling
359 .Xr fork 2
360 in a multi-threaded process:
361 .Pp
362 Base Interfaces:
363 .Pp
364 .Fn _Exit ,
365 .Fn _exit ,
366 .Fn accept ,
367 .Fn access ,
368 .Fn alarm ,
369 .Fn bind ,
370 .Fn cfgetispeed ,
371 .Fn cfgetospeed ,
372 .Fn cfsetispeed ,
373 .Fn cfsetospeed ,
374 .Fn chdir ,
375 .Fn chmod ,
376 .Fn chown ,
377 .Fn close ,
378 .Fn connect ,
379 .Fn creat ,
380 .Fn dup ,
381 .Fn dup2 ,
382 .Fn execl ,
383 .Fn execle ,
384 .Fn execv ,
385 .Fn execve ,
386 .Fn faccessat ,
387 .Fn fchdir ,
388 .Fn fchmod ,
389 .Fn fchmodat ,
390 .Fn fchown ,
391 .Fn fchownat ,
392 .Fn fcntl ,
393 .Fn fork ,
394 .Fn fstat ,
395 .Fn fstatat ,
396 .Fn fsync ,
397 .Fn ftruncate ,
398 .Fn getegid ,
399 .Fn geteuid ,
400 .Fn getgid ,
401 .Fn getgroups ,
402 .Fn getpeername ,
403 .Fn getpgrp ,
404 .Fn getpid ,
405 .Fn getppid ,
406 .Fn getsockname ,
407 .Fn getsockopt ,
408 .Fn getuid ,
409 .Fn kill ,
410 .Fn link ,
411 .Fn linkat ,
412 .Fn listen ,
413 .Fn lseek ,
414 .Fn lstat ,
415 .Fn mkdir ,
416 .Fn mkdirat ,
417 .Fn mkfifo ,
418 .Fn mkfifoat ,
419 .Fn mknod ,
420 .Fn mknodat ,
421 .Fn open ,
422 .Fn openat ,
423 .Fn pause ,
424 .Fn pipe ,
425 .Fn poll ,
426 .Fn pselect ,
427 .Fn pthread_sigmask ,
428 .Fn raise ,
429 .Fn read ,
430 .Fn readlink ,
431 .Fn readlinkat ,
432 .Fn recv ,
433 .Fn recvfrom ,
434 .Fn recvmsg ,
435 .Fn rename ,
436 .Fn renameat ,
437 .Fn rmdir ,
438 .Fn select ,
439 .Fn send ,
440 .Fn sendmsg ,
441 .Fn sendto ,
442 .Fn setgid ,
443 .Fn setpgid ,
444 .Fn setsid ,
445 .Fn setsockopt ,
446 .Fn setuid ,
447 .Fn shutdown ,
448 .Fn sigaction ,
449 .Fn sigaddset ,
450 .Fn sigdelset ,
451 .Fn sigemptyset ,
452 .Fn sigfillset ,
453 .Fn sigismember ,
454 .Fn signal ,
455 .Fn sigpending ,
456 .Fn sigprocmask ,
457 .Fn sigsuspend ,
458 .Fn sleep ,
459 .Fn sockatmark ,
460 .Fn socket ,
461 .Fn socketpair ,
462 .Fn stat ,
463 .Fn symlink ,
464 .Fn symlinkat ,
465 .Fn tcdrain ,
466 .Fn tcflow ,
467 .Fn tcflush ,
468 .Fn tcgetattr ,
469 .Fn tcgetpgrp ,
470 .Fn tcsendbreak ,
471 .Fn tcsetattr ,
472 .Fn tcsetpgrp ,
473 .Fn time ,
474 .Fn times ,
475 .Fn umask ,
476 .Fn uname ,
477 .Fn unlink ,
478 .Fn unlinkat ,
479 .Fn utime ,
480 .Fn wait ,
481 .Fn waitpid ,
482 .Fn write .
483 .Pp
484 X/Open Systems Interfaces:
485 .Pp
486 .Fn sigpause ,
487 .Fn sigset ,
488 .Fn utimes .
489 .Pp
490 Realtime Interfaces:
491 .Pp
492 .Fn aio_error ,
493 .Fn clock_gettime ,
494 .Fn timer_getoverrun ,
495 .Fn aio_return ,
496 .Fn fdatasync ,
497 .Fn sigqueue ,
498 .Fn timer_gettime ,
499 .Fn aio_suspend ,
500 .Fn sem_post ,
501 .Fn timer_settime .
502 .Pp
503 Base Interfaces not specified as async-signal safe by
504 .Tn POSIX :
505 .Pp
506 .Fn fpathconf ,
507 .Fn pathconf ,
508 .Fn sysconf .
509 .Pp
510 Base Interfaces not specified as async-signal safe by
511 .Tn POSIX ,
512 but planned to be:
513 .Pp
514 .Fn ffs ,
515 .Fn htonl ,
516 .Fn htons ,
517 .Fn memccpy ,
518 .Fn memchr ,
519 .Fn memcmp ,
520 .Fn memcpy ,
521 .Fn memmove ,
522 .Fn memset ,
523 .Fn ntohl ,
524 .Fn ntohs ,
525 .Fn stpcpy ,
526 .Fn stpncpy ,
527 .Fn strcat ,
528 .Fn strchr ,
529 .Fn strcmp ,
530 .Fn strcpy ,
531 .Fn strcspn ,
532 .Fn strlen ,
533 .Fn strncat ,
534 .Fn strncmp ,
535 .Fn strncpy ,
536 .Fn strnlen ,
537 .Fn strpbrk ,
538 .Fn strrchr ,
539 .Fn strspn ,
540 .Fn strstr ,
541 .Fn strtok_r ,
542 .Fn wcpcpy ,
543 .Fn wcpncpy ,
544 .Fn wcscat ,
545 .Fn wcschr ,
546 .Fn wcscmp ,
547 .Fn wcscpy ,
548 .Fn wcscspn ,
549 .Fn wcslen ,
550 .Fn wcsncat ,
551 .Fn wcsncmp ,
552 .Fn wcsncpy ,
553 .Fn wcsnlen ,
554 .Fn wcspbrk ,
555 .Fn wcsrchr ,
556 .Fn wcsspn ,
557 .Fn wcsstr ,
558 .Fn wcstok ,
559 .Fn wmemchr ,
560 .Fn wmemcmp ,
561 .Fn wmemcpy ,
562 .Fn wmemmove ,
563 .Fn wmemset .
564 .Pp
565 Extension Interfaces:
566 .Pp
567 .Fn accept4 ,
568 .Fn bindat ,
569 .Fn closefrom ,
570 .Fn connectat ,
571 .Fn eaccess ,
572 .Fn ffsl ,
573 .Fn ffsll ,
574 .Fn flock ,
575 .Fn fls ,
576 .Fn flsl ,
577 .Fn flsll ,
578 .Fn futimesat ,
579 .Fn pipe2 ,
580 .Fn strlcat .
581 .Fn strlcpy ,
582 .Fn strsep .
583 .Pp
584 In addition, reading or writing
585 .Va errno
586 is async-signal safe.
587 .Pp
588 All functions not in the above lists are considered to be unsafe
589 with respect to signals.
590 That is to say, the behaviour of such
591 functions is undefined when they are called from a signal handler
592 that interrupted an unsafe function.
593 In general though, signal handlers should do little more than set a
594 flag; most other actions are not safe.
595 .Pp
596 Also, it is good practice to make a copy of the global variable
597 .Va errno
598 and restore it before returning from the signal handler.
599 This protects against the side effect of
600 .Va errno
601 being set by functions called from inside the signal handler.
602 .Sh RETURN VALUES
603 .Rv -std sigaction
604 .Sh EXAMPLES
605 There are three possible prototypes the handler may match:
606 .Bl -tag -offset indent -width short
607 .It Tn ANSI C :
608 .Ft void
609 .Fn handler int ;
610 .It Traditional BSD style:
611 .Ft void
612 .Fn handler int "int code" "struct sigcontext *scp" ;
613 .It Tn POSIX Dv SA_SIGINFO :
614 .Ft void
615 .Fn handler int "siginfo_t *info" "ucontext_t *uap" ;
616 .El
617 .Pp
618 The handler function should match the
619 .Dv SA_SIGINFO
620 prototype if the
621 .Dv SA_SIGINFO
622 bit is set in
623 .Va sa_flags .
624 It then should be pointed to by the
625 .Va sa_sigaction
626 member of
627 .Vt "struct sigaction" .
628 Note that you should not assign
629 .Dv SIG_DFL
630 or
631 .Dv SIG_IGN
632 this way.
633 .Pp
634 If the
635 .Dv SA_SIGINFO
636 flag is not set, the handler function should match
637 either the
638 .Tn ANSI C
639 or traditional
640 .Bx
641 prototype and be pointed to by
642 the
643 .Va sa_handler
644 member of
645 .Vt "struct sigaction" .
646 In practice,
647 .Fx
648 always sends the three arguments of the latter and since the
649 .Tn ANSI C
650 prototype is a subset, both will work.
651 The
652 .Va sa_handler
653 member declaration in
654 .Fx
655 include files is that of
656 .Tn ANSI C
657 (as required by
658 .Tn POSIX ) ,
659 so a function pointer of a
660 .Bx Ns -style
661 function needs to be casted to
662 compile without warning.
663 The traditional
664 .Bx
665 style is not portable and since its capabilities
666 are a full subset of a
667 .Dv SA_SIGINFO
668 handler,
669 its use is deprecated.
670 .Pp
671 The
672 .Fa sig
673 argument is the signal number, one of the
674 .Dv SIG...
675 values from
676 .In signal.h .
677 .Pp
678 The
679 .Fa code
680 argument of the
681 .Bx Ns -style
682 handler and the
683 .Va si_code
684 member of the
685 .Fa info
686 argument to a
687 .Dv SA_SIGINFO
688 handler contain a numeric code explaining the
689 cause of the signal, usually one of the
690 .Dv SI_...
691 values from
692 .In sys/signal.h
693 or codes specific to a signal, i.e., one of the
694 .Dv FPE_...
695 values for
696 .Dv SIGFPE .
697 .Pp
698 The
699 .Fa scp
700 argument to a
701 .Bx Ns -style
702 handler points to an instance of
703 .Vt "struct sigcontext" .
704 .Pp
705 The
706 .Fa uap
707 argument to a
708 .Tn POSIX
709 .Dv SA_SIGINFO
710 handler points to an instance of
711 ucontext_t.
712 .Sh ERRORS
713 The
714 .Fn sigaction
715 system call
716 will fail and no new signal handler will be installed if one
717 of the following occurs:
718 .Bl -tag -width Er
719 .It Bq Er EINVAL
720 The
721 .Fa sig
722 argument
723 is not a valid signal number.
724 .It Bq Er EINVAL
725 An attempt is made to ignore or supply a handler for
726 .Dv SIGKILL
727 or
728 .Dv SIGSTOP .
729 .El
730 .Sh SEE ALSO
731 .Xr kill 1 ,
732 .Xr kill 2 ,
733 .Xr ptrace 2 ,
734 .Xr setitimer 2 ,
735 .Xr setrlimit 2 ,
736 .Xr sigaltstack 2 ,
737 .Xr sigpending 2 ,
738 .Xr sigprocmask 2 ,
739 .Xr sigsuspend 2 ,
740 .Xr wait 2 ,
741 .Xr fpsetmask 3 ,
742 .Xr setjmp 3 ,
743 .Xr siginfo 3 ,
744 .Xr siginterrupt 3 ,
745 .Xr sigsetops 3 ,
746 .Xr ucontext 3 ,
747 .Xr tty 4
748 .Sh STANDARDS
749 The
750 .Fn sigaction
751 system call is expected to conform to
752 .St -p1003.1-90 .
753 The
754 .Dv SA_ONSTACK
755 and
756 .Dv SA_RESTART
757 flags are Berkeley extensions,
758 as are the signals,
759 .Dv SIGTRAP ,
760 .Dv SIGEMT ,
761 .Dv SIGBUS ,
762 .Dv SIGSYS ,
763 .Dv SIGURG ,
764 .Dv SIGIO ,
765 .Dv SIGXCPU ,
766 .Dv SIGXFSZ ,
767 .Dv SIGVTALRM ,
768 .Dv SIGPROF ,
769 .Dv SIGWINCH ,
770 and
771 .Dv SIGINFO .
772 Those signals are available on most
773 .Bx Ns \-derived
774 systems.
775 The
776 .Dv SA_NODEFER
777 and
778 .Dv SA_RESETHAND
779 flags are intended for backwards compatibility with other operating
780 systems.
781 The
782 .Dv SA_NOCLDSTOP ,
783 and
784 .Dv SA_NOCLDWAIT
785 .\" and
786 .\" SA_SIGINFO
787 flags are featuring options commonly found in other operating systems.
788 The flags are approved by
789 .St -susv2 ,
790 along with the option to avoid zombie creation by ignoring
791 .Dv SIGCHLD .