1SIGSET(3) Linux Programmer's Manual SIGSET(3)
2
3
4
6 sigset, sighold, sigrelse, sigignore - System V signal API
7
9 #include <signal.h>
10
11 typedef void (*sighandler_t)(int);
12
13 sighandler_t sigset(int sig, sighandler_t disp);
14
15 int sighold(int sig);
16
17 int sigrelse(int sig);
18
19 int sigignore(int sig);
20
21 Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
22
23 sigset(), sighold(), sigrelse(), sigignore():
24 _XOPEN_SOURCE >= 500
25
27 These functions are provided in glibc as a compatibility interface for
28 programs that make use of the historical System V signal API. This API
29 is obsolete: new applications should use the POSIX signal API (sigac‐
30 tion(2), sigprocmask(2), etc.)
31
32 The sigset() function modifies the disposition of the signal sig. The
33 disp argument can be the address of a signal handler function, or one
34 of the following constants:
35
36 SIG_DFL
37 Reset the disposition of sig to the default.
38
39 SIG_IGN
40 Ignore sig.
41
42 SIG_HOLD
43 Add sig to the process's signal mask, but leave the disposition
44 of sig unchanged.
45
46 If disp specifies the address of a signal handler, then sig is added to
47 the process's signal mask during execution of the handler.
48
49 If disp was specified as a value other than SIG_HOLD, then sig is re‐
50 moved from the process's signal mask.
51
52 The dispositions for SIGKILL and SIGSTOP cannot be changed.
53
54 The sighold() function adds sig to the calling process's signal mask.
55
56 The sigrelse() function removes sig from the calling process's signal
57 mask.
58
59 The sigignore() function sets the disposition of sig to SIG_IGN.
60
62 On success, sigset() returns SIG_HOLD if sig was blocked before the
63 call, or the signal's previous disposition if it was not blocked before
64 the call. On error, sigset() returns -1, with errno set to indicate
65 the error. (But see BUGS below.)
66
67 The sighold(), sigrelse(), and sigignore() functions return 0 on suc‐
68 cess; on error, these functions return -1 and set errno to indicate the
69 error.
70
72 For sigset() see the ERRORS under sigaction(2) and sigprocmask(2).
73
74 For sighold() and sigrelse() see the ERRORS under sigprocmask(2).
75
76 For sigignore(), see the errors under sigaction(2).
77
79 For an explanation of the terms used in this section, see at‐
80 tributes(7).
81
82 ┌────────────────────────┬───────────────┬─────────┐
83 │Interface │ Attribute │ Value │
84 ├────────────────────────┼───────────────┼─────────┤
85 │sigset(), sighold(), │ Thread safety │ MT-Safe │
86 │sigrelse(), sigignore() │ │ │
87 └────────────────────────┴───────────────┴─────────┘
89 SVr4, POSIX.1-2001, POSIX.1-2008. These functions are obsolete: do not
90 use them in new programs. POSIX.1-2008 marks sighold(), sigignore(),
91 sigpause(3), sigrelse(), and sigset() as obsolete, recommending the use
92 of sigaction(2), sigprocmask(2), pthread_sigmask(3), and sigsuspend(2)
93 instead.
94
96 These functions appeared in glibc version 2.1.
97
98 The sighandler_t type is a GNU extension; it is used on this page only
99 to make the sigset() prototype more easily readable.
100
101 The sigset() function provides reliable signal handling semantics (as
102 when calling sigaction(2) with sa_mask equal to 0).
103
104 On System V, the signal() function provides unreliable semantics (as
105 when calling sigaction(2) with sa_mask equal to SA_RESETHAND | SA_NODE‐
106 FER). On BSD, signal() provides reliable semantics. POSIX.1-2001
107 leaves these aspects of signal() unspecified. See signal(2) for fur‐
108 ther details.
109
110 In order to wait for a signal, BSD and System V both provided a func‐
111 tion named sigpause(3), but this function has a different argument on
112 the two systems. See sigpause(3) for details.
113
115 In versions of glibc before 2.2, sigset() did not unblock sig if disp
116 was specified as a value other than SIG_HOLD.
117
118 In versions of glibc before 2.5, sigset() does not correctly return the
119 previous disposition of the signal in two cases. First, if disp is
120 specified as SIG_HOLD, then a successful sigset() always returns
121 SIG_HOLD. Instead, it should return the previous disposition of the
122 signal (unless the signal was blocked, in which case SIG_HOLD should be
123 returned). Second, if the signal is currently blocked, then the return
124 value of a successful sigset() should be SIG_HOLD. Instead, the previ‐
125 ous disposition of the signal is returned. These problems have been
126 fixed since glibc 2.5.
127
129 kill(2), pause(2), sigaction(2), signal(2), sigprocmask(2), raise(3),
130 sigpause(3), sigvec(3), signal(7)
131
133 This page is part of release 5.10 of the Linux man-pages project. A
134 description of the project, information about reporting bugs, and the
135 latest version of this page, can be found at
136 https://www.kernel.org/doc/man-pages/.
137
138
139
140Linux 2020-08-13 SIGSET(3)