OSDN Git Service

(split) LDP_man-pages: release ioctl.2 [JM:00378]
[linuxjm/LDP_man-pages.git] / draft / man3 / longjmp.3
1 .\" Written by Michael Haardt, Fri Nov 25 14:51:42 MET 1994
2 .\"
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.
7 .\"
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.
12 .\"
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.
17 .\"
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,
21 .\" USA.
22 .\"
23 .\" Added siglongjmp, 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
25 .\" "
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 2009-02-24, Akihiro MOTOKI, LDP v3.19
30 .\"
31 .\"WORD:       stack context        ¥¹¥¿¥Ã¥¯¥³¥ó¥Æ¥­¥¹¥È
32 .\"WORD:       signal masks         ¥·¥°¥Ê¥ë¥Þ¥¹¥¯
33 .\"WORD:       signal context       ¥·¥°¥Ê¥ë¥³¥ó¥Æ¥­¥¹¥È
34 .\"WORD:       flag                 ¥Õ¥é¥°
35 .\"WORD:       low-level            Äã¥ì¥Ù¥ë
36 .\"
37 .TH LONGJMP 3 2009-01-13 "" "Linux Programmer's Manual"
38 .\"O .SH NAME
39 .SH Ì¾Á°
40 .\"O longjmp, siglongjmp \- nonlocal jump to a saved stack context
41 longjmp, siglongjmp \- Êݸ¤µ¤ì¤¿¥¹¥¿¥Ã¥¯¥³¥ó¥Æ¥­¥¹¥È (stack context)
42 ¤Ø¤ÎÈó¶É½êŪ¤Ê¥¸¥ã¥ó¥×
43 .\"O .SH SYNOPSIS
44 .SH ½ñ¼°
45 .nf
46 .B #include <setjmp.h>
47
48 .BI "void longjmp(jmp_buf " env ", int " val );
49
50 .BI "void siglongjmp(sigjmp_buf " env ", int " val );
51 .fi
52 .sp
53 .in -4n
54 .\"O Feature Test Macro Requirements for glibc (see
55 .\"O .BR feature_test_macros (7)):
56 glibc ¸þ¤±¤Îµ¡Ç½¸¡ºº¥Þ¥¯¥í¤ÎÍ×·ï
57 .RB ( feature_test_macros (7)
58 »²¾È):
59 .in
60 .sp
61 .BR siglongjmp ():
62 _POSIX_C_SOURCE\ >=\ 1 || _XOPEN_SOURCE || _POSIX_C_SOURCE
63 .\"O .SH DESCRIPTION
64 .SH ÀâÌÀ
65 .\"O .BR longjmp ()
66 .\"O and
67 .\"O .BR setjmp (3)
68 .\"O are useful for dealing with errors
69 .\"O and interrupts encountered in a low-level subroutine of a program.
70 .\"O .BR longjmp ()
71 .\"O restores the environment saved by the last call of
72 .\"O .BR setjmp (3)
73 .\"O with the corresponding \fIenv\fP argument.
74 .\"O After
75 .\"O .BR longjmp ()
76 .\"O is completed, program execution continues as if the
77 .\"O corresponding call of
78 .\"O .BR setjmp (3)
79 .\"O had just returned the value
80 .\"O \fIval\fP.
81 .\"O .BR longjmp ()
82 .\"O cannot cause 0 to be returned.
83 .\"O If
84 .\"O .BR longjmp ()
85 .\"O is invoked with a second argument of 0, 1 will be returned instead.
86 .BR longjmp ()
87 ¤È
88 .BR setjmp (3)
89 ¤Ï¡¢¥×¥í¥°¥é¥à¤ÎÄã¥ì¥Ù¥ë¤Ê¥µ¥Ö¥ë¡¼¥Á¥ó¤Ë¤ª¤¤¤Æ¡¢
90 ¥¨¥é¡¼¤ä³ä¤ê¹þ¤ß¤¬È¯À¸¤·¤¿»þ¤Î½èÍý¤ËÊØÍø¤Ç¤¢¤ë¡£
91 .BR longjmp ()
92 ¤Ï¡¢\fIenv\fP °ú¤­¿ô¤ò»ØÄꤷ¤Æ¸Æ¤Ó½Ð¤µ¤ì¤¿ºÇ¸å¤Î
93 .BR setjmp (3)
94 ¤Ë¤è¤Ã¤ÆÊݸ¤µ¤ì¤¿´Ä¶­¤òÉü¸µ¤¹¤ë¡£
95 .BR longjmp ()
96 ¤Î´°Î»¸å¡¢¥×¥í¥°¥é¥à¤Î¼Â¹Ô¤Ï¡¢¤Þ¤ë¤ÇÂбþ¤¹¤ë
97 .BR setjmp (3)
98 ¤Î¸Æ¤Ó½Ð¤·¤¬ÃÍ \fIval\fP ¤ÇÊ֤äÆÍ褿¤«¤è¤¦¤Ë³¹Ô¤µ¤ì¤ë¡£
99 .BR longjmp ()
100 ¤Ï 0 ¤òÊÖ¤¹¤è¤¦¤Ë»Ø¼¨¤¹¤ë¤³¤È¤Ï¤Ç¤­¤Ê¤¤¡£
101 ÆóÈÖÌܤΰú¤­¿ô¤Ë 0 ¤ò»ØÄꤷ¤Æ
102 .BR longjmp ()
103 ¤¬¸Æ¤Ð¤ì¤¿¾ì¹ç¤Ï¡¢Âå¤ï¤ê¤Ë 1 ¤¬ÊÖ¤µ¤ì¤ë¤³¤È¤Ë¤Ê¤ë¡£
104 .P
105 .\"O .BR siglongjmp ()
106 .\"O is similar to
107 .\"O .BR longjmp ()
108 .\"O except for the type of
109 .\"O its \fIenv\fP argument.
110 .\"O If, and only if, the
111 .\"O .BR sigsetjmp (3)
112 .\"O call that set this
113 .\"O \fIenv\fP used a nonzero \fIsavesigs\fP flag,
114 .\"O .BR siglongjmp ()
115 .\"O also restores the signal mask that was saved by
116 .\"O .BR sigsetjmp (3).
117 .BR siglongjmp ()
118 ¤Ï¡¢°ú¤­¿ô \fIenv\fP ¤Î·¿¤¬°Û¤Ê¤ëÅÀ°Ê³°¤Ï¡¢
119 .BR longjmp ()
120 ¤ÈƱÍͤǤ¢¤ë¡£
121 \fIenv\fP ¤òÊݸ¤·¤¿
122 .BR sigsetjmp (3)
123 ¤¬ 0 °Ê³°¤Î \fIsavesigs\fP ¥Õ¥é¥°¤Ç¸Æ¤Ó½Ð¤µ¤ì¤Æ¤¤¤¿¾ì¹ç¤Ç¡¢
124 ¤«¤Ä¡¢¤½¤Î¾ì¹ç¤Ë¤Î¤ß¡¢
125 .BR siglongjmp (3)
126 ¤Ï
127 .BR sigsetjmp (3)
128 ¤è¤êÊݸ¤µ¤ì¤Æ¤¤¤¿¥·¥°¥Ê¥ë¥Þ¥¹¥¯¤ÎÉü¸µ¤ò¹Ô¤¦¡£
129 .\"O .SH "RETURN VALUE"
130 .SH ÊÖ¤êÃÍ
131 .\"O These functions never return.
132 ¤³¤ì¤é¤Î´Ø¿ô¤¬Ê֤뤳¤È¤Ï¤Ê¤¤¡£
133 .\"O .SH "CONFORMING TO"
134 .SH ½àµò
135 .\"O C89, C99, and POSIX.1-2001 specify
136 .\"O .BR longjmp ().
137 .\"O POSIX.1-2001 specifies
138 .\"O .BR siglongjmp ().
139 .BR longjmp ()
140 ¤Ï C89, C99, POSIX.1-2001 ¤Çµ¬Äꤵ¤ì¤Æ¤¤¤ë¡£
141 .BR siglongjmp ()
142 ¤Ï POSIX.1-2001 ¤Çµ¬Äꤵ¤ì¤Æ¤¤¤ë¡£
143 .\"O .SH NOTES
144 .SH Ãí°Õ
145 .\"O POSIX does not specify whether
146 .\"O .BR longjmp ()
147 .\"O will restore the signal context (see
148 .\"O .BR setjmp (3)
149 .\"O for some more details).
150 .\"O If you want to portably save and restore signal masks, use
151 .\"O .BR sigsetjmp ()
152 .\"O and
153 .\"O .BR siglongjmp ().
154 POSIX ¤Ç¤Ï¡¢
155 .BR longjmp ()
156 ¤¬¥·¥°¥Ê¥ë¥³¥ó¥Æ¥­¥¹¥È (signal context) ¤òÉü¸µ¤¹¤ë¤«¤É¤¦¤«µ¬Äꤵ¤ì¤Æ¤¤¤Ê¤¤
157 .RB ( setjmp (3)
158 ¤Ë¤â¾¯¤·¾Ü¤·¤¤¾ðÊ󤬤¢¤ë)¡£
159 °Ü¿¢À­¤Î¤¢¤ëÊýË¡¤Ç¡¢¥·¥°¥Ê¥ë¥Þ¥¹¥¯¤òÊݸ¤·Éü¸µ¤µ¤»¤¿¤¤¾ì¹ç¤Ë¤Ï¡¢
160 .BR sigsetjmp (3)
161 ¤È
162 .BR siglongjmp ()
163 ¤ò»È¤¦¤³¤È¡£
164 .P
165 .\"O The values of automatic variables are unspecified after a call to
166 .\"O .BR longjmp ()
167 .\"O if they meet all the following criteria:
168 °Ê²¼¤Î¾ò·ï¤¬Á´¤ÆÀ®Î©¤¹¤ë¾ì¹ç¡¢
169 .BR longjmp ()
170 ¤Î¸Æ¤Ó½Ð¤·¤¬¹Ô¤ï¤ì¤¿¸å¤Î¼«Æ°ÊÑ¿ô¤ÎÃͤÏ̤ÄêµÁ (unspecified) ¤È¤Ê¤ë¡£
171 .IP \(bu 3
172 .\"O they are local to the function that made the corresponding
173 .\"O .BR setjmp (3)
174 .\"O call;
175 ¤½¤Î¼«Æ°ÊÑ¿ô¤¬¡¢Âбþ¤¹¤ë
176 .BR setjmp (3)
177 ¸Æ¤Ó½Ð¤·¤ò¹Ô¤Ã¤¿´Ø¿ô¤Î¥í¡¼¥«¥ëÊÑ¿ô¤Ç¤¢¤ë¡£
178 .IP \(bu
179 .\"O their values are changed between the calls to
180 .\"O .BR setjmp (3)
181 .\"O and
182 .\"O .BR longjmp ();
183 .\"O and
184 ¼«Æ°ÊÑ¿ô¤ÎÃͤ¬
185 .BR setjmp (3)
186 ¤È
187 .BR longjmp ()
188 ¤Î´Ö¤ÇÊѹ¹¤µ¤ì¤Æ¤¤¤ë¡£
189 .IP \(bu
190 .\"O they are not declared as
191 .\"O .IR volatile .
192 .I volatile
193 ¤È¤·¤ÆÀë¸À¤µ¤ì¤Æ¤¤¤Ê¤¤¡£
194 .P
195 .\"O Analogous remarks apply for
196 .\"O .BR siglongjmp ().
197 ƱÍͤÎÃí°Õ¤¬
198 .BR siglongjmp ()
199 ¤Ë¤â¤¢¤Æ¤Ï¤Þ¤ë¡£
200 .P
201 .\"O .BR longjmp ()
202 .\"O and
203 .\"O .BR siglongjmp ()
204 .\"O make programs hard to
205 .\"O understand and maintain.
206 .\"O If possible an alternative should be used.
207 .BR longjmp ()
208 ¤ä
209 .BR siglongjmp ()
210 ¤ò»È¤¦¤È¡¢¥×¥í¥°¥é¥à¤ÏÍý²ò¤·¤Å¤é¤¯¡¢Êݼ餷¤Ë¤¯¤¤¤â¤Î¤Ë¤Ê¤ë¡£
211 Ê̤ÎÊýË¡¤¬²Äǽ¤Ê¤é¡¢¤½¤ì¤ò»È¤¦¤Ù¤­¤Ç¤¢¤ë¡£
212 .\"O .SH "SEE ALSO"
213 .SH ´ØÏ¢¹àÌÜ
214 .BR setjmp (3),
215 .BR sigsetjmp (3)