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 .\" Japanese Version Copyright (c) 1998 Seiiti Obara
27 .\" all rights reserved.
28 .\" Translated 1998-05-27, Seiiti Obara <SEO@ma1.seikyou.ne.jp>
29 .\" Updated 1999-12-11, Kentaro Shirakata <argrath@ub32.org>
30 .\" Modified 2007-12-20, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
31 .\" Updated 2009-02-12, Kentaro Shirakata <argrath@ub32.org>
33 .\"WORD: stack context ¥¹¥¿¥Ã¥¯¥³¥ó¥Æ¥¥¹¥È
34 .\"WORD: signal masks ¥·¥°¥Ê¥ë¥Þ¥¹¥¯
35 .\"WORD: signal context ¥·¥°¥Ê¥ë¥³¥ó¥Æ¥¥¹¥È
36 .\"WORD: low-level Äã¥ì¥Ù¥ë
38 .TH SETJMP 3 2009-06-26 "" "Linux Programmer's Manual"
41 .\"O setjmp, sigsetjmp \- save stack context for nonlocal goto
42 setjmp, sigsetjmp \- Èó¶É½êŪ¤Ê¥¸¥ã¥ó¥×¤Î¤¿¤á¤Ë¡¢¥¹¥¿¥Ã¥¯¥³¥ó¥Æ¥¥¹¥È (stack context) ¤òÊݸ¤¹¤ë
45 .B #include <setjmp.h>
48 .BI "int setjmp(jmp_buf " env );
50 .BI "int sigsetjmp(sigjmp_buf " env ", int " savesigs );
54 .\"O Feature Test Macro Requirements for glibc (see
55 .\"O .BR feature_test_macros (7)):
56 glibc ¸þ¤±¤Îµ¡Ç½¸¡ºº¥Þ¥¯¥í¤ÎÍ×·ï
57 .RB ( feature_test_macros (7)
66 _POSIX_C_SOURCE\ >=\ 1 || _XOPEN_SOURCE || _POSIX_C_SOURCE
72 .\"O are useful for dealing with errors
73 .\"O and interrupts encountered in a low-level subroutine of a program.
75 .\"O saves the stack context/environment in \fIenv\fP for
78 .\"O The stack context will be invalidated
79 .\"O if the function which called
85 ¤Ï¡¢¥×¥í¥°¥é¥à¤ÎÄã¥ì¥Ù¥ë¤Ê¥µ¥Ö¥ë¡¼¥Á¥ó
86 ¤Ë¤ª¤¤¤Æ¡¢¥¨¥é¡¼¤ä³ä¤ê¹þ¤ß¤¬È¯À¸¤·¤¿»þ¤Î½èÍý¤ËÊØÍø¤Ç¤¢¤ë¡£
90 ¤Ë¤è¤Ã¤Æ»È¤ï¤ì¤ë \fIenv\fP ¤Ë
91 ¥¹¥¿¥Ã¥¯¥³¥ó¥Æ¥¥¹¥È/¥¹¥¿¥Ã¥¯´Ä¶¤òÊݸ¤¹¤ë¡£
94 ´Ø¿ô¤¬ÊÖ¤ë¤È¤¤Ë¡¢¤½¤Î¥¹¥¿¥Ã¥¯¥³¥ó¥Æ¥¥¹¥È¤Ï̵¸ú¤Ë¤Ê¤ë¡£
99 .\"O If, and only if, \fIsavesigs\fP is nonzero,
100 .\"O the process's current signal mask is saved in \fIenv\fP
101 .\"O and will be restored if a
102 .\"O .BR siglongjmp (3)
103 .\"O is later performed with this \fIenv\fP.
108 \fIsavesigs\fP ¤¬ 0 °Ê³°¤Î¾ì¹ç¡¢
109 ¤³¤Î¥×¥í¥»¥¹¤Î¸½ºß¤Î¥·¥°¥Ê¥ë¥Þ¥¹¥¯¤â \fIenv\fP ¤ËÊݸ¤µ¤ì¡¢
112 ¤¬¤³¤Î \fIenv\fP ¤Ç¼Â¹Ô¤µ¤ì¤¿ºÝ¤ËÉü¸µ¤µ¤ì¤ë¡£
113 .\"O .SH "RETURN VALUE"
117 .\"O .BR sigsetjmp ()
118 .\"O return 0 if returning directly, and
119 .\"O nonzero when returning from
122 .\"O .BR siglongjmp (3)
123 .\"O using the saved context.
124 ľÀÜÊ֤äƤ¯¤ë¤È¤¤Ï¡¢
128 ¤Ï 0 ¤òÊÖ¤·¡¢Êݸ¤·¤¿¥³¥ó¥Æ¥¥¹¥È¤ò»È¤Ã¤Æ
132 ¤«¤éÊ֤äƤ¯¤ë¤È¤¤Ï 0 °Ê³°¤òÊÖ¤¹¡£
133 .\"O .SH "CONFORMING TO"
135 .\"O C89, C99, and POSIX.1-2001 specify
137 .\"O POSIX.1-2001 specifies
138 .\"O .BR sigsetjmp ().
140 ¤Ï C89, C99, POSIX.1-2001 ¤Çµ¬Äꤵ¤ì¤Æ¤¤¤ë¡£
142 ¤Ï POSIX.1-2001 ¤Çµ¬Äꤵ¤ì¤Æ¤¤¤ë¡£
145 .\"O POSIX does not specify whether
147 .\"O will save the signal mask.
148 .\"O In System V it will not.
149 .\"O In 4.3BSD it will, and there
150 .\"O is a function \fB_setjmp\fP that will not.
153 ¤¬¥·¥°¥Ê¥ë¥Þ¥¹¥¯¤òÊݸ¤¹¤Ù¤¤«¤É¤¦¤«¤òµ¬Äꤷ¤Æ¤¤¤Ê¤¤¡£
154 System V ¤Ç¤ÏÊݸ¤·¤Ê¤¤¡£
156 4.3BSD ¤Ë¤Ï¥·¥°¥Ê¥ë¥³¥ó¥Æ¥¥¹¥È¤òÊݸ¤·¤Ê¤¤´Ø¿ô \fB_setjmp\fP ¤â¤¢¤ë¡£
157 .\"O By default, Linux/glibc follows the System V behavior,
158 .\"O but the BSD behavior is provided if the
160 .\"O feature test macro is defined and none of
161 .\"O .BR _POSIX_SOURCE ,
162 .\"O .BR _POSIX_C_SOURCE ,
163 .\"O .BR _XOPEN_SOURCE ,
164 .\"O .BR _XOPEN_SOURCE_EXTENDED ,
165 .\"O .BR _GNU_SOURCE ,
169 ¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï¡¢Linux/glibc ¤Ï System V ¤Î¿¶¤ëÉñ¤¤¤Ë½¾¤¦¤¬¡¢
171 µ¡Ç½¸¡ºº¥Þ¥¯¥í¤¬ÄêµÁ¤µ¤ì¡¢
173 .BR _POSIX_C_SOURCE ,
175 .BR _XOPEN_SOURCE_EXTENDED ,
178 ¤Î¤¤¤º¤ì¤âÄêµÁ¤µ¤ì¤Æ¤¤¤Ê¤¤»þ¤Ï BSD ¤Î¿¶¤ëÉñ¤¤¤È¤Ê¤ë¡£
180 .\"O If you want to portably save and restore signal masks, use
181 .\"O .BR sigsetjmp ()
183 .\"O .BR siglongjmp (3).
184 °Ü¿¢À¤Î¤¢¤ë·Á¤Ç¥·¥°¥Ê¥ë¥Þ¥¹¥¯¤òÊݸ¤ª¤è¤ÓÉü¸µ¤·¤¿¤¤¤Î¤Ê¤é¡¢
192 .\"O .BR sigsetjmp ()
193 .\"O make programs hard to understand
195 .\"O If possible an alternative should be used.
199 ¤ò»È¤¦¤È¡¢¥×¥í¥°¥é¥à¤ÏÍý²ò¤·¤Å¤é¤¯¡¢Êݼ餷¤Ë¤¯¤¤¤â¤Î¤Ë¤Ê¤ë¡£
200 Ê̤ÎÊýË¡¤¬²Äǽ¤Ê¤é¡¢¤½¤ì¤ò»È¤¦¤Ù¤¤Ç¤¢¤ë¡£