1 .\" Written by Michael Haardt, Fri Nov 25 14:51:42 MET 1994
3 .\" %%%LICENSE_START(GPLv2+_doc_full)
4 .\" This is free documentation; you can redistribute it and/or
5 .\" modify it under the terms of the GNU General Public License as
6 .\" published by the Free Software Foundation; either version 2 of
7 .\" the License, or (at your option) any later version.
9 .\" The GNU General Public License's references to "object code"
10 .\" and "executables" are to be interpreted as the output of any
11 .\" document formatting or typesetting system, including
12 .\" intermediate and printed output.
14 .\" This manual is distributed in the hope that it will be useful,
15 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
16 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 .\" GNU General Public License for more details.
19 .\" You should have received a copy of the GNU General Public
20 .\" License along with this manual; if not, see
21 .\" <http://www.gnu.org/licenses/>.
24 .\" Added sigsetjmp, Sun Mar 2 22:03:05 EST 1997, jrv@vanzandt.mv.com
25 .\" Modifications, Sun Feb 26 14:39:45 1995, faith@cs.unc.edu
27 .TH SETJMP 3 2009-06-26 "" "Linux Programmer's Manual"
29 setjmp, sigsetjmp \- save stack context for nonlocal goto
31 .B #include <setjmp.h>
34 .BI "int setjmp(jmp_buf " env );
36 .BI "int sigsetjmp(sigjmp_buf " env ", int " savesigs );
40 Feature Test Macro Requirements for glibc (see
41 .BR feature_test_macros (7)):
48 _POSIX_C_SOURCE\ >=\ 1 || _XOPEN_SOURCE || _POSIX_C_SOURCE
53 are useful for dealing with errors
54 and interrupts encountered in a low-level subroutine of a program.
56 saves the stack context/environment in \fIenv\fP for
59 The stack context will be invalidated
60 if the function which called
67 If, and only if, \fIsavesigs\fP is nonzero,
68 the process's current signal mask is saved in \fIenv\fP
69 and will be restored if a
71 is later performed with this \fIenv\fP.
76 return 0 if returning directly, and
77 nonzero when returning from
81 using the saved context.
83 C89, C99, and POSIX.1-2001 specify
85 POSIX.1-2001 specifies
88 POSIX does not specify whether
90 will save the signal mask.
91 In System V it will not.
92 In 4.3BSD it will, and there
93 is a function \fB_setjmp\fP that will not.
94 By default, Linux/glibc follows the System V behavior,
95 but the BSD behavior is provided if the
97 feature test macro is defined and none of
101 .BR _XOPEN_SOURCE_EXTENDED ,
107 If you want to portably save and restore signal masks, use
115 make programs hard to understand
117 If possible an alternative should be used.