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, 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: _BSD_SOURCE
24

DESCRIPTION

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

RETURN VALUE

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

ERRORS

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

CONFORMING TO

116       All  of these functions were in 4.3BSD, except siggetmask(), whose ori‐
117       gin is unclear.  These functions are obsolete: do not use them  in  new
118       programs.
119

NOTES

121       On  4.3BSD,  the signal() function provided reliable semantics (as when
122       calling sigvec() with vec.sv_mask equal to 0).  On System  V,  signal()
123       provides  unreliable  semantics.   POSIX.1-2001 leaves these aspects of
124       signal() unspecified.  See signal(2) for further details.
125
126       In order to wait for a signal, BSD and System V both provided  a  func‐
127       tion  named  sigpause(3), but this function has a different argument on
128       the two systems.  See sigpause(3) for details.
129

SEE ALSO

131       kill(2), pause(2), sigaction(2), signal(2),  sigprocmask(2),  raise(3),
132       sigpause(3), sigset(3), signal(7)
133

COLOPHON

135       This  page  is  part of release 3.22 of the Linux man-pages project.  A
136       description of the project, and information about reporting  bugs,  can
137       be found at http://www.kernel.org/doc/man-pages/.
138
139
140
141Linux                             2007-07-26                         SIGVEC(3)
Impressum