sigsetjmp(3C) sigsetjmp(3C)
NAME
sigsetjmp, siglongjmp - non-local goto
SYNOPSIS
#include <setjmp.h>
int sigsetjmp (env, savemask)
sigjmpbuf env;
int savemask;
void siglongjmp (env, val)
sigjmpbuf env;
int val;
DESCRIPTION
These POSIX functions are useful for dealing with errors and
interrupts encountered in a low-level subroutine of a pro-
gram.
sigsetjmp saves the calling process's registers and stack
environment in env (whose type, sigjmpbuf, is defined in
the <setjmp.h> header file) for later use by siglongjmp. If
the value of the savemask argument is not zero, then sig-
setjmp shall also save the process's current signal mask as
part of the calling environment. sigsetjmp then returns the
value 0.
siglongjmp restores the environment saved by the last call
of sigsetjmp with the corresponding env argument. If the
env argument was initialized by a call to sigsetjmp with a
non-zero savemask argument, then siglongjmp will also
restore the process's saved signal mask. After siglongjmp
is completed, program execution continues as if the
corresponding call of sigsetjmp (the caller of which must
not itself have returned in the interim) had just returned
the value val. All accessible data had values as of the
time siglongjmp was called.
siglongjmp cannot cause sigsetjmp to return the value 0. If
siglongjmp is invoked with a second argument of 0, sigsetjmp
will return 1.
SEE ALSO
setjmp(3C), sigaction(2), sigaltstack(2), signal(2), sig-
stack(2), sigvec(2).
WARNING
If siglongjmp is called even though env was never primed by
a call to sigsetjmp, or when the last such call was in a
function which has since returned, absolute chaos is
guaranteed.
Page 1 CX/UX Programmer's Reference Manual
sigsetjmp(3C) sigsetjmp(3C)
sigsetjmp does not save the current notion of whether the
process is executing on the signal stack. The result is
that a siglongjmp to some place on the signal stack leaves
the signal stack state incorrect.
Page 2 CX/UX Programmer's Reference Manual