1 .\" Written by Michael Haardt, Fri Nov 25 14:51:42 MET 1994
3 .\" This is free documentation; you can redistribute it and/or
4 .\" modify it under the terms of the GNU General Public License as
5 .\" published by the Free Software Foundation; either version 2 of
6 .\" the License, or (at your option) any later version.
8 .\" The GNU General Public License's references to "object code"
9 .\" and "executables" are to be interpreted as the output of any
10 .\" document formatting or typesetting system, including
11 .\" intermediate and printed output.
13 .\" This manual is distributed in the hope that it will be useful,
14 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
15 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 .\" GNU General Public License for more details.
18 .\" You should have received a copy of the GNU General Public
19 .\" License along with this manual; if not, write to the Free
20 .\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111,
23 .\" Added sigsetjmp, Sun Mar 2 22:03:05 EST 1997, jrv@vanzandt.mv.com
24 .\" Modifications, Sun Feb 26 14:39:45 1995, faith@cs.unc.edu
26 .TH SETJMP 3 2009-06-26 "" "Linux Programmer's Manual"
28 setjmp, sigsetjmp \- save stack context for nonlocal goto
30 .B #include <setjmp.h>
33 .BI "int setjmp(jmp_buf " env );
35 .BI "int sigsetjmp(sigjmp_buf " env ", int " savesigs );
39 Feature Test Macro Requirements for glibc (see
40 .BR feature_test_macros (7)):
47 _POSIX_C_SOURCE\ >=\ 1 || _XOPEN_SOURCE || _POSIX_C_SOURCE
52 are useful for dealing with errors
53 and interrupts encountered in a low-level subroutine of a program.
55 saves the stack context/environment in \fIenv\fP for
58 The stack context will be invalidated
59 if the function which called
66 If, and only if, \fIsavesigs\fP is nonzero,
67 the process's current signal mask is saved in \fIenv\fP
68 and will be restored if a
70 is later performed with this \fIenv\fP.
75 return 0 if returning directly, and
76 nonzero when returning from
80 using the saved context.
82 C89, C99, and POSIX.1-2001 specify
84 POSIX.1-2001 specifies
87 POSIX does not specify whether
89 will save the signal mask.
90 In System V it will not.
91 In 4.3BSD it will, and there
92 is a function \fB_setjmp\fP that will not.
93 By default, Linux/glibc follows the System V behavior,
94 but the BSD behavior is provided if the
96 feature test macro is defined and none of
100 .BR _XOPEN_SOURCE_EXTENDED ,
106 If you want to portably save and restore signal masks, use
114 make programs hard to understand
116 If possible an alternative should be used.