1 .TH SETJMP 3 "June 22, 2006"
4 setjmp, longjmp, _setjmp, _longjmp, sigsetjmp, siglongjmp \- save and restore execution contexts
10 int setjmp(jmp_buf env);
11 void longjmp(jmp_buf env, int val);
13 int _setjmp(jmp_buf env);
14 void _longjmp(jmp_buf env, int val);
17 int sigsetjmp(sigjmp_buf env, int savemask);
18 void siglongjmp(sigjmp_buf env, int val);
20 These calls provide a way for a process to save an execution context into a
21 buffer, and later resume execution from that context, effectively performing
24 family of functions store the context into the \fIenv\fP data structure,
25 and return the value 0. The
27 family of functions jump to the context saved in the given \fIenv\fP data
28 structure, causing the process to continue as if it returned from the
31 call again, but this time with the non-zero return value in \fIval\fP.
33 The difference between the three pairs of setjmp/longjmp functions lies in the
34 behaviour with respect to saving/restoring the process signal mask. POSIX does
35 not require the process signal mask to be saved and restored during
39 \. However, the current implementation does this in order to agree with OSF/1
40 and other BSD derived systems.
46 , traditional in BSD systems, may be used when the signal mask is not to be
53 functions allow the programmer to specify explicitly whether the signal mask
54 is to be saved/restored, by means of the \fIsavemask\fP parameter. If this
55 parameter is zero, the signal mask will not be saved/restored, otherwise it
58 After the function calling
60 has returned, the saved context may not be used in a call to
62 anymore, since the relevant portion of the stack may already have been wiped
65 Using these functions to return to a previous state from a signal handler
66 is possible but should be done with extreme care, as some interrupted library
67 routines may not be reentrant and/or temporarily allocate resources.
69 See the setjmp.h header file for more implementation details specific to Minix.