.\" Written by Michael Haardt, Fri Nov 25 14:51:42 MET 1994 .\" .\" %%%LICENSE_START(GPLv2+_DOC_FULL) .\" This is free documentation; you can redistribute it and/or .\" modify it under the terms of the GNU General Public License as .\" published by the Free Software Foundation; either version 2 of .\" the License, or (at your option) any later version. .\" .\" The GNU General Public License's references to "object code" .\" and "executables" are to be interpreted as the output of any .\" document formatting or typesetting system, including .\" intermediate and printed output. .\" .\" This manual is distributed in the hope that it will be useful, .\" but WITHOUT ANY WARRANTY; without even the implied warranty of .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the .\" GNU General Public License for more details. .\" .\" You should have received a copy of the GNU General Public .\" License along with this manual; if not, see .\" . .\" %%%LICENSE_END .\" .\" Added siglongjmp, Sun Mar 2 22:03:05 EST 1997, jrv@vanzandt.mv.com .\" Modifications, Sun Feb 26 14:39:45 1995, faith@cs.unc.edu .\" " .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .\" .\" Japanese Version Copyright (c) 1998 Seiiti Obara .\" all rights reserved. .\" Translated 1998-05-27, Seiiti Obara .\" Updated 2009-02-24, Akihiro MOTOKI, LDP v3.19 .\" .TH LONGJMP 3 2009\-01\-13 "" "Linux Programmer's Manual" .SH 名前 longjmp, siglongjmp \- 保存されたスタックコンテキスト (stack context) への非局所的なジャンプ .SH 書式 .nf \fB#include \fP \fBvoid longjmp(jmp_buf \fP\fIenv\fP\fB, int \fP\fIval\fP\fB);\fP \fBvoid siglongjmp(sigjmp_buf \fP\fIenv\fP\fB, int \fP\fIval\fP\fB);\fP .fi .sp .in -4n glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7) 参照): .in .sp \fBsiglongjmp\fP(): _POSIX_C_SOURCE\ >=\ 1 || _XOPEN_SOURCE || _POSIX_C_SOURCE .SH 説明 \fBlongjmp\fP() と \fBsetjmp\fP(3) は、プログラムの低レベルなサブルーチンにおいて、 エラーや割り込みが発生した時の処理に便利である。 \fBlongjmp\fP() は、\fIenv\fP 引き数を指定して呼び出された最後の \fBsetjmp\fP(3) によって保存された環境を復元する。 \fBlongjmp\fP() の完了後、プログラムの実行は、まるで対応する \fBsetjmp\fP(3) の呼び出しが値 \fIval\fP で返って来たかように続行される。 \fBlongjmp\fP() は 0 を返すように指示することはできない。 二番目の引き数に 0 を指定して \fBlongjmp\fP() が呼ばれた場合は、代わりに 1 が返されることになる。 .P \fBsiglongjmp\fP() は、引き数 \fIenv\fP の型が異なる点以外は、 \fBlongjmp\fP() と同様である。 \fIenv\fP を保存した \fBsigsetjmp\fP(3) が 0 以外の \fIsavesigs\fP フラグで呼び出されていた場合で、 かつ、その場合にのみ、 \fBsiglongjmp\fP(3) は \fBsigsetjmp\fP(3) より保存されていたシグナルマスクの復元を行う。 .SH 返り値 これらの関数が返ることはない。 .SH 準拠 \fBlongjmp\fP() は C89, C99, POSIX.1\-2001 で規定されている。 \fBsiglongjmp\fP() は POSIX.1\-2001 で規定されている。 .SH 注意 POSIX では、 \fBlongjmp\fP() がシグナルコンテキスト (signal context) を復元 するかどうか規定されていない (\fBsetjmp\fP(3) にも少し詳しい情報がある)。 移植性のある方法で、シグナルマスクを保存し復元させたい場合には、 \fBsigsetjmp\fP(3) と \fBsiglongjmp\fP() を使うこと。 .P 以下の条件が全て成立する場合、 \fBlongjmp\fP() の呼び出しが行われた後の自動変数の値は未定義 (unspecified) となる。 .IP \(bu 3 その自動変数が、対応する \fBsetjmp\fP(3) 呼び出しを行った関数のローカル変数である。 .IP \(bu 自動変数の値が \fBsetjmp\fP(3) と \fBlongjmp\fP() の間で変更されている。 .IP \(bu \fIvolatile\fP として宣言されていない。 .P 同様の注意が \fBsiglongjmp\fP() にもあてはまる。 .P \fBlongjmp\fP() や \fBsiglongjmp\fP() を使うと、プログラムは理解しづらく、保守しにくいものになる。 別の方法が可能なら、それを使うべきである。 .SH 関連項目 \fBsetjmp\fP(3), \fBsigsetjmp\fP(3) .SH この文書について この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.65 の一部 である。プロジェクトの説明とバグ報告に関する情報は http://www.kernel.org/doc/man\-pages/ に書かれている。