Debian Codegraph @

upstream/debian-trixie/man3/sigset.3

raw
1 '\" t
2 .\" Copyright (c) 2005 by Michael Kerrisk <[email protected]>
3 .\"
4 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
5 .\"
6 .TH sigset 3 2024-05-02 "Linux man-pages 6.9.1"
7 .SH NAME
8 sigset, sighold, sigrelse, sigignore \- System V signal API
9 .SH LIBRARY
10 Standard C library
11 .RI ( libc ", " \-lc )
12 .SH SYNOPSIS
13 .nf
14 .B #include <signal.h>
15 .P
16 .B typedef void (*sighandler_t)(int);
17 .P
18 .BI "[[deprecated]] sighandler_t sigset(int " sig ", sighandler_t " disp );
19 .P
20 .BI "[[deprecated]] int sighold(int " sig );
21 .BI "[[deprecated]] int sigrelse(int " sig );
22 .BI "[[deprecated]] int sigignore(int " sig );
23 .fi
24 .P
25 .RS -4
26 Feature Test Macro Requirements for glibc (see
27 .BR feature_test_macros (7)):
28 .RE
29 .P
30 .BR sigset (),
31 .BR sighold (),
32 .BR sigrelse (),
33 .BR sigignore ():
34 .nf
35 _XOPEN_SOURCE >= 500
36 .\" || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED
37 .fi
38 .SH DESCRIPTION
39 These functions are provided in glibc as a compatibility interface
40 for programs that make use of the historical System V signal API.
41 This API is obsolete: new applications should use the POSIX signal API
42 .RB ( sigaction (2),
43 .BR sigprocmask (2),
44 etc.)
45 .P
46 The
47 .BR sigset ()
48 function modifies the disposition of the signal
49 .IR sig .
50 The
51 .I disp
52 argument can be the address of a signal handler function,
53 or one of the following constants:
54 .TP
55 .B SIG_DFL
56 Reset the disposition of
57 .I sig
58 to the default.
59 .TP
60 .B SIG_IGN
61 Ignore
62 .IR sig .
63 .TP
64 .B SIG_HOLD
65 Add
66 .I sig
67 to the process's signal mask, but leave the disposition of
68 .I sig
69 unchanged.
70 .P
71 If
72 .I disp
73 specifies the address of a signal handler, then
74 .I sig
75 is added to the process's signal mask during execution of the handler.
76 .P
77 If
78 .I disp
79 was specified as a value other than
80 .BR SIG_HOLD ,
81 then
82 .I sig
83 is removed from the process's signal mask.
84 .P
85 The dispositions for
86 .B SIGKILL
87 and
88 .B SIGSTOP
89 cannot be changed.
90 .P
91 The
92 .BR sighold ()
93 function adds
94 .I sig
95 to the calling process's signal mask.
96 .P
97 The
98 .BR sigrelse ()
99 function removes
100 .I sig
101 from the calling process's signal mask.
102 .P
103 The
104 .BR sigignore ()
105 function sets the disposition of
106 .I sig
107 to
108 .BR SIG_IGN .
109 .SH RETURN VALUE
110 On success,
111 .BR sigset ()
112 returns
113 .B SIG_HOLD
114 if
115 .I sig
116 was blocked before the call,
117 or the signal's previous disposition
118 if it was not blocked before the call.
119 On error,
120 .BR sigset ()
121 returns \-1, with
122 .I errno
123 set to indicate the error.
124 (But see BUGS below.)
125 .P
126 The
127 .BR sighold (),
128 .BR sigrelse (),
129 and
130 .BR sigignore ()
131 functions return 0 on success; on error, these functions return \-1 and set
132 .I errno
133 to indicate the error.
134 .SH ERRORS
135 For
136 .BR sigset ()
137 see the ERRORS under
138 .BR sigaction (2)
139 and
140 .BR sigprocmask (2).
141 .P
142 For
143 .BR sighold ()
144 and
145 .BR sigrelse ()
146 see the ERRORS under
147 .BR sigprocmask (2).
148 .P
149 For
150 .BR sigignore (),
151 see the errors under
152 .BR sigaction (2).
153 .SH ATTRIBUTES
154 For an explanation of the terms used in this section, see
155 .BR attributes (7).
156 .TS
157 allbox;
158 lbx lb lb
159 l l l.
160 Interface Attribute Value
161 T{
162 .na
163 .nh
164 .BR sigset (),
165 .BR sighold (),
166 .BR sigrelse (),
167 .BR sigignore ()
168 T} Thread safety MT-Safe
169 .TE
170 .SH STANDARDS
171 POSIX.1-2008.
172 .TP
173 .I sighandler_t
174 GNU.
175 POSIX.1 uses the same type but without a
176 .IR typedef .
177 .SH HISTORY
178 glibc 2.1.
179 SVr4, POSIX.1-2001.
180 POSIX.1-2008 marks these functions
181 as obsolete, recommending the use of
182 .BR sigaction (2),
183 .BR sigprocmask (2),
184 .BR pthread_sigmask (3),
185 and
186 .BR sigsuspend (2)
187 instead.
188 .SH NOTES
189 The
190 .BR sigset ()
191 function provides reliable signal handling semantics (as when calling
192 .BR sigaction (2)
193 with
194 .I sa_mask
195 equal to 0).
196 .P
197 On System V, the
198 .BR signal ()
199 function provides unreliable semantics (as when calling
200 .BR sigaction (2)
201 with
202 .I sa_mask
203 equal to
204 .IR "SA_RESETHAND | SA_NODEFER" ).
205 On BSD,
206 .BR signal ()
207 provides reliable semantics.
208 POSIX.1-2001 leaves these aspects of
209 .BR signal ()
210 unspecified.
211 See
212 .BR signal (2)
213 for further details.
214 .P
215 In order to wait for a signal,
216 BSD and System V both provided a function named
217 .BR sigpause (3),
218 but this function has a different argument on the two systems.
219 See
220 .BR sigpause (3)
221 for details.
222 .SH BUGS
223 Before glibc 2.2,
224 .BR sigset ()
225 did not unblock
226 .I sig
227 if
228 .I disp
229 was specified as a value other than
230 .BR SIG_HOLD .
231 .P
232 Before glibc 2.5,
233 .BR sigset ()
234 does not correctly return the previous disposition of the signal
235 in two cases.
236 First, if
237 .I disp
238 is specified as
239 .BR SIG_HOLD ,
240 then a successful
241 .BR sigset ()
242 always returns
243 .BR SIG_HOLD .
244 Instead, it should return the previous disposition of the signal
245 (unless the signal was blocked, in which case
246 .B SIG_HOLD
247 should be returned).
248 Second, if the signal is currently blocked, then
249 the return value of a successful
250 .BR sigset ()
251 should be
252 .BR SIG_HOLD .
253 Instead, the previous disposition of the signal is returned.
254 These problems have been fixed since glibc 2.5.
255 .\" See http://sourceware.org/bugzilla/show_bug.cgi?id=1951
256 .SH SEE ALSO
257 .BR kill (2),
258 .BR pause (2),
259 .BR sigaction (2),
260 .BR signal (2),
261 .BR sigprocmask (2),
262 .BR raise (3),
263 .BR sigpause (3),
264 .BR sigvec (3),
265 .BR signal (7)