setjmp(3)setjmp(3)Name
setjmp, longjmp - nonlocal goto
Syntax
#include <setjmp.h>
setjmp(env)
jmp_buf env;
longjmp(env, val)
jmp_buf env;
_setjmp(env)
jmp_buf env;
_longjmp(env, val)
jmp_buf env;
Description
These routines are useful for dealing with errors and interrupts
encountered in a low-level subroutine of a program.
The subroutine saves its stack environment in env for later use by It
returns value 0.
The subroutine restores the environment saved by the last call of It
then returns in such a way that execution continues as if the call of
had just returned the value val to the function that invoked which must
not itself have returned in the interim. However, cannot cause to
return the value 0. If is invoked with a val of 0, will return 1. All
accessible data have values as of the time was called.
The and subroutines save and restore the signal mask sigsetmask(2),
while and manipulate only the C stack and registers.
Restrictions
The subroutine does not save current notion of whether the process is
executing on the signal stack. The result is that a longjmp to some
place on the signal stack leaves the signal stack state incorrect.
See Alsosigstack(2), sigvec(2), signal(3)
VAX setjmp(3)