SIGPAUSE(2)
π SIGPAUSE(2) π
okay bestie, gather round, we're doing a system calls manual moment. this is the System Calls Manual page for SIGPAUSE and friends, and honestly? it's giving β¨legacyβ¨. buckle up. π
πΈ NAME πΈ
<pink>sighold</pink>, <pink>sigignore</pink>, <pink>sigpause</pink>, <pink>sigrelse</pink>, <pink>sigset</pink> β the whole legacy interface for signal management, no cap. it's the old-school squad π«Ά
π LIBRARY π
Standard C Library (libc, -lc). your fave, your ride-or-die, <cyan>libc</cyan> π
β¨ SYNOPSIS β¨
#include <signal.h>
int
sighold(int sig);
int
sigignore(int sig);
int
xsi_sigpause(int sigmask);
int
sigrelse(int sig);
void (*)(int)
sigset(int, void (*disp)(int));
int
sigpause(int sigmask);
like, look at that. <purple>six functions</purple> in one header file, all just vibing in signal.h`. iykyk π¦
π§ DESCRIPTION π§
okay so first things first, and this is the tea: this whole interface is made obsolete by sigsuspend(2) and sigaction(2). so like, it still works, but it's the grandma of signal APIs. respect her, but maybe don't build your whole app on her. π
sigset() β the main character π
<hotpink>sigset()</hotpink> modifies signal dispositions. here's the deets:
- the
sigargument says which signal we're talking about, and it can be<green>any signal exceptSIGKILLandSIGSTOP</green>. those two are literally not negotiable, sorry bestie. - the
dispargument says what the signal's disposition should be β and it can beSIG_DFL,SIG_IGN, or the address of a signal handler. pick your fighter π
now the little special-case lore, because this is where it gets juicy:
- if
sigset()is used anddispis the address of a signal handler, the system addssigto the signal mask of the calling process before executing the signal handler. then, when the signal handler returns, the system restores the signal mask of the calling process to whatever it was prior to the delivery of the signal.<lavender>automatic cleanup, we love to see it</lavender>β¨ - if
sigset()is used anddispis equal toSIG_HOLD, thensiggets added to the signal mask of the calling process andsig's disposition stays exactly the same.<mint>unchanged. untouched. unbothered.</mint>π§ - if
sigset()is used anddispis not equal toSIG_HOLD, thensigis removed from the signal mask of the calling process. bye boo π
the rest of the squad π
sighold()β addssigto the signal mask of the calling process. that's it, that's the function. short queen πsigrelse()β removessigfrom the signal mask of the calling process. the opposite of the above, we stan a balanced pair π«Άsigignore()β sets the disposition ofsigtoSIG_IGN.<yellow>ignoring your problems, but make it a syscall</yellow>πxsi_sigpause()β removessigfrom the signal mask of the calling process and suspends the calling process until a signal is received. then, before returning, it restores the signal mask of the process to its original state.<cyan>nap time, but with rules</cyan>π΄
sigpause() β the historic one ποΈ
sigpause()assignssigmaskto the set of masked signals and then just⦠waits for a signal to arrive. on return, the set of masked signals is restored.- the
sigmaskargument is usually0, which indicates that no signals are to be blocked.<purple>zero. nada. nothing blocked.</purple>β
π«Ά RETURN VALUES π«Ά
okay so this part matters, don't skip it:
sigpause()andxsi_sigpause()always terminate by being interrupted, returning-1witherrnoset toEINTR. always.<red>they literally cannot succeed normally, that's the whole bit</red>πsigset(), on successful completion, returnsSIG_HOLDif the signal had been blocked, and the signal's previous disposition if it had not been blocked. otherwise,SIG_ERRis returned anderrnois set to indicate the error.- for all the other functions, successful completion returns
0. otherwise,-1is returned anderrnois set to indicate the error:
and here are the errors, in their own little numbered-ish bullet list because the manpage uses error codes:
[EINVAL]β thesigargument is not a valid signal number.<peach>not a real signal, bestie</peach>π«[EINVAL]β for thesigset()andsigignore()functions, an attempt was made to catch or ignoreSIGKILLorSIGSTOP. you cannot catch or ignore these two. do not try. it will not work. π
π₯ SEE ALSO π₯
go read these next, they're the glow-ups:
π STANDARDS π
the lore drop π:
sigpause()is implemented for compatibility with historic<blue>4.3BSD</blue>applications.- there was an incompatible interface by the same name, which used a single signal number rather than a mask, present in
<purple>AT&T System V UNIX</purple>, and it got copied from there into the X/Open System Interfaces (XSI) option ofIEEE Std 1003.1-2001(βPOSIX.1β). <hotpink>FreeBSD</hotpink>implements it under the namexsi_sigpause(). iconic name change honestly πsighold(),sigignore(),sigrelse()andsigset()are implemented for compatibility with System V and XSI interfaces. old friends, still hanging around π«Ά
π°οΈ HISTORY π°οΈ
sigpause()appeared in<mint>4.2BSD</mint>and has been deprecated. sad but true π- all the other functions appeared in
<cyan>FreeBSD 8.1</cyan>and were deprecated before being implemented. not them being cancelled before their debut π like, imagine getting deprecated before you even drop.
and that's the whole page bestie, you're officially fluent in legacy signal management ππ
this page came from the Debian crew, dated June 2, 1993 β yeah, 1993, it's vintage, it's archival, it's older than most of us, and it's still out here explaining itself. mwah. π πβ¨π¦
π¦ where this page comes from
- debian bookworm: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- debian trixie: freebsd-manpages 12.2-2 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu jammy: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu noble: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu questing: freebsd-manpages 12.2-2
- ubuntu resolute: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu stonking: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- Copyright (c) 1983, 1991, 1993 The Regents of the University of California. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms