]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - lib/libc/sys/sigaction.2
Merge OpenSSL 1.1.1a.
[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 June 28, 2018
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 .Pp
50 .Ft int
51 .Fo sigaction
52 .Fa "int sig"
53 .Fa "const struct sigaction * restrict act"
54 .Fa "struct sigaction * restrict oact"
55 .Fc
56 .Sh DESCRIPTION
57 The system defines a set of signals that may be delivered to a process.
58 Signal delivery resembles the occurrence of a hardware interrupt:
59 the signal is normally blocked from further occurrence, the current thread
60 context is saved, and a new one is built.
61 A process may specify a
62 .Em handler
63 to which a signal is delivered, or specify that a signal is to be
64 .Em ignored .
65 A process may also specify that a default action is to be taken
66 by the system when a signal occurs.
67 A signal may also be
68 .Em blocked
69 for a thread,
70 in which case it will not be delivered to that thread until it is
71 .Em unblocked .
72 The action to be taken on delivery is determined at the time
73 of delivery.
74 Normally, signal handlers execute on the current stack
75 of the thread.
76 This may be changed, on a per-handler basis,
77 so that signals are taken on a special
78 .Em "signal stack" .
79 .Pp
80 Signal routines normally execute with the signal that caused their
81 invocation
82 .Em blocked ,
83 but other signals may yet occur.
84 A global
85 .Em "signal mask"
86 defines the set of signals currently blocked from delivery
87 to a thread.
88 The signal mask for a thread is initialized
89 from that of its parent (normally empty).
90 It may be changed with a
91 .Xr sigprocmask 2
92 or
93 .Xr pthread_sigmask 3
94 call, or when a signal is delivered to the thread.
95 .Pp
96 When a signal
97 condition arises for a process or thread, the signal is added to a set of
98 signals pending for the process or thread.
99 Whether the signal is directed at the process in general or at a specific
100 thread depends on how it is generated.
101 For signals directed at a specific thread,
102 if the signal is not currently
103 .Em blocked
104 by the thread then it is delivered to the thread.
105 For signals directed at the process,
106 if the signal is not currently
107 .Em blocked
108 by all threads then it is delivered to one thread that does not have it blocked
109 (the selection of which is unspecified).
110 Signals may be delivered any time a thread enters the operating system
111 (e.g., during a system call, page fault or trap, or clock interrupt).
112 If multiple signals are ready to be delivered at the same time,
113 any signals that could be caused by traps are delivered first.
114 Additional signals may be processed at the same time, with each
115 appearing to interrupt the handlers for the previous signals
116 before their first instructions.
117 The set of pending signals is returned by the
118 .Xr sigpending 2
119 system call.
120 When a caught signal
121 is delivered, the current state of the thread is saved,
122 a new signal mask is calculated (as described below),
123 and the signal handler is invoked.
124 The call to the handler
125 is arranged so that if the signal handling routine returns
126 normally the thread will resume execution in the context
127 from before the signal's delivery.
128 If the thread wishes to resume in a different context, then it
129 must arrange to restore the previous context itself.
130 .Pp
131 When a signal is delivered to a thread a new signal mask is
132 installed for the duration of the process' signal handler
133 (or until a
134 .Xr sigprocmask 2
135 system call is made).
136 This mask is formed by taking the union of the current signal mask set,
137 the signal to be delivered, and
138 the signal mask associated with the handler to be invoked.
139 .Pp
140 The
141 .Fn sigaction
142 system call
143 assigns an action for a signal specified by
144 .Fa sig .
145 If
146 .Fa act
147 is non-NULL, it specifies an action
148 .Dv ( SIG_DFL ,
149 .Dv SIG_IGN ,
150 or a handler routine) and mask to be used when delivering the specified signal.
151 If
152 .Fa oact
153 is non-NULL, the previous handling information for the signal
154 is returned to the user.
155 .Pp
156 The above declaration of
157 .Vt "struct sigaction"
158 is not literal.
159 It is provided only to list the accessible members.
160 See
161 .In sys/signal.h
162 for the actual definition.
163 In particular, the storage occupied by
164 .Va sa_handler
165 and
166 .Va sa_sigaction
167 overlaps, and it is nonsensical for an application to attempt to use both
168 simultaneously.
169 .Pp
170 Once a signal handler is installed, it normally remains installed
171 until another
172 .Fn sigaction
173 system call is made, or an
174 .Xr execve 2
175 is performed.
176 A signal-specific default action may be reset by
177 setting
178 .Va sa_handler
179 to
180 .Dv SIG_DFL .
181 The defaults are process termination, possibly with core dump;
182 no action; stopping the process; or continuing the process.
183 See the signal list below for each signal's default action.
184 If
185 .Va sa_handler
186 is
187 .Dv SIG_DFL ,
188 the default action for the signal is to discard the signal,
189 and if a signal is pending,
190 the pending signal is discarded even if the signal is masked.
191 If
192 .Va sa_handler
193 is set to
194 .Dv SIG_IGN
195 current and pending instances
196 of the signal are ignored and discarded.
197 .Pp
198 Options may be specified by setting
199 .Va sa_flags .
200 The meaning of the various bits is as follows:
201 .Bl -tag -offset indent -width SA_RESETHANDXX
202 .It Dv SA_NOCLDSTOP
203 If this bit is set when installing a catching function
204 for the
205 .Dv SIGCHLD
206 signal,
207 the
208 .Dv SIGCHLD
209 signal will be generated only when a child process exits,
210 not when a child process stops.
211 .It Dv SA_NOCLDWAIT
212 If this bit is set when calling
213 .Fn sigaction
214 for the
215 .Dv SIGCHLD
216 signal, the system will not create zombie processes when children of
217 the calling process exit.
218 If the calling process subsequently issues a
219 .Xr wait 2
220 (or equivalent), it blocks until all of the calling process's child
221 processes terminate, and then returns a value of \-1 with
222 .Va errno
223 set to
224 .Er ECHILD .
225 The same effect of avoiding zombie creation can also be achieved by setting
226 .Va sa_handler
227 for
228 .Dv SIGCHLD
229 to
230 .Dv SIG_IGN .
231 .It Dv SA_ONSTACK
232 If this bit is set, the system will deliver the signal to the process
233 on a
234 .Em "signal stack" ,
235 specified by each thread with
236 .Xr sigaltstack 2 .
237 .It Dv SA_NODEFER
238 If this bit is set, further occurrences of the delivered signal are
239 not masked during the execution of the handler.
240 .It Dv SA_RESETHAND
241 If this bit is set, the handler is reset back to
242 .Dv SIG_DFL
243 at the moment the signal is delivered.
244 .It Dv SA_RESTART
245 See paragraph below.
246 .It Dv SA_SIGINFO
247 If this bit is set, the handler function is assumed to be pointed to by the
248 .Va sa_sigaction
249 member of
250 .Vt "struct sigaction"
251 and should match the prototype shown above or as below in
252 .Sx EXAMPLES .
253 This bit should not be set when assigning
254 .Dv SIG_DFL
255 or
256 .Dv SIG_IGN .
257 .El
258 .Pp
259 If a signal is caught during the system calls listed below,
260 the call may be forced to terminate
261 with the error
262 .Er EINTR ,
263 the call may return with a data transfer shorter than requested,
264 or the call may be restarted.
265 Restart of pending calls is requested
266 by setting the
267 .Dv SA_RESTART
268 bit in
269 .Va sa_flags .
270 The affected system calls include
271 .Xr open 2 ,
272 .Xr read 2 ,
273 .Xr write 2 ,
274 .Xr sendto 2 ,
275 .Xr recvfrom 2 ,
276 .Xr sendmsg 2
277 and
278 .Xr recvmsg 2
279 on a communications channel or a slow device (such as a terminal,
280 but not a regular file)
281 and during a
282 .Xr wait 2
283 or
284 .Xr ioctl 2 .
285 However, calls that have already committed are not restarted,
286 but instead return a partial success (for example, a short read count).
287 .Pp
288 After a
289 .Xr pthread_create 3
290 the signal mask is inherited by the new thread and
291 the set of pending signals and the signal stack for the new thread are empty.
292 .Pp
293 After a
294 .Xr fork 2
295 or
296 .Xr vfork 2
297 all signals, the signal mask, the signal stack,
298 and the restart/interrupt flags are inherited by the child.
299 .Pp
300 The
301 .Xr execve 2
302 system call reinstates the default
303 action for all signals which were caught and
304 resets all signals to be caught on the user stack.
305 Ignored signals remain ignored;
306 the signal mask remains the same;
307 signals that restart pending system calls continue to do so.
308 .Pp
309 The following is a list of all signals
310 with names as in the include file
311 .In signal.h :
312 .Bl -column SIGVTALARMXX "create core imagexxx"
313 .It Sy NAME Ta Sy Default Action Ta Sy Description
314 .It Dv SIGHUP Ta terminate process Ta terminal line hangup
315 .It Dv SIGINT Ta terminate process Ta interrupt program
316 .It Dv SIGQUIT Ta create core image Ta quit program
317 .It Dv SIGILL Ta create core image Ta illegal instruction
318 .It Dv SIGTRAP Ta create core image Ta trace trap
319 .It Dv SIGABRT Ta create core image Ta Xr abort 3 call (formerly Dv SIGIOT )
320 .It Dv SIGEMT Ta create core image Ta emulate instruction executed
321 .It Dv SIGFPE Ta create core image Ta floating-point exception
322 .It Dv SIGKILL Ta terminate process Ta kill program
323 .It Dv SIGBUS Ta create core image Ta bus error
324 .It Dv SIGSEGV Ta create core image Ta segmentation violation
325 .It Dv SIGSYS Ta create core image Ta non-existent system call invoked
326 .It Dv SIGPIPE Ta terminate process Ta write on a pipe with no reader
327 .It Dv SIGALRM Ta terminate process Ta real-time timer expired
328 .It Dv SIGTERM Ta terminate process Ta software termination signal
329 .It Dv SIGURG Ta discard signal Ta urgent condition present on socket
330 .It Dv SIGSTOP Ta stop process Ta stop (cannot be caught or ignored)
331 .It Dv SIGTSTP Ta stop process Ta stop signal generated from keyboard
332 .It Dv SIGCONT Ta discard signal Ta continue after stop
333 .It Dv SIGCHLD Ta discard signal Ta child status has changed
334 .It Dv SIGTTIN Ta stop process Ta background read attempted from control terminal
335 .It Dv SIGTTOU Ta stop process Ta background write attempted to control terminal
336 .It Dv SIGIO Ta discard signal Ta I/O is possible on a descriptor (see Xr fcntl 2 )
337 .It Dv SIGXCPU Ta terminate process Ta cpu time limit exceeded (see Xr setrlimit 2 )
338 .It Dv SIGXFSZ Ta terminate process Ta file size limit exceeded (see Xr setrlimit 2 )
339 .It Dv SIGVTALRM Ta terminate process Ta virtual time alarm (see Xr setitimer 2 )
340 .It Dv SIGPROF Ta terminate process Ta profiling timer alarm (see Xr setitimer 2 )
341 .It Dv SIGWINCH Ta discard signal Ta window size change
342 .It Dv SIGINFO Ta discard signal Ta status request from keyboard
343 .It Dv SIGUSR1 Ta terminate process Ta user defined signal 1
344 .It Dv SIGUSR2 Ta terminate process Ta user defined signal 2
345 .El
346 .Sh NOTE
347 The
348 .Va sa_mask
349 field specified in
350 .Fa act
351 is not allowed to block
352 .Dv SIGKILL
353 or
354 .Dv SIGSTOP .
355 Any attempt to do so will be silently ignored.
356 .Pp
357 The following functions are either reentrant or not interruptible
358 by signals and are async-signal safe.
359 Therefore applications may
360 invoke them, without restriction, from signal-catching functions
361 or from a child process after calling
362 .Xr fork 2
363 in a multi-threaded process:
364 .Pp
365 Base Interfaces:
366 .Pp
367 .Fn _Exit ,
368 .Fn _exit ,
369 .Fn accept ,
370 .Fn access ,
371 .Fn alarm ,
372 .Fn bind ,
373 .Fn cfgetispeed ,
374 .Fn cfgetospeed ,
375 .Fn cfsetispeed ,
376 .Fn cfsetospeed ,
377 .Fn chdir ,
378 .Fn chmod ,
379 .Fn chown ,
380 .Fn close ,
381 .Fn connect ,
382 .Fn creat ,
383 .Fn dup ,
384 .Fn dup2 ,
385 .Fn execl ,
386 .Fn execle ,
387 .Fn execv ,
388 .Fn execve ,
389 .Fn faccessat ,
390 .Fn fchdir ,
391 .Fn fchmod ,
392 .Fn fchmodat ,
393 .Fn fchown ,
394 .Fn fchownat ,
395 .Fn fcntl ,
396 .Fn fork ,
397 .Fn fstat ,
398 .Fn fstatat ,
399 .Fn fsync ,
400 .Fn ftruncate ,
401 .Fn getegid ,
402 .Fn geteuid ,
403 .Fn getgid ,
404 .Fn getgroups ,
405 .Fn getpeername ,
406 .Fn getpgrp ,
407 .Fn getpid ,
408 .Fn getppid ,
409 .Fn getsockname ,
410 .Fn getsockopt ,
411 .Fn getuid ,
412 .Fn kill ,
413 .Fn link ,
414 .Fn linkat ,
415 .Fn listen ,
416 .Fn lseek ,
417 .Fn lstat ,
418 .Fn mkdir ,
419 .Fn mkdirat ,
420 .Fn mkfifo ,
421 .Fn mkfifoat ,
422 .Fn mknod ,
423 .Fn mknodat ,
424 .Fn open ,
425 .Fn openat ,
426 .Fn pause ,
427 .Fn pipe ,
428 .Fn poll ,
429 .Fn pselect ,
430 .Fn pthread_sigmask ,
431 .Fn raise ,
432 .Fn read ,
433 .Fn readlink ,
434 .Fn readlinkat ,
435 .Fn recv ,
436 .Fn recvfrom ,
437 .Fn recvmsg ,
438 .Fn rename ,
439 .Fn renameat ,
440 .Fn rmdir ,
441 .Fn select ,
442 .Fn send ,
443 .Fn sendmsg ,
444 .Fn sendto ,
445 .Fn setgid ,
446 .Fn setpgid ,
447 .Fn setsid ,
448 .Fn setsockopt ,
449 .Fn setuid ,
450 .Fn shutdown ,
451 .Fn sigaction ,
452 .Fn sigaddset ,
453 .Fn sigdelset ,
454 .Fn sigemptyset ,
455 .Fn sigfillset ,
456 .Fn sigismember ,
457 .Fn signal ,
458 .Fn sigpending ,
459 .Fn sigprocmask ,
460 .Fn sigsuspend ,
461 .Fn sleep ,
462 .Fn sockatmark ,
463 .Fn socket ,
464 .Fn socketpair ,
465 .Fn stat ,
466 .Fn symlink ,
467 .Fn symlinkat ,
468 .Fn tcdrain ,
469 .Fn tcflow ,
470 .Fn tcflush ,
471 .Fn tcgetattr ,
472 .Fn tcgetpgrp ,
473 .Fn tcsendbreak ,
474 .Fn tcsetattr ,
475 .Fn tcsetpgrp ,
476 .Fn time ,
477 .Fn times ,
478 .Fn umask ,
479 .Fn uname ,
480 .Fn unlink ,
481 .Fn unlinkat ,
482 .Fn utime ,
483 .Fn wait ,
484 .Fn waitpid ,
485 .Fn write .
486 .Pp
487 X/Open Systems Interfaces:
488 .Pp
489 .Fn sigpause ,
490 .Fn sigset ,
491 .Fn utimes .
492 .Pp
493 Realtime Interfaces:
494 .Pp
495 .Fn aio_error ,
496 .Fn clock_gettime ,
497 .Fn timer_getoverrun ,
498 .Fn aio_return ,
499 .Fn fdatasync ,
500 .Fn sigqueue ,
501 .Fn timer_gettime ,
502 .Fn aio_suspend ,
503 .Fn sem_post ,
504 .Fn timer_settime .
505 .Pp
506 Base Interfaces not specified as async-signal safe by
507 .Tn POSIX :
508 .Pp
509 .Fn fpathconf ,
510 .Fn pathconf ,
511 .Fn sysconf .
512 .Pp
513 Base Interfaces not specified as async-signal safe by
514 .Tn POSIX ,
515 but planned to be:
516 .Pp
517 .Fn ffs ,
518 .Fn htonl ,
519 .Fn htons ,
520 .Fn memccpy ,
521 .Fn memchr ,
522 .Fn memcmp ,
523 .Fn memcpy ,
524 .Fn memmove ,
525 .Fn memset ,
526 .Fn ntohl ,
527 .Fn ntohs ,
528 .Fn stpcpy ,
529 .Fn stpncpy ,
530 .Fn strcat ,
531 .Fn strchr ,
532 .Fn strcmp ,
533 .Fn strcpy ,
534 .Fn strcspn ,
535 .Fn strlen ,
536 .Fn strncat ,
537 .Fn strncmp ,
538 .Fn strncpy ,
539 .Fn strnlen ,
540 .Fn strpbrk ,
541 .Fn strrchr ,
542 .Fn strspn ,
543 .Fn strstr ,
544 .Fn strtok_r ,
545 .Fn wcpcpy ,
546 .Fn wcpncpy ,
547 .Fn wcscat ,
548 .Fn wcschr ,
549 .Fn wcscmp ,
550 .Fn wcscpy ,
551 .Fn wcscspn ,
552 .Fn wcslen ,
553 .Fn wcsncat ,
554 .Fn wcsncmp ,
555 .Fn wcsncpy ,
556 .Fn wcsnlen ,
557 .Fn wcspbrk ,
558 .Fn wcsrchr ,
559 .Fn wcsspn ,
560 .Fn wcsstr ,
561 .Fn wcstok ,
562 .Fn wmemchr ,
563 .Fn wmemcmp ,
564 .Fn wmemcpy ,
565 .Fn wmemmove ,
566 .Fn wmemset .
567 .Pp
568 Extension Interfaces:
569 .Pp
570 .Fn accept4 ,
571 .Fn bindat ,
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 .