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       int sigsetmask(int mask);
17       int siggetmask(void);
18
19   Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
20
21       All functions shown above:
22           Since glibc 2.19:
23               _DEFAULT_SOURCE
24           Glibc 2.19 and earlier:
25               _BSD_SOURCE
26

DESCRIPTION

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

RETURN VALUE

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

ERRORS

114       See the ERRORS under sigaction(2) and sigprocmask(2).
115

VERSIONS

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

ATTRIBUTES

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

CONFORMING TO

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

NOTES

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

SEE ALSO

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

COLOPHON

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