All rights reserved.
%sccs.include.redist.man%
@(#)setjmp.3 6.4 (Berkeley) 05/27/90
#include <setjmp.h> sigsetjmp(sigjmp_buf env, int savemask); void siglongjmp(sigjmp_buf env, int val); setjmp(jmp_buf env); void longjmp(jmp_buf env, int val); _setjmp(jmp_buf env); void _longjmp(jmp_buf env, int val); void longjmperror();
The corresponding longjmp functions restore the environment saved by their respective versions of the setjmp function. They then return so that program execution continues as if the setjmp call had returned val , instead of 0.
Pairs of calls may be intermixed, i.e. both sigsetjmp and siglongjmp and setjmp and longjmp combinations may be used in the same program, however, individual calls may not, i.e. the env argument to sigsetjmp may not be passed to longjmp .
The longjmp routines may not be called after the routine which called the setjmp routines returns.
All accessible data have values as of the time the longjmp routine was called.
Setjmp/longjmp pairs save and restore the signal mask (see sigmask (2)), while _setjmp/_longjmp pairs save and restore only the register set and the stack.
Sigsetjmp/siglongjmp pairs save and restore the signal mask if the argument savemask is non-zero, otherwise only the register set and the stack are saved.