]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/sigset.3
Start of man-pages-5.03: renaming .Announce and .lsm files
[thirdparty/man-pages.git] / man3 / sigset.3
1 '\" t
2 .\" Copyright (c) 2005 by Michael Kerrisk <mtk.manpages@gmail.com>
3 .\"
4 .\" %%%LICENSE_START(VERBATIM)
5 .\" Permission is granted to make and distribute verbatim copies of this
6 .\" manual provided the copyright notice and this permission notice are
7 .\" preserved on all copies.
8 .\"
9 .\" Permission is granted to copy and distribute modified versions of this
10 .\" manual under the conditions for verbatim copying, provided that the
11 .\" entire resulting derived work is distributed under the terms of a
12 .\" permission notice identical to this one.
13 .\"
14 .\" Since the Linux kernel and libraries are constantly changing, this
15 .\" manual page may be incorrect or out-of-date. The author(s) assume no
16 .\" responsibility for errors or omissions, or for damages resulting from
17 .\" the use of the information contained herein. The author(s) may not
18 .\" have taken the same level of care in the production of this manual,
19 .\" which is licensed free of charge, as they might when working
20 .\" professionally.
21 .\"
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
24 .\" %%%LICENSE_END
25 .\"
26 .TH SIGSET 3 2017-09-15 "Linux" "Linux Programmer's Manual"
27 .SH NAME
28 sigset, sighold, sigrelse, sigignore \- System V signal API
29 .SH SYNOPSIS
30 .B #include <signal.h>
31 .PP
32 .B typedef void (*sighandler_t)(int);
33 .PP
34 .BI "sighandler_t sigset(int " sig ", sighandler_t " disp );
35 .PP
36 .BI "int sighold(int " sig );
37 .PP
38 .BI "int sigrelse(int " sig );
39 .PP
40 .BI "int sigignore(int " sig );
41 .PP
42 .in -4n
43 Feature Test Macro Requirements for glibc (see
44 .BR feature_test_macros (7)):
45 .in
46 .PP
47 .ad l
48 .BR sigset (),
49 .BR sighold (),
50 .BR sigrelse (),
51 .BR sigignore ():
52 .br
53 .RS 4
54 _XOPEN_SOURCE\ >=\ 500
55 .\" || _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED
56 .RE
57 .ad
58 .SH DESCRIPTION
59 These functions are provided in glibc as a compatibility interface
60 for programs that make use of the historical System V signal API.
61 This API is obsolete: new applications should use the POSIX signal API
62 .RB ( sigaction (2),
63 .BR sigprocmask (2),
64 etc.)
65 .PP
66 The
67 .BR sigset ()
68 function modifies the disposition of the signal
69 .IR sig .
70 The
71 .I disp
72 argument can be the address of a signal handler function,
73 or one of the following constants:
74 .TP
75 .B SIG_DFL
76 Reset the disposition of
77 .I sig
78 to the default.
79 .TP
80 .B SIG_IGN
81 Ignore
82 .IR sig .
83 .TP
84 .B SIG_HOLD
85 Add
86 .I sig
87 to the process's signal mask, but leave the disposition of
88 .I sig
89 unchanged.
90 .PP
91 If
92 .I disp
93 specifies the address of a signal handler, then
94 .I sig
95 is added to the process's signal mask during execution of the handler.
96 .PP
97 If
98 .I disp
99 was specified as a value other than
100 .BR SIG_HOLD ,
101 then
102 .I sig
103 is removed from the process's signal mask.
104 .PP
105 The dispositions for
106 .B SIGKILL
107 and
108 .B SIGSTOP
109 cannot be changed.
110 .PP
111 The
112 .BR sighold ()
113 function adds
114 .I sig
115 to the calling process's signal mask.
116 .PP
117 The
118 .BR sigrelse ()
119 function removes
120 .I sig
121 from the calling process's signal mask.
122 .PP
123 The
124 .BR sigignore ()
125 function sets the disposition of
126 .I sig
127 to
128 .BR SIG_IGN .
129 .SH RETURN VALUE
130 On success,
131 .BR sigset ()
132 returns
133 .B SIG_HOLD
134 if
135 .I sig
136 was blocked before the call,
137 or the signal's previous disposition
138 if it was not blocked before the call.
139 On error,
140 .BR sigset ()
141 returns \-1, with
142 .I errno
143 set to indicate the error.
144 (But see BUGS below.)
145 .PP
146 The
147 .BR sighold (),
148 .BR sigrelse (),
149 and
150 .BR sigignore ()
151 functions return 0 on success; on error, these functions return \-1 and set
152 .I errno
153 to indicate the error.
154 .SH ERRORS
155 For
156 .BR sigset ()
157 see the ERRORS under
158 .BR sigaction (2)
159 and
160 .BR sigprocmask (2).
161 .PP
162 For
163 .BR sighold ()
164 and
165 .BR sigrelse ()
166 see the ERRORS under
167 .BR sigprocmask (2).
168 .PP
169 For
170 .BR sigignore (),
171 see the errors under
172 .BR sigaction (2).
173 .SH ATTRIBUTES
174 For an explanation of the terms used in this section, see
175 .BR attributes (7).
176 .TS
177 allbox;
178 lbw23 lb lb
179 l l l.
180 Interface Attribute Value
181 T{
182 .BR sigset (),
183 .BR sighold (),
184 .br
185 .BR sigrelse (),
186 .BR sigignore ()
187 T} Thread safety MT-Safe
188 .TE
189 .SH CONFORMING TO
190 SVr4, POSIX.1-2001, POSIX.1-2008.
191 These functions are obsolete: do not use them in new programs.
192 POSIX.1-2008 marks
193 .BR sighold (),
194 .BR sigignore (),
195 .BR sigpause (3),
196 .BR sigrelse (),
197 and
198 .BR sigset ()
199 as obsolete, recommending the use of
200 .BR sigaction (2),
201 .BR sigprocmask (2),
202 .BR pthread_sigmask (3),
203 and
204 .BR sigsuspend (2)
205 instead.
206 .SH NOTES
207 These functions appeared in glibc version 2.1.
208 .PP
209 The
210 .I sighandler_t
211 type is a GNU extension; it is used on this page only to make the
212 .BR sigset ()
213 prototype more easily readable.
214 .PP
215 The
216 .BR sigset ()
217 function provides reliable signal handling semantics (as when calling
218 .BR sigaction (2)
219 with
220 .I sa_mask
221 equal to 0).
222 .PP
223 On System V, the
224 .BR signal ()
225 function provides unreliable semantics (as when calling
226 .BR sigaction (2)
227 with
228 .I sa_mask
229 equal to
230 .IR "SA_RESETHAND | SA_NODEFER" ).
231 On BSD,
232 .BR signal ()
233 provides reliable semantics.
234 POSIX.1-2001 leaves these aspects of
235 .BR signal ()
236 unspecified.
237 See
238 .BR signal (2)
239 for further details.
240 .PP
241 In order to wait for a signal,
242 BSD and System V both provided a function named
243 .BR sigpause (3),
244 but this function has a different argument on the two systems.
245 See
246 .BR sigpause (3)
247 for details.
248 .SH BUGS
249 In versions of glibc before 2.2,
250 .BR sigset ()
251 did not unblock
252 .I sig
253 if
254 .I disp
255 was specified as a value other than
256 .BR SIG_HOLD .
257 .PP
258 In versions of glibc before 2.5,
259 .BR sigset ()
260 does not correctly return the previous disposition of the signal
261 in two cases.
262 First, if
263 .I disp
264 is specified as
265 .BR SIG_HOLD ,
266 then a successful
267 .BR sigset ()
268 always returns
269 .BR SIG_HOLD .
270 Instead, it should return the previous disposition of the signal
271 (unless the signal was blocked, in which case
272 .B SIG_HOLD
273 should be returned).
274 Second, if the signal is currently blocked, then
275 the return value of a successful
276 .BR sigset ()
277 should be
278 .BR SIG_HOLD .
279 Instead, the previous disposition of the signal is returned.
280 These problems have been fixed since glibc 2.5.
281 .\" See http://sourceware.org/bugzilla/show_bug.cgi?id=1951
282 .SH SEE ALSO
283 .BR kill (2),
284 .BR pause (2),
285 .BR sigaction (2),
286 .BR signal (2),
287 .BR sigprocmask (2),
288 .BR raise (3),
289 .BR sigpause (3),
290 .BR sigvec (3),
291 .BR signal (7)