]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/sigvec.3
intro.1, _exit.2, access.2, alarm.2, alloc_hugepages.2, arch_prctl.2, bind.2, chdir...
[thirdparty/man-pages.git] / man3 / sigvec.3
CommitLineData
9c2866d7 1'\" t
c11b1abf 2.\" Copyright (c) 2005 by Michael Kerrisk <mtk.manpages@gmail.com>
9c2866d7 3.\"
4b72fb64 4.\" %%%LICENSE_START(verbatim)
9c2866d7
MK
5.\" Permission is granted to make and distribute verbatim copies of this
6.\" manual provided the copyright notice and this permission notice are
7.\" preserved on all copies.
8.\"
9.\" Permission is granted to copy and distribute modified versions of this
10.\" manual under the conditions for verbatim copying, provided that the
11.\" entire resulting derived work is distributed under the terms of a
12.\" permission notice identical to this one.
13.\"
14.\" Since the Linux kernel and libraries are constantly changing, this
15.\" manual page may be incorrect or out-of-date. The author(s) assume no
16.\" responsibility for errors or omissions, or for damages resulting from
10d76543
MK
17.\" the use of the information contained herein. The author(s) may not
18.\" have taken the same level of care in the production of this manual,
19.\" which is licensed free of charge, as they might when working
20.\" professionally.
9c2866d7
MK
21.\"
22.\" Formatted or processed versions of this manual, if unaccompanied by
23.\" the source, must acknowledge the copyright and authors of this work.
4b72fb64 24.\" %%%LICENSE_END
9c2866d7 25.\"
e191c685 26.TH SIGVEC 3 2012-09-06 "Linux" "Linux Programmer's Manual"
9c2866d7
MK
27.SH NAME
28sigvec, sigblock, sigsetmask, siggetmask, sigmask \- BSD signal API
29.SH SYNOPSIS
9c2866d7
MK
30.B #include <signal.h>
31.sp
32.BI "int sigvec(int " sig ", struct sigvec *" vec ", struct sigvec *" ovec );
33.sp
34.BI "int sigmask(int " signum );
35.sp
36.BI "int sigblock(int " mask );
37.sp
38.BI "int sigsetmask(int " mask );
39.sp
40.B int siggetmask(void);
cc4615cc
MK
41.sp
42.in -4n
43Feature Test Macro Requirements for glibc (see
44.BR feature_test_macros (7)):
45.in
46.sp
cfc2d88d 47All functions shown above:
cc4615cc 48_BSD_SOURCE
9c2866d7
MK
49.SH DESCRIPTION
50These functions are provided in glibc as a compatibility interface
51for programs that make use of the historical BSD signal API.
c13182ef
MK
52This API is obsolete: new applications should use the POSIX signal API
53.RB ( sigaction (2),
9c2866d7 54.BR sigprocmask (2),
1bea464c 55etc.).
9c2866d7
MK
56
57The
58.BR sigvec ()
59function sets and/or gets the disposition of the signal
c13182ef 60.I sig
9c2866d7
MK
61(like the POSIX
62.BR sigaction (2)).
c13182ef 63If
9c2866d7
MK
64.I vec
65is not NULL, it points to a
66.I sigvec
c13182ef 67structure that defines the new disposition for
9c2866d7
MK
68.IR sig .
69If
70.I ovec
c13182ef 71is not NULL, it points to a
9c2866d7
MK
72.I sigvec
73structure that is used to return the previous disposition of
74.IR sig .
c13182ef 75To obtain the current disposition of
9c2866d7
MK
76.I sig
77without changing it, specify NULL for
c13182ef 78.IR vec ,
9c2866d7
MK
79and a non-NULL pointer for
80.IR ovec .
81
82The dispositions for
83.B SIGKILL
c13182ef 84and
9c2866d7
MK
85.B SIGSTOP
86cannot be changed.
87
88The
89.I sigvec
90structure has the following form:
088a639b 91.in +4n
9c2866d7
MK
92.nf
93
94struct sigvec {
559a2b66
MK
95 void (*sv_handler)(int); /* Signal disposition */
96 int sv_mask; /* Signals to be blocked in handler */
97 int sv_flags; /* Flags */
9c2866d7
MK
98};
99
100.fi
d4f3dcff 101.in
9c2866d7
MK
102The
103.I sv_handler
104field specifies the disposition of the signal, and is either:
4eaa04c5 105the address of a signal handler function;
1bea464c 106.BR SIG_DFL ,
9c2866d7 107meaning the default disposition applies for the signal; or
1bea464c 108.BR SIG_IGN ,
9c2866d7
MK
109meaning that the signal is ignored.
110
111If
112.I sv_handler
113specifies the address of a signal handler, then
114.I sv_mask
c13182ef 115specifies a mask of signals that are to be blocked while
9c2866d7 116the handler is executing.
c13182ef 117In addition, the signal for which the handler is invoked is
e191c685 118also blocked.
9c2866d7
MK
119Attempts to block
120.B SIGKILL
c13182ef 121or
9c2866d7
MK
122.B SIGSTOP
123are silently ignored.
124
125If
126.I sv_handler
127specifies the address of a signal handler, then the
128.I sv_flags
129field specifies flags controlling what happens when the handler is called.
130This field may contain zero or more of the following flags:
131.TP
132.B SV_INTERRUPT
133If the signal handler interrupts a blocking system call,
134then upon return from the handler the system call will not be restarted:
135instead it will fail with the error
7b2b5ea4 136.BR EINTR .
c13182ef 137If this flag is not specified, then system calls are restarted
9c2866d7
MK
138by default.
139.TP
140.B SV_RESETHAND
c13182ef 141Reset the disposition of the signal to the default
9c2866d7
MK
142before calling the signal handler.
143If this flag is not specified, then the handler remains established
c13182ef 144until explicitly removed by a later call to
9c2866d7
MK
145.BR sigvec ()
146or until the process performs an
147.BR execve (2).
148.TP
149.B SV_ONSTACK
c13182ef
MK
150Handle the signal on the alternate signal stack
151(historically established under BSD using the obsolete
9c2866d7 152.BR sigstack ()
c13182ef 153function; the POSIX replacement is
fb186734 154.BR sigaltstack (2)).
9c2866d7 155.PP
c13182ef 156The
9c2866d7
MK
157.BR sigmask ()
158function constructs and returns a "signal mask" for
159.IR signum .
d9bfdb9c 160For example, we can initialize the
c13182ef
MK
161.I vec.sv_mask
162field given to
9c2866d7
MK
163.BR sigvec ()
164using code such as the following:
165.nf
166
cf0a9ace 167 vec.sv_mask = sigmask(SIGQUIT) | sigpause(SIGABRT);
c13182ef 168 /* Block SIGQUIT and SIGABRT during
9c2866d7
MK
169 handler execution */
170.fi
171.PP
172The
173.BR sigblock ()
174function adds the signals in
175.I mask
176to the process's signal mask
c13182ef 177(like POSIX
9c2866d7
MK
178.IR sigprocmask(SIG_BLOCK) ),
179and returns the process's previous signal mask.
180Attempts to block
181.B SIGKILL
c13182ef 182or
9c2866d7
MK
183.B SIGSTOP
184are silently ignored.
185.PP
c13182ef 186The
9c2866d7
MK
187.BR sigsetmask ()
188function sets the process's signal mask to the value given in
c13182ef
MK
189.I mask
190(like POSIX
9c2866d7
MK
191.IR sigprocmask(SIG_SETMASK) ),
192and returns the process's previous signal mask.
193.PP
194The
195.BR siggetmask ()
196function returns the process's current signal mask.
197This call is equivalent to
198.IR sigblock(0) .
199.SH RETURN VALUE
c13182ef 200The
9c2866d7
MK
201.BR sigvec ()
202function returns 0 on success; on error, it returns \-1 and sets
c13182ef 203.I errno
9c2866d7
MK
204to indicate the error.
205
206The
207.BR sigblock ()
208and
209.BR sigsetmask ()
210functions return the previous signal mask.
211
212The
213.BR sigmask ()
214function returns the signal mask for
215.IR signum .
216.SH ERRORS
217See the ERRORS under
218.BR sigaction (2)
219and
220.BR sigprocmask (2).
47297adb 221.SH CONFORMING TO
2b2581ee
MK
222All of these functions were in
2234.3BSD, except
224.BR siggetmask (),
225whose origin is unclear.
226These functions are obsolete: do not use them in new programs.
9c2866d7
MK
227.SH NOTES
228On 4.3BSD, the
229.BR signal ()
c13182ef 230function provided reliable semantics (as when calling
9c2866d7
MK
231.BR sigvec ()
232with
233.I vec.sv_mask
234equal to 0).
235On System V,
236.BR signal ()
237provides unreliable semantics.
c13182ef 238POSIX.1-2001 leaves these aspects of
9c2866d7
MK
239.BR signal ()
240unspecified.
c13182ef 241See
9c2866d7
MK
242.BR signal (2)
243for further details.
244
245In order to wait for a signal,
246BSD and System V both provided a function named
7a056410 247.BR sigpause (3),
9c2866d7
MK
248but this function has a different argument on the two systems.
249See
250.BR sigpause (3)
251for details.
47297adb 252.SH SEE ALSO
9c2866d7
MK
253.BR kill (2),
254.BR pause (2),
9c2866d7
MK
255.BR sigaction (2),
256.BR signal (2),
257.BR sigprocmask (2),
9fe51d8d 258.BR raise (3),
46c721e7
MK
259.BR sigpause (3),
260.BR sigset (3),
9c2866d7 261.BR signal (7)