1SIGVEC(3) Linux Programmer's Manual SIGVEC(3)
2
3
4
6 sigvec, sigblock, sigsetmask, siggetmask, sigmask - BSD signal API
7
9 #define _BSD_SOURCE
10 #include <signal.h>
11
12 int sigvec(int sig, struct sigvec *vec, struct sigvec *ovec);
13
14 int sigmask(int signum);
15
16 int sigblock(int mask);
17
18 int sigsetmask(int mask);
19
20 int siggetmask(void);
21
23 These functions are provided in glibc as a compatibility interface for
24 programs that make use of the historical BSD signal API. This API is
25 obsolete: new applications should use the POSIX signal API (sigac‐
26 tion(2), sigprocmask(2), etc.)
27
28 The sigvec() function sets and/or gets the disposition of the signal
29 sig (like the POSIX sigaction(2)). If vec is not NULL, it points to a
30 sigvec structure that defines the new disposition for sig. If ovec is
31 not NULL, it points to a sigvec structure that is used to return the
32 previous disposition of sig. To obtain the current disposition of sig
33 without changing it, specify NULL for vec, and a non-NULL pointer for
34 ovec.
35
36 The dispositions for SIGKILL and SIGSTOP cannot be changed.
37
38 The sigvec structure has the following form:
39
40 struct sigvec {
41 void (*sv_handler)(); /* Signal disposition */
42 int sv_mask; /* Signals to be blocked in handler */
43 int sv_flags; /* Flags */
44 };
45
46 The sv_handler field specifies the disposition of the signal, and is
47 either: the address of a signal handler function; or SIG_DFL meaning
48 the default disposition applies for the signal; or SIG_IGN meaning that
49 the signal is ignored.
50
51 If sv_handler specifies the address of a signal handler, then sv_mask
52 specifies a mask of signals that are to be blocked while the handler is
53 executing. In addition, the signal for which the handler is invoked is
54 also blocked by default. Attempts to block SIGKILL or SIGSTOP are
55 silently ignored.
56
57 If sv_handler specifies the address of a signal handler, then the
58 sv_flags field specifies flags controlling what happens when the han‐
59 dler is called. This field may contain zero or more of the following
60 flags:
61
62 SV_INTERRUPT
63 If the signal handler interrupts a blocking system call, then
64 upon return from the handler the system call will not be
65 restarted: instead it will fail with the error EINTR. If this
66 flag is not specified, then system calls are restarted by
67 default.
68
69 SV_RESETHAND
70 Reset the disposition of the signal to the default before call‐
71 ing the signal handler. If this flag is not specified, then the
72 handler remains established until explicitly removed by a later
73 call to sigvec() or until the process performs an execve(2).
74
75 SV_ONSTACK
76 Handle the signal on the alternate signal stack (historically
77 established under BSD using the obsolete sigstack() function;
78 the POSIX replacement is sigaltstack()).
79
80 The sigmask() function constructs and returns a "signal mask" for
81 signum. For example, we can initialise the vec.sv_mask field given to
82 sigvec() using code such as the following:
83
84 vec.sv_mask = sigmask(SIGQUIT) | sigpause (SIGABRT);
85 /* Block SIGQUIT and SIGABRT during
86 handler execution */
87
88 The sigblock() function adds the signals in mask to the process's sig‐
89 nal mask (like POSIX sigprocmask(SIG_BLOCK)), and returns the process's
90 previous signal mask. Attempts to block SIGKILL or SIGSTOP are
91 silently ignored.
92
93 The sigsetmask() function sets the process's signal mask to the value
94 given in mask (like POSIX sigprocmask(SIG_SETMASK)), and returns the
95 process's previous signal mask.
96
97 The siggetmask() function returns the process's current signal mask.
98 This call is equivalent to sigblock(0).
99
101 The sigvec() function returns 0 on success; on error, it returns -1 and
102 sets errno to indicate the error.
103
104 The sigblock() and sigsetmask() functions return the previous signal
105 mask.
106
107 The sigmask() function returns the signal mask for signum.
108
110 See the ERRORS under sigaction(2) and sigprocmask(2).
111
113 On 4.3BSD, the signal() function provided reliable semantics (as when
114 calling sigvec() with vec.sv_mask equal to 0). On System V, signal()
115 provides unreliable semantics. POSIX.1-2001 leaves these aspects of
116 signal() unspecified. See signal(2) for further details.
117
118 In order to wait for a signal, BSD and System V both provided a func‐
119 tion named sigpause(), but this function has a different argument on
120 the two systems. See sigpause(3) for details.
121
123 All of these functions were in 4.3BSD, except siggetmask(), whose ori‐
124 gin is unclear. These functions are obsolete: do not use them in new
125 programs.
126
128 kill(2), pause(2), sigaction(2), signal(2), sigprocmask(2), raise(3),
129 sigpause(3), sigset(3), feature_test_macros(7), signal(7)
130
131
132
133Linux 2.6.14 2005-12-01 SIGVEC(3)