NAME
sigsetjmp — set
jump point for a non-local goto
SYNOPSIS
int sigsetjmp(sigjmp_buf env, int savemask);
DESCRIPTION
The sigsetjmp () function shall be
equivalent to the setjmp(3) function, except as
follows:
- References to setjmp(3) are equivalent to
sigsetjmp(). - References to longjmp(3) are equivalent to siglongjmp(3).
- If the value of the savemask argument is not 0,
sigsetjmp() shall also save the current signal mask of the calling thread as part of the calling environment.
RETURN VALUE
If the return is from a successful direct invocation,
sigsetjmp () shall return 0. If the return is from a
call to siglongjmp(3), sigsetjmp
() shall return a non-zero value.
ERRORS
No errors are defined.
EXAMPLES
None.
APPLICATION USAGE
The distinction between setjmp(3) /
longjmp(3) and sigsetjmp ()/
siglongjmp(3) is only significant for programs which use
sigaction(3), sigprocmask(3), or
sigsuspend(3).
Note that since this function is defined in terms of setjmp(3), if savemask is zero, it is unspecified whether the signal mask is saved.
RATIONALE
The ISO C standard specifies various restrictions on the usage of
the setjmp(3) macro in order to permit implementors to
recognize the name in the compiler and not implement an actual function.
These same restrictions apply to the sigsetjmp ()
macro.
There are processors that cannot easily support these calls, but this was not considered a sufficient reason to exclude them.
4.2 BSD, 4.3 BSD, and XSI-conformant systems provide functions
named _setjmp(3) and _longjmp(3) that,
together with setjmp(3) and longjmp(3),
provide the same functionality as sigsetjmp () and
siglongjmp(3). On those systems,
setjmp(3) and longjmp(3) save and
restore signal masks, while _setjmp(3) and
_longjmp(3) do not. On System V Release 3 and in
corresponding issues of the SVID, setjmp(3) and
longjmp(3) are explicitly defined not to save and restore
signal masks. In order to permit existing practice in both cases, the
relation of setjmp(3) and longjmp(3) to
signal masks is not specified, and a new set of functions is defined
instead.
The longjmp(3) and
siglongjmp(3) functions operate as in the previous issue
provided the matching setjmp(3) or
sigsetjmp () has been performed in the same thread.
Non-local jumps into contexts saved by other threads would be at best a
questionable practice and were not considered worthy of standardization.
FUTURE DIRECTIONS
None.
SEE ALSO
pthread_sigmask(3) , siglongjmp(3) , signal(3) , sigsuspend(3)
XBD <setjmp.h>
CHANGE HISTORY
First released in Issue 3. Included for alignment with the POSIX.1-1988 standard.
Issue 5
The DESCRIPTION is updated for alignment with the POSIX Threads Extension.
Issue 6
The DESCRIPTION is reworded in terms of setjmp(3).
The SYNOPSIS is marked CX since the presence of this function in the <setjmp.h> header is an extension over the ISO C standard.