1sigvec(3) Library Functions Manual sigvec(3)
2
3
4
6 sigvec, sigblock, sigsetmask, siggetmask, sigmask - BSD signal API
7
9 Standard C library (libc, -lc)
10
12 #include <signal.h>
13
14 [[deprecated]] int sigvec(int sig, const struct sigvec *vec,
15 struct sigvec *ovec);
16
17 [[deprecated]] int sigmask(int signum);
18
19 [[deprecated]] int sigblock(int mask);
20 [[deprecated]] int sigsetmask(int mask);
21 [[deprecated]] int siggetmask(void);
22
23 Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
24
25 All functions shown above:
26 Since glibc 2.19:
27 _DEFAULT_SOURCE
28 glibc 2.19 and earlier:
29 _BSD_SOURCE
30
32 These functions are provided in glibc as a compatibility interface for
33 programs that make use of the historical BSD signal API. This API is
34 obsolete: new applications should use the POSIX signal API (sigac‐
35 tion(2), sigprocmask(2), etc.).
36
37 The sigvec() function sets and/or gets the disposition of the signal
38 sig (like the POSIX sigaction(2)). If vec is not NULL, it points to a
39 sigvec structure that defines the new disposition for sig. If ovec is
40 not NULL, it points to a sigvec structure that is used to return the
41 previous disposition of sig. To obtain the current disposition of sig
42 without changing it, specify NULL for vec, and a non-null pointer for
43 ovec.
44
45 The dispositions for SIGKILL and SIGSTOP cannot be changed.
46
47 The sigvec structure has the following form:
48
49 struct sigvec {
50 void (*sv_handler)(int); /* Signal disposition */
51 int sv_mask; /* Signals to be blocked in handler */
52 int sv_flags; /* Flags */
53 };
54
55 The sv_handler field specifies the disposition of the signal, and is
56 either: the address of a signal handler function; SIG_DFL, meaning the
57 default disposition applies for the signal; or SIG_IGN, meaning that
58 the signal is ignored.
59
60 If sv_handler specifies the address of a signal handler, then sv_mask
61 specifies a mask of signals that are to be blocked while the handler is
62 executing. In addition, the signal for which the handler is invoked is
63 also blocked. Attempts to block SIGKILL or SIGSTOP are silently ig‐
64 nored.
65
66 If sv_handler specifies the address of a signal handler, then the
67 sv_flags field specifies flags controlling what happens when the han‐
68 dler is called. This field may contain zero or more of the following
69 flags:
70
71 SV_INTERRUPT
72 If the signal handler interrupts a blocking system call, then
73 upon return from the handler the system call is not restarted:
74 instead it fails with the error EINTR. If this flag is not
75 specified, then system calls are restarted by default.
76
77 SV_RESETHAND
78 Reset the disposition of the signal to the default before call‐
79 ing the signal handler. If this flag is not specified, then the
80 handler remains established until explicitly removed by a later
81 call to sigvec() or until the process performs an execve(2).
82
83 SV_ONSTACK
84 Handle the signal on the alternate signal stack (historically
85 established under BSD using the obsolete sigstack() function;
86 the POSIX replacement is sigaltstack(2)).
87
88 The sigmask() macro constructs and returns a "signal mask" for signum.
89 For example, we can initialize the vec.sv_mask field given to sigvec()
90 using code such as the following:
91
92 vec.sv_mask = sigmask(SIGQUIT) | sigmask(SIGABRT);
93 /* Block SIGQUIT and SIGABRT during
94 handler execution */
95
96 The sigblock() function adds the signals in mask to the process's sig‐
97 nal mask (like POSIX sigprocmask(SIG_BLOCK)), and returns the process's
98 previous signal mask. Attempts to block SIGKILL or SIGSTOP are
99 silently ignored.
100
101 The sigsetmask() function sets the process's signal mask to the value
102 given in mask (like POSIX sigprocmask(SIG_SETMASK)), and returns the
103 process's previous signal mask.
104
105 The siggetmask() function returns the process's current signal mask.
106 This call is equivalent to sigblock(0).
107
109 The sigvec() function returns 0 on success; on error, it returns -1 and
110 sets errno to indicate the error.
111
112 The sigblock() and sigsetmask() functions return the previous signal
113 mask.
114
115 The sigmask() macro returns the signal mask for signum.
116
118 See the ERRORS under sigaction(2) and sigprocmask(2).
119
121 For an explanation of the terms used in this section, see at‐
122 tributes(7).
123
124 ┌────────────────────────────────────────────┬───────────────┬─────────┐
125 │Interface │ Attribute │ Value │
126 ├────────────────────────────────────────────┼───────────────┼─────────┤
127 │sigvec(), sigmask(), sigblock(), │ Thread safety │ MT-Safe │
128 │sigsetmask(), siggetmask() │ │ │
129 └────────────────────────────────────────────┴───────────────┴─────────┘
130
132 None.
133
135 sigvec()
136 sigblock()
137 sigmask()
138 sigsetmask()
139 4.3BSD.
140
141 siggetmask()
142 Unclear origin.
143
144 sigvec()
145 Removed in glibc 2.21.
146
148 On 4.3BSD, the signal() function provided reliable semantics (as when
149 calling sigvec() with vec.sv_mask equal to 0). On System V, signal()
150 provides unreliable semantics. POSIX.1 leaves these aspects of
151 signal() unspecified. See signal(2) for further details.
152
153 In order to wait for a signal, BSD and System V both provided a
154 function named sigpause(3), but this function has a different argument
155 on the two systems. See sigpause(3) for details.
156
158 kill(2), pause(2), sigaction(2), signal(2), sigprocmask(2), raise(3),
159 sigpause(3), sigset(3), signal(7)
160
161
162
163Linux man-pages 6.05 2023-07-20 sigvec(3)