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"
40 setjmp, sigsetjmp \- 非局所的なジャンプのために、スタックコンテキスト (stack context) を保存する
42 .B #include <setjmp.h>
45 .BI "int setjmp(jmp_buf " env );
47 .BI "int sigsetjmp(sigjmp_buf " env ", int " savesigs );
52 .RB ( feature_test_macros (7)
60 _POSIX_C_SOURCE\ >=\ 1 || _XOPEN_SOURCE || _POSIX_C_SOURCE
66 において、エラーや割り込みが発生した時の処理に便利である。
71 スタックコンテキスト/スタック環境を保存する。
74 関数が返るときに、そのスタックコンテキストは無効になる。
80 \fIsavesigs\fP が 0 以外の場合、
81 このプロセスの現在のシグナルマスクも \fIenv\fP に保存され、
84 がこの \fIenv\fP で実行された際に復元される。
90 は 0 を返し、保存したコンテキストを使って
97 は C89, C99, POSIX.1-2001 で規定されている。
99 は POSIX.1-2001 で規定されている。
103 がシグナルマスクを保存すべきかどうかを規定していない。
106 4.3BSD にはシグナルコンテキストを保存しない関数 \fB_setjmp\fP もある。
107 デフォルトでは、Linux/glibc は System V の振る舞いに従うが、
111 .BR _POSIX_C_SOURCE ,
113 .BR _XOPEN_SOURCE_EXTENDED ,
116 のいずれも定義されていない時は BSD の振る舞いとなる。
118 移植性のある形でシグナルマスクを保存および復元したいのなら、
127 を使うと、プログラムは理解しづらく、保守しにくいものになる。
128 別の方法が可能なら、それを使うべきである。