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 by set to empty, with all signals excluded from the set. she's giving minimalism πŸ’–
  • sigfillset() β€” initializes set to full, including all signals. maximalist era πŸ‘‘
  • sigaddset() and sigdelset() β€” add and delete respectively signal signum from set.
  • sigismember() β€” tests whether signum is a member of set.

Now the important part, bestie, do not skip this one 🚨:

Objects of type sigset_t must be initialized by a call to either sigemptyset() or sigfillset() before being passed to the functions sigaddset(), sigdelset(), and sigismember() or the additional glibc functions described below (sigisemptyset(), sigandset(), and sigorset()). 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(), and sigdelset() return 0 on success and -1 on error.
  • sigismember() returns 1 if signum is a member of set, 0 if signum is not a member, and -1 on error. three whole outcomes, she's versatile πŸ’…

On error, these functions set errno to indicate the error. always check ya girl errno 🫢


πŸ”₯ ERRORS πŸ”₯

  • EINVAL β€” signum is 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() returns 1 if set contains no signals, and 0 otherwise.
  • sigorset() places the union of the sets left and right in dest.
  • sigandset() places the intersection of the sets left and right in dest.
  • Both functions return 0 on success, and -1 on 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
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms