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