sigsuspend(2)

โœจ sigsuspend โ€” bestie, let's wait for a signal โœจ

okay so this is from the System Calls Manual section 2, and it's literally the page for sigsuspend, plus its sibling rt_sigsuspend. grab a snack, we're doing signal masks ๐Ÿ’…


๐ŸŒธ NAME ๐ŸŒธ

sigsuspend, rt_sigsuspend โ€” wait for a signal

๐Ÿ“š LIBRARY ๐Ÿ“š

Standard C library (libc, -lc)

๐Ÿฆ‹ SYNOPSIS ๐Ÿฆ‹

#include <signal.h>

int sigsuspend(const sigset_t *mask);

Feature Test Macro Requirements for glibc (see feature_test_macros(7)):

sigsuspend(): : _POSIX_C_SOURCE

๐Ÿ’– DESCRIPTION ๐Ÿ’–

so here's the vibe: sigsuspend() temporarily swaps out the signal mask of the calling thread for the one you hand it in mask, and then it just... suspends the thread. parks it. puts it in its soft girl era. ๐Ÿซถ it stays like that until a signal shows up whose action is either to invoke a signal handler or to terminate a process. like, it will not move until something actually happens.

If the signal terminates the process, then sigsuspend() does not return. yeah. it's gone, bestie, it's not coming back. ๐Ÿ’€

If the signal is caught, though, then sigsuspend() returns after the signal handler returns, and the signal mask gets restored to the state it was in before the call to sigsuspend(). so it's a cute little temporary swap โ€” the mask goes back exactly how it was found. โœจ

๐Ÿšจ important: it is not possible to block SIGKILL or SIGSTOP. specifying these signals in mask has no effect on the thread's signal mask. like, those two simply do not take requests. periodt.

๐Ÿ’… RETURN VALUE ๐Ÿ’…

sigsuspend() always returns -1, with errno set to indicate the error (normally, EINTR). always. it's iconic like that.

๐Ÿ˜ญ ERRORS ๐Ÿ˜ญ

  • EFAULT โ€” mask points to memory which is not a valid part of the process address space.
  • EINTR โ€” The call was interrupted by a signal; see signal(7).

๐Ÿ‘‘ STANDARDS ๐Ÿ‘‘

POSIX.1-2024.

๐ŸŒˆ HISTORY ๐ŸŒˆ

POSIX.1-2001.

๐Ÿงš C library/kernel differences ๐Ÿงš

so the original Linux system call was named sigsuspend(). iconic, love her. but then real-time signals got added in Linux 2.2, and the fixed-size, 32-bit sigset_t type that this system call supported was no longer fit for purpose. not her fault, it was just a growth era. ๐ŸŒฑ

so consequently, a new system call โ€” rt_sigsuspend() โ€” was added to support an enlarged sigset_t type. and the new system call takes a second argument, size_t sigsetsize, which specifies the size in bytes of the signal set in mask. this argument is currently required to have the value sizeof(sigset_t) (or the error EINVAL results โ€” so, don't freestyle it, bestie ๐Ÿ™ˆ).

and the glibc sigsuspend() wrapper function hides all these details from us, transparently calling rt_sigsuspend() when the kernel provides it. she handles it. you don't have to think about it. ๐Ÿซถ

๐ŸŽ€ NOTES ๐ŸŽ€

Normally, sigsuspend() is used in conjunction with sigprocmask(2) in order to prevent delivery of a signal during the execution of a critical code section. the caller first blocks the signals with sigprocmask(2). then, when the critical code has completed, the caller waits for the signals by calling sigsuspend() with the signal mask that was returned by sigprocmask(2) (in the oldset argument). it's giving protective, then release. ๐Ÿ’…

See sigsetops(3) for details on manipulating signal sets.

๐Ÿ”ฅ SEE ALSO ๐Ÿ”ฅ

kill(2), pause(2), sigaction(2), signal(2), sigprocmask(2), sigwaitinfo(2), sigsetops(3), sigwait(3), signal(7)


okay that's the whole page, we ate and left no crumbs โญ this was pulled straight from the Linux man-pages collection, version 6.20, dated 2026-02-08, and it covers sigsuspend(2) exactly as the kernel and glibc know her. bye bestie, go catch your signals ๐Ÿ’–๐ŸŒธ

๐Ÿ“ฆ 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