SIGSETOPS(3)
β¨ SIGSETOPS(3) β¨ β the signal-set girlies of libc
okay bestie, pull up a chair π«Ά this is the <signal.h> signal set operation squad, living in the Standard C library (libc, -lc). Five absolute icons: sigemptyset, sigfillset, sigaddset, sigdelset, sigismember. POSIX coded, no cap. π
πΈ SYNOPSIS πΈ
#include <signal.h>
int sigemptyset(sigset_t *set);
int sigfillset(sigset_t *set);
int sigaddset(sigset_t *set, int signum);
int sigdelset(sigset_t *set, int signum);
int sigismember(const sigset_t *set, int signum);
π Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
sigemptyset(),sigfillset(),sigaddset(),sigdelset(),sigismember():_POSIX_C_SOURCE
π¦ DESCRIPTION π¦
So these functions are literally just here to let you mess with POSIX signal sets. That's it, that's the job. β¨
sigemptyset()β initializes the signal set given bysetto empty, with all signals excluded from the set. she's giving minimalism πsigfillset()β initializessetto full, including all signals. maximalist era πsigaddset()andsigdelset()β add and delete respectively signalsignumfromset.sigismember()β tests whethersignumis a member ofset.
Now the important part, bestie, do not skip this one π¨:
Objects of typesigset_tmust be initialized by a call to eithersigemptyset()orsigfillset()before being passed to the functionssigaddset(),sigdelset(), andsigismember()or the additional glibc functions described below (sigisemptyset(),sigandset(), andsigorset()). The results are undefined if this is not done.
undefined behaviour?? not the vibe. init your sigset_t first, periodt. π
π« RETURN VALUE π«
sigemptyset(),sigfillset(),sigaddset(), andsigdelset()return0on success and-1on error.sigismember()returns1ifsignumis a member ofset,0ifsignumis not a member, and-1on error. three whole outcomes, she's versatile π
On error, these functions set errno to indicate the error. always check ya girl errno π«Ά
π₯ ERRORS π₯
EINVALβsignumis not a valid signal.
π ATTRIBUTES π
for the explanation of the terms used in this section, go see attributes(7) (iykyk). here's the tea β:
- Interface:
sigemptyset(),sigfillset(),sigaddset(),sigdelset(),sigismember(),sigisemptyset(),sigorset(),sigandset() - Attribute: Thread safety
- Value: MT-Safe
all of them! every single one! safe to hit from multiple threads, no drama. major slay π§
π VERSIONS π
π GNU
if you define the _GNU_SOURCE feature test macro, then <signal.h> exposes three other functions for manipulating signal sets. glibc said "and I took that personally" β¨
int sigisemptyset(const sigset_t *set);
int sigorset(sigset_t *dest, const sigset_t *left,
const sigset_t *right);
int sigandset(sigset_t *dest, const sigset_t *left,
const sigset_t *right);
sigisemptyset()returns1ifsetcontains no signals, and0otherwise.sigorset()places the union of the setsleftandrightindest.sigandset()places the intersection of the setsleftandrightindest.- Both functions return
0on success, and-1on failure.
these functions are nonstandard (a few other systems provide similar functions) and their use should be avoided in portable applications.
portable girls, stay away from these unless you know what you're doing π
β STANDARDS β
POSIX.1-2008.
πΈ HISTORY πΈ
POSIX.1-2001. she's been iconic since the early 2000s, we love a veteran π
π NOTES π
when creating a filled signal set, the glibc sigfillset() function does not include the two real-time signals used internally by the NPTL threading implementation. see nptl(7) for the details. so "full" is doing some light gatekeeping, ngl π
π«Ά SEE ALSO π«Ά
and that's the whole page, bestie! π this was brought to you by Linux man-pages 6.20, dated 2026-02-08. go forth and initialize your sigset_ts before you do literally anything else with them. mwah πβ¨
π¦ 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 1994, Mike Battersby <mib@deakin.edu.au>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms