SIGSETJMP(3P) SIGSETJMP(3P)
NAME
sigsetjmp, siglongjmp - non-local jumps
SYNOPSIS
#include <setjmp.h>
int sigsetjmp(env, savemask)
sigjmpbuf env;
int savemask;
void siglongjmp(env, val)
sigjmpbuf env;
int val;
DESCRIPTION
These functions are useful for dealing with errors and
interrupts encountered in a low-level subroutine of a
program.
sigsetjmp saves its stack environment in env for later use
by siglongjmp . If the value of savemask is not zero,
sigsetjmp also saves the process's current signal mask as
part of the calling environment. The environment type
sigjmpbuf is defined in the <setjmp.h> header file.
siglongjmp restores the environment saved by the last call
of sigsetjmp with the corresponding env argument. If env
was initialized by a call to sigsetjmp with a non-zero value
for savemask, siglongjmp also restores the saved signal
mask.
RETURN VALUE
When sigsetjmp has been invoked by the calling process, zero
is returned.
After siglongjmp is completed, program execution continues
as if the corresponding call of sigsetjmp (which must not
itself have returned in the interim) had just returned the
value val . siglongjmp cannot cause sigsetjmp to return the
value zero. If val is zero, sigsetjmp returns 1. All
Page 1 May 1989
SIGSETJMP(3P) SIGSETJMP(3P)
accessible data have values as of the time siglongjmp was
called.
WARNING
siglongjmp fails if env was never initialized by a call to
sigsetjmp or when the last such call is in a function which
has since returned.
SEE ALSO
sigaction(3P), sigprocmask(3P), sigsuspend(3P).
Page 2 May 1989