1SIGACTION(2) Linux Programmer's Manual SIGACTION(2)
2
3
4
6 sigaction, rt_sigaction - examine and change a signal action
7
9 #include <signal.h>
10
11 int sigaction(int signum, const struct sigaction *restrict act,
12 struct sigaction *restrict oldact);
13
14 Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
15
16 sigaction():
17 _POSIX_C_SOURCE
18
19 siginfo_t:
20 _POSIX_C_SOURCE >= 199309L
21
23 The sigaction() system call is used to change the action taken by a
24 process on receipt of a specific signal. (See signal(7) for an over‐
25 view of signals.)
26
27 signum specifies the signal and can be any valid signal except SIGKILL
28 and SIGSTOP.
29
30 If act is non-NULL, the new action for signal signum is installed from
31 act. If oldact is non-NULL, the previous action is saved in oldact.
32
33 The sigaction structure is defined as something like:
34
35 struct sigaction {
36 void (*sa_handler)(int);
37 void (*sa_sigaction)(int, siginfo_t *, void *);
38 sigset_t sa_mask;
39 int sa_flags;
40 void (*sa_restorer)(void);
41 };
42
43 On some architectures a union is involved: do not assign to both
44 sa_handler and sa_sigaction.
45
46 The sa_restorer field is not intended for application use. (POSIX does
47 not specify a sa_restorer field.) Some further details of the purpose
48 of this field can be found in sigreturn(2).
49
50 sa_handler specifies the action to be associated with signum and is be
51 one of the following:
52
53 * SIG_DFL for the default action.
54
55 * SIG_IGN to ignore this signal.
56
57 * A pointer to a signal handling function. This function receives the
58 signal number as its only argument.
59
60 If SA_SIGINFO is specified in sa_flags, then sa_sigaction (instead of
61 sa_handler) specifies the signal-handling function for signum. This
62 function receives three arguments, as described below.
63
64 sa_mask specifies a mask of signals which should be blocked (i.e.,
65 added to the signal mask of the thread in which the signal handler is
66 invoked) during execution of the signal handler. In addition, the sig‐
67 nal which triggered the handler will be blocked, unless the SA_NODEFER
68 flag is used.
69
70 sa_flags specifies a set of flags which modify the behavior of the sig‐
71 nal. It is formed by the bitwise OR of zero or more of the following:
72
73 SA_NOCLDSTOP
74 If signum is SIGCHLD, do not receive notification when child
75 processes stop (i.e., when they receive one of SIGSTOP,