sigpending(2)

โœจ sigpending โ€” examine pending signals โœจ

okay bestie, welcome to the sigpending(2) page, part of the System Calls Manual ๐Ÿ’– This is the one where you get to peek at which signals are like... waiting in the queue for your thread. Very main character of them, honestly.


๐ŸŽ€ LIBRARY

Standard C library (libc, -lc) โ€” yeah she's a libc girlie ๐Ÿซถ


๐Ÿฆ‹ SYNOPSIS

#include <signal.h>

int sigpending(sigset_t *set);

๐ŸŒธ Feature Test Macro Requirements for glibc (see feature_test_macros(7))

  • sigpending() โ€” you need _POSIX_C_SOURCE defined. that's it, that's the requirement, periodt โœจ

๐Ÿ’… DESCRIPTION

So like, sigpending() hands you back the set of signals that are pending for delivery to the calling thread. what does pending mean, bestie? it means they got raised while they were blocked. they're just sitting there, vibing, waiting their turn ๐Ÿ˜ญ

The mask of pending signals gets returned in set. slay.


โญ RETURN VALUE

  • sigpending() returns 0 on success โ€” we LOVE a zero ๐Ÿฅฐ
  • On failure it returns -1, and errno gets set to tell you what went wrong.

๐Ÿ’€ ERRORS

  • EFAULT โ€” set points to memory that is not a valid part of the process address space. nope, not a real place, we can't go there ๐Ÿ™ˆ

๐Ÿ‘‘ STANDARDS

POSIX.1-2024. iconic behavior, no notes.


๐ŸŒˆ HISTORY

POSIX.1-2001. she's been around a while, lowkey a legend ๐Ÿ’œ

๐Ÿงš C library/kernel differences

okay so here's the tea โ˜• The original Linux system call was named sigpending(). But then real-time signals showed up in Linux 2.2, and that fixed-size, 32-bit sigset_t argument the old syscall supported was no longer fit for purpose. it's giving "the old fit doesn't fit anymore" ๐Ÿ˜ญ

So consequently, a new system call โ€” rt_sigpending() โ€” was added to support an enlarged sigset_t type. The new syscall takes a second argument, size_t sigsetsize, which specifies the size in bytes of the signal set in set.

And the glibc sigpending() wrapper function hides all of these details from us, transparently calling rt_sigpending() when the kernel provides it. so you just call the cute little function and glibc does the backstage work. king behavior fr fr ๐Ÿ‘‘


๐Ÿ“ NOTES

  • Peep sigsetops(3) for the details on manipulating signal sets. that's where the real set-manipulation lore lives.
  • If a signal is both blocked and has a disposition of "ignored", it is not added to the mask of pending signals when it's generated. blocked + ignored = not invited to the pending party ๐Ÿ’…
  • The set of signals that is pending for a thread is the union of the set of signals pending for that thread and the set of signals pending for the process as a whole. see signal(7) for the full picture.
  • A child created via fork(2) initially has an empty pending signal set. fresh start, clean slate, new era โœจ
  • The pending signal set is preserved across execve(2). she survives the exec, resilient queen.

๐Ÿ™ˆ BUGS

Up to and including glibc 2.2.1, there is a bug in the wrapper function for sigpending() which means that information about pending real-time signals is not correctly returned. so like, if you're on something ancient, the real-time pending info is just... wrong. not us fixing it, just telling you ๐Ÿ’€


๐Ÿ’œ SEE ALSO

kill(2), sigaction(2), signal(2), sigprocmask(2), sigsuspend(2), sigsetops(3), signal(7)


okay that's the whole page bestie, you're officially caught up ๐Ÿซถ this was Linux man-pages 6.20, dated 2026-02-08, and yes she ate, no crumbs left. go check your pending signals, 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