sigvec(3)
β¨ sigvec(3) β the BSD signal API, aka the vintage collection π
okay bestie settle in, because we're about to talk about a section 3 library page and it's giving "grandma's attic but make it signals" π
πΈ NAME πΈ
sigvec, sigblock, sigsetmask, siggetmask, sigmask β the BSD signal API. yes, all of them. one big friend group. π
π LIBRARY π
Standard C library (libc, -lc). the classic. the default. the one that's just there. π
π¦ SYNOPSIS π¦
#include <signal.h>
[[deprecated]] int sigvec(int sig, const struct sigvec *vec,
struct sigvec *ovec);
[[deprecated]] int sigmask(int signum);
[[deprecated]] int sigblock(int mask);
[[deprecated]] int sigsetmask(int mask);
[[deprecated]] int siggetmask(void);
π Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
All functions shown above:
- Since glibc 2.19:
_DEFAULT_SOURCE
- glibc 2.19 and earlier:
_BSD_SOURCE
see that [[deprecated]]? yeah. the compiler is side-eyeing you. it's not a vibe check you pass, it's a vibe check you fail π
π DESCRIPTION π
So glibc keeps these functions around as a compatibility interface for programs that use the historical BSD signal API. That's the key thing: this API is obsolete, and new applications should be using the POSIX signal API instead β sigaction(2), sigprocmask(2), etc. respectfully, move on bestie. π«Ά
sigvec() β the main character β¨
sigvec() sets and/or gets the disposition of the signal sig (like the POSIX sigaction(2) does).
- If
vecis notNULL, it points to asigvecstructure that defines the new disposition forsig. - If
ovecis notNULL, it points to asigvecstructure that is used to return the previous disposition ofsig.
Want to just peek at the current disposition of sig without touching anything? Specify NULL for vec, and a non-null pointer for ovec. no notes, just looking. π
The dispositions for SIGKILL and SIGSTOP cannot be changed. nope. not happening. not today. not ever. those two are locked in and the key got thrown in the ocean π
The sigvec structure has the following form:
struct sigvec {
void (*sv_handler)(int); /* Signal disposition */
int sv_mask; /* Signals to be blocked in handler */
int sv_flags; /* Flags */
};
the fields, one by one π
sv_handlerβ specifies the disposition of the signal, and is either: the address of a signal handler function;SIG_DFL, meaning the default disposition applies for the signal; orSIG_IGN, meaning that the signal is ignored.sv_maskβ ifsv_handlerspecifies the address of a signal handler, thensv_maskspecifies a mask of signals that are to be blocked while the handler is executing. In addition, the signal for which the handler is invoked is also blocked. Attempts to blockSIGKILLorSIGSTOPare silently ignored. (see? told you. unbothered. unbothered. totally unbothered π )sv_flagsβ ifsv_handlerspecifies the address of a signal handler, thensv_flagsspecifies flags controlling what happens when the handler is called. This field may contain zero or more of the following flags:
SV_INTERRUPT π
If the signal handler interrupts a blocking system call, then upon return from the handler the system call is not restarted: instead it fails with the error EINTR. If this flag is not specified, then system calls are restarted by default.
SV_RESETHAND πΈ
Reset the disposition of the signal to the default before calling the signal handler. If this flag is not specified, then the handler remains established until explicitly removed by a later call to sigvec() or until the process performs an execve(2).
SV_ONSTACK π¦
Handle the signal on the alternate signal stack (historically established under BSD using the obsolete sigstack() function; the POSIX replacement is sigaltstack(2)).
sigmask() β¨
The sigmask() macro constructs and returns a "signal mask" for signum. For example, we can initialize the vec.sv_mask field given to sigvec() using code such as the following:
vec.sv_mask = sigmask(SIGQUIT) | sigmask(SIGABRT);
/* Block SIGQUIT and SIGABRT during
handler execution */
look at that bitwise OR. that's literally her. the way she composes a mask ππ₯
sigblock() π
The sigblock() function adds the signals in mask to the process's signal mask (like POSIX sigprocmask(SIG_BLOCK)), and returns the process's previous signal mask. Attempts to block SIGKILL or SIGSTOP are silently ignored. (again. iconic behaviour honestly.)
sigsetmask() π
The sigsetmask() function sets the process's signal mask to the value given in mask (like POSIX sigprocmask(SIG_SETMASK)), and returns the process's previous signal mask.
siggetmask() π
The siggetmask() function returns the process's current signal mask. This call is equivalent to sigblock(0).
β RETURN VALUE β
sigvec()returns0on success; on error, it returns-1and setserrnoto indicate the error. classic. very demure. very mindful.sigblock()andsigsetmask()return the previous signal mask.sigmask()returns the signal mask forsignum.
π ERRORS π
See the ERRORS under sigaction(2) and sigprocmask(2). we're outsourcing. delegation is self-care fr fr.
π ATTRIBUTES π
For an explanation of the terms used in this section, see attributes(7).
sigvec(),sigmask(),sigblock(),sigsetmask(),siggetmask()β Thread safety β MT-Safe π
π STANDARDS π
None. not a single one. she's unstandardised. she's free. she answers to no committee π
π HISTORY π
sigvec(),sigblock(),sigmask(),sigsetmask()β 4.3BSD.siggetmask()β Unclear origin. mystery girl. we don't know where she came from and honestly? we respect it πsigvec()β Removed in glibc 2.21. gone. departed. no forwarding address. (the others still linger though, bestie)
π§ NOTES π§
On 4.3BSD, the signal() function provided reliable semantics (as when calling sigvec() with vec.sv_mask equal to 0). On System V, signal() provides unreliable semantics. POSIX.1 leaves these aspects of signal() unspecified. See signal(2) for further details.
In order to wait for a signal, BSD and System V both provided a function named sigpause(3), but this function has a different argument on the two systems. See sigpause(3) for details.
same name, different argument, two systems β it's giving messy family drama and we're NOT getting involved πΏ
π₯ SEE ALSO π₯
kill(2), pause(2), sigaction(2), signal(2), sigprocmask(2), raise(3), sigpause(3), sigset(3), signal(7)
and that's the whole page bestie, no cap π
β¨ this little gem is straight outta Linux man-pages 6.20, dated 2026-02-08. go forth and use sigaction(2) instead, ok? love u byeee π«Άππ
π¦ where this page comes from
- arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages 6.20
- π the page's license: Linux-man-pages-copyleft
- Copyright 2005, Michael Kerrisk <mtk.manpages@gmail.com>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms