OSDN Git Service

(split) LDP v3.30, v3.31 の定型的な変更内容を反映。
[linuxjm/LDP_man-pages.git] / draft / man3 / setjmp.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 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
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 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>
32 .\"
33 .\"WORD:       stack context        ¥¹¥¿¥Ã¥¯¥³¥ó¥Æ¥­¥¹¥È
34 .\"WORD:       signal masks         ¥·¥°¥Ê¥ë¥Þ¥¹¥¯
35 .\"WORD:       signal context       ¥·¥°¥Ê¥ë¥³¥ó¥Æ¥­¥¹¥È
36 .\"WORD:       low-level            Äã¥ì¥Ù¥ë
37 .\"
38 .TH SETJMP 3 2009-06-26 "" "Linux Programmer's Manual"
39 .\"O .SH NAME
40 .SH Ì¾Á°
41 .\"O setjmp, sigsetjmp \- save stack context for nonlocal goto
42 setjmp, sigsetjmp \- Èó¶É½êŪ¤Ê¥¸¥ã¥ó¥×¤Î¤¿¤á¤Ë¡¢¥¹¥¿¥Ã¥¯¥³¥ó¥Æ¥­¥¹¥È (stack context) ¤òÊݸ¤¹¤ë
43 .\"O .SH SYNOPSIS
44 .SH ½ñ¼°
45 .B #include <setjmp.h>
46 .sp
47 .nf
48 .BI "int setjmp(jmp_buf " env );
49
50 .BI "int sigsetjmp(sigjmp_buf " env ", int " savesigs );
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 setjmp ():
62 .\"O see NOTES.
63 ¡ÖÃí°Õ¡×»²¾È¡£
64 .br
65 .BR sigsetjmp ():
66 _POSIX_C_SOURCE\ >=\ 1 || _XOPEN_SOURCE || _POSIX_C_SOURCE
67 .\"O .SH DESCRIPTION
68 .SH ÀâÌÀ
69 .\"O .BR setjmp ()
70 .\"O and
71 .\"O .BR longjmp (3)
72 .\"O are useful for dealing with errors
73 .\"O and interrupts encountered in a low-level subroutine of a program.
74 .\"O .BR setjmp ()
75 .\"O saves the stack context/environment in \fIenv\fP for
76 .\"O later use by
77 .\"O .BR longjmp (3).
78 .\"O The stack context will be invalidated
79 .\"O if the function which called
80 .\"O .BR setjmp ()
81 .\"O returns.
82 .BR setjmp ()
83 ¤È
84 .BR longjmp (3)
85 ¤Ï¡¢¥×¥í¥°¥é¥à¤ÎÄã¥ì¥Ù¥ë¤Ê¥µ¥Ö¥ë¡¼¥Á¥ó
86 ¤Ë¤ª¤¤¤Æ¡¢¥¨¥é¡¼¤ä³ä¤ê¹þ¤ß¤¬È¯À¸¤·¤¿»þ¤Î½èÍý¤ËÊØÍø¤Ç¤¢¤ë¡£
87 .BR setjmp ()
88 ¤Ï¡¢
89 .BR longjmp (3)
90 ¤Ë¤è¤Ã¤Æ»È¤ï¤ì¤ë \fIenv\fP ¤Ë
91 ¥¹¥¿¥Ã¥¯¥³¥ó¥Æ¥­¥¹¥È/¥¹¥¿¥Ã¥¯´Ä¶­¤òÊݸ¤¹¤ë¡£
92 .BR setjmp ()
93 ¤ò¸Æ¤Ó½Ð¤·¤¿
94 ´Ø¿ô¤¬ÊÖ¤ë¤È¤­¤Ë¡¢¤½¤Î¥¹¥¿¥Ã¥¯¥³¥ó¥Æ¥­¥¹¥È¤Ï̵¸ú¤Ë¤Ê¤ë¡£
95 .P
96 .\"O .BR sigsetjmp ()
97 .\"O is similar to
98 .\"O .BR setjmp ().
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.
104 .BR sigsetjmp ()
105 ¤â
106 .BR setjmp ()
107 ¤ÈƱÍͤǤ¢¤ë¡£
108 \fIsavesigs\fP ¤¬ 0 °Ê³°¤Î¾ì¹ç¡¢
109 ¤³¤Î¥×¥í¥»¥¹¤Î¸½ºß¤Î¥·¥°¥Ê¥ë¥Þ¥¹¥¯¤â \fIenv\fP ¤ËÊݸ¤µ¤ì¡¢
110 ¤³¤Î¥·¥°¥Ê¥ë¤Ï¸å¤Ç
111 .BR siglongjmp (3)
112 ¤¬¤³¤Î \fIenv\fP ¤Ç¼Â¹Ô¤µ¤ì¤¿ºÝ¤ËÉü¸µ¤µ¤ì¤ë¡£
113 .\"O .SH "RETURN VALUE"
114 .SH ÊÖ¤êÃÍ
115 .\"O .BR setjmp ()
116 .\"O and
117 .\"O .BR sigsetjmp ()
118 .\"O return 0 if returning directly, and
119 .\"O nonzero when returning from
120 .\"O .BR longjmp (3)
121 .\"O or
122 .\"O .BR siglongjmp (3)
123 .\"O using the saved context.
124 ľÀÜÊ֤äƤ¯¤ë¤È¤­¤Ï¡¢
125 .BR setjmp ()
126 ¤È
127 .BR sigsetjmp ()
128 ¤Ï 0 ¤òÊÖ¤·¡¢Êݸ¤·¤¿¥³¥ó¥Æ¥­¥¹¥È¤ò»È¤Ã¤Æ
129 .BR longjmp (3)
130 ¤ä
131 .BR siglongjmp (3)
132 ¤«¤éÊ֤äƤ¯¤ë¤È¤­¤Ï 0 °Ê³°¤òÊÖ¤¹¡£
133 .\"O .SH "CONFORMING TO"
134 .SH ½àµò
135 .\"O C89, C99, and POSIX.1-2001 specify
136 .\"O .BR setjmp ().
137 .\"O POSIX.1-2001 specifies
138 .\"O .BR sigsetjmp ().
139 .BR setjmp ()
140 ¤Ï C89, C99, POSIX.1-2001 ¤Çµ¬Äꤵ¤ì¤Æ¤¤¤ë¡£
141 .BR sigsetjmp ()
142 ¤Ï POSIX.1-2001 ¤Çµ¬Äꤵ¤ì¤Æ¤¤¤ë¡£
143 .\"O .SH NOTES
144 .SH Ãí°Õ
145 .\"O POSIX does not specify whether
146 .\"O .BR setjmp ()
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.
151 POSIX ¤Ï¡¢
152 .BR setjmp ()
153 ¤¬¥·¥°¥Ê¥ë¥Þ¥¹¥¯¤òÊݸ¤¹¤Ù¤­¤«¤É¤¦¤«¤òµ¬Äꤷ¤Æ¤¤¤Ê¤¤¡£
154 System V ¤Ç¤ÏÊݸ¤·¤Ê¤¤¡£
155 4.3BSD ¤Ç¤ÏÊݸ¤¹¤ë;
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
159 .\"O .BR _BSD_SOURCE
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 ,
166 .\"O or
167 .\"O .B _SVID_SOURCE
168 .\"O is defined.
169 ¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï¡¢Linux/glibc ¤Ï System V ¤Î¿¶¤ëÉñ¤¤¤Ë½¾¤¦¤¬¡¢
170 .B _BSD_SOURCE
171 µ¡Ç½¸¡ºº¥Þ¥¯¥í¤¬ÄêµÁ¤µ¤ì¡¢
172 .BR _POSIX_SOURCE ,
173 .BR _POSIX_C_SOURCE ,
174 .BR _XOPEN_SOURCE ,
175 .BR _XOPEN_SOURCE_EXTENDED ,
176 .BR _GNU_SOURCE ,
177 .B _SVID_SOURCE
178 ¤Î¤¤¤º¤ì¤âÄêµÁ¤µ¤ì¤Æ¤¤¤Ê¤¤»þ¤Ï BSD ¤Î¿¶¤ëÉñ¤¤¤È¤Ê¤ë¡£
179
180 .\"O If you want to portably save and restore signal masks, use
181 .\"O .BR sigsetjmp ()
182 .\"O and
183 .\"O .BR siglongjmp (3).
184 °Ü¿¢À­¤Î¤¢¤ë·Á¤Ç¥·¥°¥Ê¥ë¥Þ¥¹¥¯¤òÊݸ¤ª¤è¤ÓÉü¸µ¤·¤¿¤¤¤Î¤Ê¤é¡¢
185 .BR sigsetjmp ()
186 ¤È
187 .BR siglongjmp (3)
188 ¤ò»È¤¦¤³¤È¡£
189 .P
190 .\"O .BR setjmp ()
191 .\"O and
192 .\"O .BR sigsetjmp ()
193 .\"O make programs hard to understand
194 .\"O and maintain.
195 .\"O If possible an alternative should be used.
196 .BR setjmp ()
197 ¤ä
198 .BR sigsetjmp ()
199 ¤ò»È¤¦¤È¡¢¥×¥í¥°¥é¥à¤ÏÍý²ò¤·¤Å¤é¤¯¡¢Êݼ餷¤Ë¤¯¤¤¤â¤Î¤Ë¤Ê¤ë¡£
200 Ê̤ÎÊýË¡¤¬²Äǽ¤Ê¤é¡¢¤½¤ì¤ò»È¤¦¤Ù¤­¤Ç¤¢¤ë¡£
201 .\"O .SH "SEE ALSO"
202 .SH ´ØÏ¢¹àÌÜ
203 .BR longjmp (3),
204 .BR siglongjmp (3)