1 .\" Copyright (c) 2005 by Michael Kerrisk <mtk.manpages@gmail.com>
3 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
5 .TH SIGVEC 3 2021-03-22 "Linux man-pages (unreleased)" "Linux Programmer's Manual"
7 sigvec, sigblock, sigsetmask, siggetmask, sigmask \- BSD signal API
10 .RI ( libc ", " \-lc )
13 .B #include <signal.h>
15 .BI "int sigvec(int " sig ", const struct sigvec *" vec ", struct sigvec *" ovec );
17 .BI "int sigmask(int " signum );
19 .BI "int sigblock(int " mask );
20 .BI "int sigsetmask(int " mask );
21 .B int siggetmask(void);
25 Feature Test Macro Requirements for glibc (see
26 .BR feature_test_macros (7)):
29 All functions shown above:
33 Glibc 2.19 and earlier:
37 These functions are provided in glibc as a compatibility interface
38 for programs that make use of the historical BSD signal API.
39 This API is obsolete: new applications should use the POSIX signal API
46 function sets and/or gets the disposition of the signal
52 is not NULL, it points to a
54 structure that defines the new disposition for
58 is not NULL, it points to a
60 structure that is used to return the previous disposition of
62 To obtain the current disposition of
64 without changing it, specify NULL for
66 and a non-null pointer for
77 structure has the following form:
82 void (*sv_handler)(int); /* Signal disposition */
83 int sv_mask; /* Signals to be blocked in handler */
84 int sv_flags; /* Flags */
91 field specifies the disposition of the signal, and is either:
92 the address of a signal handler function;
94 meaning the default disposition applies for the signal; or
96 meaning that the signal is ignored.
100 specifies the address of a signal handler, then
102 specifies a mask of signals that are to be blocked while
103 the handler is executing.
104 In addition, the signal for which the handler is invoked is
110 are silently ignored.
114 specifies the address of a signal handler, then the
116 field specifies flags controlling what happens when the handler is called.
117 This field may contain zero or more of the following flags:
120 If the signal handler interrupts a blocking system call,
121 then upon return from the handler the system call is not restarted:
122 instead it fails with the error
124 If this flag is not specified, then system calls are restarted
128 Reset the disposition of the signal to the default
129 before calling the signal handler.
130 If this flag is not specified, then the handler remains established
131 until explicitly removed by a later call to
133 or until the process performs an
137 Handle the signal on the alternate signal stack
138 (historically established under BSD using the obsolete
140 function; the POSIX replacement is
141 .BR sigaltstack (2)).
145 macro constructs and returns a "signal mask" for
147 For example, we can initialize the
151 using code such as the following:
155 vec.sv_mask = sigmask(SIGQUIT) | sigmask(SIGABRT);
156 /* Block SIGQUIT and SIGABRT during
163 function adds the signals in
165 to the process's signal mask
167 .IR sigprocmask(SIG_BLOCK) ),
168 and returns the process's previous signal mask.
173 are silently ignored.
177 function sets the process's signal mask to the value given in
180 .IR sigprocmask(SIG_SETMASK) ),
181 and returns the process's previous signal mask.
185 function returns the process's current signal mask.
186 This call is equivalent to
191 function returns 0 on success; on error, it returns \-1 and sets
193 to indicate the error.
199 functions return the previous signal mask.
203 macro returns the signal mask for
211 Starting with version 2.21, the GNU C library no longer exports the
213 function as part of the ABI.
214 (To ensure backward compatibility,
215 the glibc symbol versioning scheme continues to export the interface
216 to binaries linked against older versions of the library.)
218 For an explanation of the terms used in this section, see
226 Interface Attribute Value
233 T} Thread safety MT-Safe
239 All of these functions were in
242 whose origin is unclear.
243 These functions are obsolete: do not use them in new programs.
247 function provided reliable semantics (as when calling
254 provides unreliable semantics.
255 POSIX.1 leaves these aspects of
262 In order to wait for a signal,
263 BSD and System V both provided a function named
265 but this function has a different argument on the two systems.