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