LONGJMP
NAME
longjmp, siglongjmp - non-local jump to a saved stack context
SYNOPSIS
#include <setjmp.h>
I void longjmp(jmp_buf env , int val );
I void siglongjmp(sigjmp_buf env , int val );
DESCRIPTION
R longjmp ()
and
setjmp(3)
are useful for dealing with errors
and interrupts encountered in a low-level subroutine of a program.
R longjmp ()
restores the environment saved by the last call of
setjmp(3)
with the corresponding
env argument.
After
R longjmp ()
is completed, program execution continues as if the
corresponding call of
setjmp(3)
had just returned the value
val.
R longjmp ()
cannot cause 0 to be returned.
If
R longjmp ()
is invoked with a second argument of 0, 1 will be returned instead.
R siglongjmp ()
is similar to
R longjmp ()
except for the type of
its
env argument.
If the
sigsetjmp(3)
call that set this
env used a non-zero
savesigs flag,
R siglongjmp ()
also
restores the set of blocked signals.
RETURN VALUE
These functions never return.
CONFORMING TO
C89, C99, and POSIX.1-2001 specify
R longjmp ().
POSIX.1-2001 specifies
R siglongjmp ().
NOTES
POSIX does not specify whether
R longjmp ()
will restore the signal
context.
If you want to save and restore signal masks, use
R siglongjmp ().
R longjmp ()
and
R siglongjmp ()
make programs hard to
understand and maintain.
If possible an alternative should be used.
SEE ALSO