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