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)):
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
86 において、エラーや割り込みが発生した時の処理に便利である。
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.
128 は 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 がシグナルマスクを保存すべきかどうかを規定していない。
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 の振る舞いに従うが、
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 別の方法が可能なら、それを使うべきである。