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