SIGSETMASK(2)

✨ SIGSETMASK(2) ✨

okay bestie so we're in the System Calls Manual section 2, and today's topic is sigsetmask, sigblock and sigmask β€” the little trio that messes with your current signal mask. it's giving vintage, it's giving deprecated, but we're gonna learn it anyway bc you deserve to know πŸ’…


🌸 NAME 🌸

sigsetmask, sigblock β€” manipulate current signal mask

πŸ“š LIBRARY πŸ“š

Standard C Library (libc, -lc) 🫢

✨ SYNOPSIS ✨

#include <signal.h>

int
sigsetmask(int mask);

int
sigblock(int mask);

int
sigmask(int signum);

πŸ’– DESCRIPTION πŸ’–

first things first, bestie β€” this whole interface is made obsolete by: sigprocmask(2). so like, it still works, but the cool kids have moved on. no cap.

The sigsetmask() function sets the current signal mask to the specified mask. Signals are blocked from delivery if the corresponding bit in mask is a 1. so like, bit = 1 means "not today, signal" 🚫

The sigblock() function adds the signals in the specified mask to the current signal mask, rather than overwriting it as sigsetmask() does. so sigblock() is the additive queen β€” she stacks on top of what's already there instead of bulldozing it πŸ‘‘

The macro sigmask() is provided to construct the mask for a given signum. it's literally just a lil helper that builds the mask for you so you don't have to do the bit math yourself πŸŽ€

⚠️ and here's the tea: the system quietly disallows SIGKILL or SIGSTOP to be blocked. quietly. no error, no drama, just vibes and a silent refusal πŸ’€ those two are simply not blockable, periodt.

πŸ”₯ RETURN VALUES πŸ”₯

The sigblock() and sigsetmask() functions return the previous set of masked signals. so you can save it, restore it, be a responsible main character 🫑

πŸ‘€ SEE ALSO πŸ‘€

πŸ¦‹ HISTORY πŸ¦‹

The sigsetmask() and sigblock() functions first appeared in 4.2BSD and have been deprecated. yes bestie, they're elders. iconic, but elders πŸ’œ


and that's the whole page!! this one's from the Debian crew, dated June 2, 1993 β€” so like, this manpage is older than most of the internet, and honestly? it ate. mwah πŸ’‹

πŸ“¦ where this page comes from