1SIGVEC(3)                  Linux Programmer's Manual                 SIGVEC(3)
2
3
4

NAME

6       sigvec, sigblock, sigsetmask, siggetmask, sigmask - BSD signal API
7

SYNOPSIS

9       #include <signal.h>
10
11       int sigvec(int sig, const struct sigvec *vec, struct sigvec *ovec);
12
13       int sigmask(int signum);
14
15       int sigblock(int mask);
16
17       int sigsetmask(int mask);
18
19       int siggetmask(void);
20
21   Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
22
23       All functions shown above:
24           Since glibc 2.19:
25               _DEFAULT_SOURCE
26           Glibc 2.19 and earlier:
27               _BSD_SOURCE
28

DESCRIPTION

30       These  functions are provided in glibc as a compatibility interface for
31       programs that make use of the historical BSD signal API.  This  API  is
32       obsolete:  new  applications  should  use  the POSIX signal API (sigac‐
33       tion(2), sigprocmask(2), etc.).
34
35       The sigvec() function sets and/or gets the disposition  of  the  signal
36       sig  (like the POSIX sigaction(2)).  If vec is not NULL, it points to a
37       sigvec structure that defines the new disposition for sig.  If ovec  is
38       not  NULL,  it  points to a sigvec structure that is used to return the
39       previous disposition of sig.  To obtain the current disposition of  sig
40       without  changing  it, specify NULL for vec, and a non-null pointer for
41       ovec.
42
43       The dispositions for SIGKILL and SIGSTOP cannot be changed.
44
45       The sigvec structure has the following form:
46
47           struct sigvec {
48               void (*sv_handler)(int); /* Signal disposition */
49               int    sv_mask;          /* Signals to be blocked in handler */
50               int    sv_flags;         /* Flags */
51           };
52
53       The sv_handler field specifies the disposition of the  signal,  and  is
54       either:  the address of a signal handler function; SIG_DFL, meaning the
55       default disposition applies for the signal; or  SIG_IGN,  meaning  that
56       the signal is ignored.
57
58       If  sv_handler  specifies the address of a signal handler, then sv_mask
59       specifies a mask of signals that are to be blocked while the handler is
60       executing.  In addition, the signal for which the handler is invoked is
61       also blocked.  Attempts  to  block  SIGKILL  or  SIGSTOP  are  silently
62       ignored.
63
64       If  sv_handler  specifies  the  address  of  a signal handler, then the
65       sv_flags field specifies flags controlling what happens when  the  han‐
66       dler  is  called.  This field may contain zero or more of the following
67       flags:
68
69       SV_INTERRUPT
70              If the signal handler interrupts a blocking  system  call,  then
71              upon return from the handler the system call s not be restarted:
72              instead it fails with the error EINTR.   If  this  flag  is  not
73              specified, then system calls are restarted by default.
74
75       SV_RESETHAND
76              Reset  the disposition of the signal to the default before call‐
77              ing the signal handler.  If this flag is not specified, then the
78              handler  remains established until explicitly removed by a later
79              call to sigvec() or until the process performs an execve(2).
80
81       SV_ONSTACK
82              Handle the signal on the alternate  signal  stack  (historically
83              established  under  BSD  using the obsolete sigstack() function;
84              the POSIX replacement is sigaltstack(2)).
85
86       The sigmask() macro constructs and returns a "signal mask" for  signum.
87       For  example, we can initialize the vec.sv_mask field given to sigvec()
88       using code such as the following:
89
90           vec.sv_mask = sigmask(SIGQUIT) | sigmask(SIGABRT);
91                       /* Block SIGQUIT and SIGABRT during
92                          handler execution */
93
94       The sigblock() function adds the signals in mask to the process's  sig‐
95       nal mask (like POSIX sigprocmask(SIG_BLOCK)), and returns the process's
96       previous signal  mask.   Attempts  to  block  SIGKILL  or  SIGSTOP  are
97       silently ignored.
98
99       The  sigsetmask()  function sets the process's signal mask to the value
100       given in mask (like POSIX sigprocmask(SIG_SETMASK)),  and  returns  the
101       process's previous signal mask.
102
103       The  siggetmask()  function  returns the process's current signal mask.
104       This call is equivalent to sigblock(0).
105

RETURN VALUE

107       The sigvec() function returns 0 on success; on error, it returns -1 and
108       sets errno to indicate the error.
109
110       The  sigblock()  and  sigsetmask() functions return the previous signal
111       mask.
112
113       The sigmask() macro returns the signal mask for signum.
114

ERRORS

116       See the ERRORS under sigaction(2) and sigprocmask(2).
117

VERSIONS

119       Starting with version 2.21, the GNU C library  no  longer  exports  the
120       sigvec()  function as part of the ABI.  (To ensure backward compatibil‐
121       ity, the glibc symbol versioning scheme continues to export the  inter‐
122       face to binaries linked against older versions of the library.)
123

ATTRIBUTES

125       For   an   explanation   of   the  terms  used  in  this  section,  see
126       attributes(7).
127
128       ┌─────────────────────────────────┬───────────────┬─────────┐
129Interface                        Attribute     Value   
130       ├─────────────────────────────────┼───────────────┼─────────┤
131sigvec(), sigmask(), sigblock(), │ Thread safety │ MT-Safe │
132sigsetmask(), siggetmask()       │               │         │
133       └─────────────────────────────────┴───────────────┴─────────┘

CONFORMING TO

135       All  of these functions were in 4.3BSD, except siggetmask(), whose ori‐
136       gin is unclear.  These functions are obsolete: do not use them  in  new
137       programs.
138

NOTES

140       On  4.3BSD,  the signal() function provided reliable semantics (as when
141       calling sigvec() with vec.sv_mask equal to 0).  On System  V,  signal()
142       provides  unreliable  semantics.   POSIX.1 leaves these aspects of sig‐
143       nal() unspecified.  See signal(2) for further details.
144
145       In order to wait for a signal, BSD and System V both provided  a  func‐
146       tion  named  sigpause(3), but this function has a different argument on
147       the two systems.  See sigpause(3) for details.
148

SEE ALSO

150       kill(2), pause(2), sigaction(2), signal(2),  sigprocmask(2),  raise(3),
151       sigpause(3), sigset(3), signal(7)
152

COLOPHON

154       This  page  is  part of release 5.02 of the Linux man-pages project.  A
155       description of the project, information about reporting bugs,  and  the
156       latest     version     of     this    page,    can    be    found    at
157       https://www.kernel.org/doc/man-pages/.
158
159
160
161Linux                             2017-09-15                         SIGVEC(3)
Impressum