1 .\" Copyright (c) 2005 by Michael Kerrisk <mtk.manpages@gmail.com>
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date. The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein. The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
25 .TH SIGVEC 3 2021-03-22 "Linux" "Linux Programmer's Manual"
27 sigvec, sigblock, sigsetmask, siggetmask, sigmask \- BSD signal API
30 .B #include <signal.h>
32 .BI "int sigvec(int " sig ", const struct sigvec *" vec ", struct sigvec *" ovec );
34 .BI "int sigmask(int " signum );
36 .BI "int sigblock(int " mask );
37 .BI "int sigsetmask(int " mask );
38 .B int siggetmask(void);
42 Feature Test Macro Requirements for glibc (see
43 .BR feature_test_macros (7)):
46 All functions shown above:
50 Glibc 2.19 and earlier:
54 These functions are provided in glibc as a compatibility interface
55 for programs that make use of the historical BSD signal API.
56 This API is obsolete: new applications should use the POSIX signal API
63 function sets and/or gets the disposition of the signal
69 is not NULL, it points to a
71 structure that defines the new disposition for
75 is not NULL, it points to a
77 structure that is used to return the previous disposition of
79 To obtain the current disposition of
81 without changing it, specify NULL for
83 and a non-null pointer for
94 structure has the following form:
99 void (*sv_handler)(int); /* Signal disposition */
100 int sv_mask; /* Signals to be blocked in handler */
101 int sv_flags; /* Flags */
108 field specifies the disposition of the signal, and is either:
109 the address of a signal handler function;
111 meaning the default disposition applies for the signal; or
113 meaning that the signal is ignored.
117 specifies the address of a signal handler, then
119 specifies a mask of signals that are to be blocked while
120 the handler is executing.
121 In addition, the signal for which the handler is invoked is
127 are silently ignored.
131 specifies the address of a signal handler, then the
133 field specifies flags controlling what happens when the handler is called.
134 This field may contain zero or more of the following flags:
137 If the signal handler interrupts a blocking system call,
138 then upon return from the handler the system call is not restarted:
139 instead it fails with the error
141 If this flag is not specified, then system calls are restarted
145 Reset the disposition of the signal to the default
146 before calling the signal handler.
147 If this flag is not specified, then the handler remains established
148 until explicitly removed by a later call to
150 or until the process performs an
154 Handle the signal on the alternate signal stack
155 (historically established under BSD using the obsolete
157 function; the POSIX replacement is
158 .BR sigaltstack (2)).
162 macro constructs and returns a "signal mask" for
164 For example, we can initialize the
168 using code such as the following:
172 vec.sv_mask = sigmask(SIGQUIT) | sigmask(SIGABRT);
173 /* Block SIGQUIT and SIGABRT during
180 function adds the signals in
182 to the process's signal mask
184 .IR sigprocmask(SIG_BLOCK) ),
185 and returns the process's previous signal mask.
190 are silently ignored.
194 function sets the process's signal mask to the value given in
197 .IR sigprocmask(SIG_SETMASK) ),
198 and returns the process's previous signal mask.
202 function returns the process's current signal mask.
203 This call is equivalent to
208 function returns 0 on success; on error, it returns \-1 and sets
210 to indicate the error.
216 functions return the previous signal mask.
220 macro returns the signal mask for
228 Starting with version 2.21, the GNU C library no longer exports the
230 function as part of the ABI.
231 (To ensure backward compatibility,
232 the glibc symbol versioning scheme continues to export the interface
233 to binaries linked against older versions of the library.)
235 For an explanation of the terms used in this section, see
243 Interface Attribute Value
250 T} Thread safety MT-Safe
256 All of these functions were in
259 whose origin is unclear.
260 These functions are obsolete: do not use them in new programs.
264 function provided reliable semantics (as when calling
271 provides unreliable semantics.
272 POSIX.1 leaves these aspects of
279 In order to wait for a signal,
280 BSD and System V both provided a function named
282 but this function has a different argument on the two systems.