summaryrefslogtreecommitdiffstats
path: root/man/man3/sigvec.3
blob: 31f5ef4bebd403b615e893d83357c22bc27f85cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
'\" t
.\" Copyright (c) 2005 by Michael Kerrisk <mtk.manpages@gmail.com>
.\"
.\" SPDX-License-Identifier: Linux-man-pages-copyleft
.\"
.TH sigvec 3 2024-05-02 "Linux man-pages (unreleased)"
.SH NAME
sigvec, sigblock, sigsetmask, siggetmask, sigmask \- BSD signal API
.SH LIBRARY
Standard C library
.RI ( libc ", " \-lc )
.SH SYNOPSIS
.nf
.B #include <signal.h>
.P
.BI "[[deprecated]] int sigvec(int " sig ", const struct sigvec *" vec ,
.BI "                          struct sigvec *" ovec );
.P
.BI "[[deprecated]] int sigmask(int " signum );
.P
.BI "[[deprecated]] int sigblock(int " mask );
.BI "[[deprecated]] int sigsetmask(int " mask );
.B [[deprecated]] int siggetmask(void);
.fi
.P
.RS -4
Feature Test Macro Requirements for glibc (see
.BR feature_test_macros (7)):
.RE
.P
All functions shown above:
.nf
    Since glibc 2.19:
        _DEFAULT_SOURCE
    glibc 2.19 and earlier:
        _BSD_SOURCE
.fi
.SH DESCRIPTION
These functions are provided in glibc as a compatibility interface
for programs that make use of the historical BSD signal API.
This API is obsolete: new applications should use the POSIX signal API
.RB ( sigaction (2),
.BR sigprocmask (2),
etc.).
.P
The
.BR sigvec ()
function sets and/or gets the disposition of the signal
.I sig
(like the POSIX
.BR sigaction (2)).
If
.I vec
is not NULL, it points to a
.I sigvec
structure that defines the new disposition for
.IR sig .
If
.I ovec
is not NULL, it points to a
.I sigvec
structure that is used to return the previous disposition of
.IR sig .
To obtain the current disposition of
.I sig
without changing it, specify NULL for
.IR vec ,
and a non-null pointer for
.IR ovec .
.P
The dispositions for
.B SIGKILL
and
.B SIGSTOP
cannot be changed.
.P
The
.I sigvec
structure has the following form:
.P
.in +4n
.EX
struct sigvec {
    void (*sv_handler)(int); /* Signal disposition */
    int    sv_mask;          /* Signals to be blocked in handler */
    int    sv_flags;         /* Flags */
};
.EE
.in
.P
The
.I sv_handler
field specifies the disposition of the signal, and is either:
the address of a signal handler function;
.BR SIG_DFL ,
meaning the default disposition applies for the signal; or
.BR SIG_IGN ,
meaning that the signal is ignored.
.P
If
.I sv_handler
specifies the address of a signal handler, then
.I sv_mask
specifies a mask of signals that are to be blocked while
the handler is executing.
In addition, the signal for which the handler is invoked is
also blocked.
Attempts to block
.B SIGKILL
or
.B SIGSTOP
are silently ignored.
.P
If
.I sv_handler
specifies the address of a signal handler, then the
.I sv_flags
field specifies flags controlling what happens when the handler is called.
This field may contain zero or more of the following flags:
.TP
.B SV_INTERRUPT
If the signal handler interrupts a blocking system call,
then upon return from the handler the system call is not restarted:
instead it fails with the error
.BR EINTR .
If this flag is not specified, then system calls are restarted
by default.
.TP
.B SV_RESETHAND
Reset the disposition of the signal to the default
before calling the signal handler.
If this flag is not specified, then the handler remains established
until explicitly removed by a later call to
.BR sigvec ()
or until the process performs an
.BR execve (2).
.TP
.B SV_ONSTACK
Handle the signal on the alternate signal stack
(historically established under BSD using the obsolete
.BR sigstack ()
function; the POSIX replacement is
.BR sigaltstack (2)).
.P
The
.BR sigmask ()
macro constructs and returns a "signal mask" for
.IR signum .
For example, we can initialize the
.I vec.sv_mask
field given to
.BR sigvec ()
using code such as the following:
.P
.in +4n
.EX
vec.sv_mask = sigmask(SIGQUIT) | sigmask(SIGABRT);
            /* Block SIGQUIT and SIGABRT during
               handler execution */
.EE
.in
.P
The
.BR sigblock ()
function adds the signals in
.I mask
to the process's signal mask
(like POSIX
.IR sigprocmask(SIG_BLOCK) ),
and returns the process's previous signal mask.
Attempts to block
.B SIGKILL
or
.B SIGSTOP
are silently ignored.
.P
The
.BR sigsetmask ()
function sets the process's signal mask to the value given in
.I mask
(like POSIX
.IR sigprocmask(SIG_SETMASK) ),
and returns the process's previous signal mask.
.P
The
.BR siggetmask ()
function returns the process's current signal mask.
This call is equivalent to
.IR sigblock(0) .
.SH RETURN VALUE
The
.BR sigvec ()
function returns 0 on success; on error, it returns \-1 and sets
.I errno
to indicate the error.
.P
The
.BR sigblock ()
and
.BR sigsetmask ()
functions return the previous signal mask.
.P
The
.BR sigmask ()
macro returns the signal mask for
.IR signum .
.SH ERRORS
See the ERRORS under
.BR sigaction (2)
and
.BR sigprocmask (2).
.SH ATTRIBUTES
For an explanation of the terms used in this section, see
.BR attributes (7).
.TS
allbox;
lbx lb lb
l l l.
Interface	Attribute	Value
T{
.na
.nh
.BR sigvec (),
.BR sigmask (),
.BR sigblock (),
.BR sigsetmask (),
.BR siggetmask ()
T}	Thread safety	MT-Safe
.TE
.SH STANDARDS
None.
.SH HISTORY
.TP
.BR sigvec ()
.TQ
.BR sigblock ()
.TQ
.BR sigmask ()
.TQ
.BR sigsetmask ()
4.3BSD.
.TP
.BR siggetmask ()
Unclear origin.
.TP
.BR sigvec ()
Removed in glibc 2.21.
.SH NOTES
On 4.3BSD, the
.BR signal ()
function provided reliable semantics (as when calling
.BR sigvec ()
with
.I vec.sv_mask
equal to 0).
On System V,
.BR signal ()
provides unreliable semantics.
POSIX.1 leaves these aspects of
.BR signal ()
unspecified.
See
.BR signal (2)
for further details.
.P
In order to wait for a signal,
BSD and System V both provided a function named
.BR sigpause (3),
but this function has a different argument on the two systems.
See
.BR sigpause (3)
for details.
.SH SEE ALSO
.BR kill (2),
.BR pause (2),
.BR sigaction (2),
.BR signal (2),
.BR sigprocmask (2),
.BR raise (3),
.BR sigpause (3),
.BR sigset (3),
.BR signal (7)