See section 10.15 in “Advanced Programming in the UNIX® Environment”:
the setjmp and longjmp functions, which can be used for nonlocal
branching. The longjmp function is often called from a signal handler
to return to the main loop of a program, instead of returning from the
handler. We saw this in Figures 10.8 and 10.11.
There is a problem in calling longjmp, however. When a signal is
caught, the signal-catching function is entered with the current
signal automatically being added to the signal mask of the process.
This prevents subsequent occurrences of that signal from interrupting
the signal handler. If we longjmp out of the signal handler, what
happens to the signal mask for the process?
Under FreeBSD 5.2.1 and Mac OS X 10.3, setjmp and longjmp save and restore the signal mask. Linux 2.4.22 and Solaris 9, however, do not
do this. FreeBSD and Mac OS X provide the functions _setjmp and
_longjmp, which do not save and restore the signal mask.
To allow either form of behavior, POSIX.1 does not specify the effect
of setjmp and longjmp on signal masks. Instead, two new functions,
sigsetjmp and siglongjmp, are defined by POSIX.1. These two functions
should always be used when branching from a signal handler.
...
The only difference between these functions and the setjmp and longjmp
functions is that sigsetjmp has an additional argument. If savemask is
nonzero, then sigsetjmp also saves the current signal mask of the
process in env. When siglongjmp is called, if the env argument was
saved by a call to sigsetjmp with a nonzero savemask, then siglongjmp
restores the saved signal mask.