.\" Written by Michael Haardt, Fri Nov 25 14:51:42 MET 1994 .\" .\" 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, write to the Free .\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, .\" USA. .\" .\" 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 .\" " .\" 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 .\" .\"WORD: stack context スタックコンテキスト .\"WORD: signal masks シグナルマスク .\"WORD: signal context シグナルコンテキスト .\"WORD: flag フラグ .\"WORD: low-level 低レベル .\" .TH LONGJMP 3 2009-01-13 "" "Linux Programmer's Manual" .\"O .SH NAME .SH 名前 .\"O longjmp, siglongjmp \- nonlocal jump to a saved stack context longjmp, siglongjmp \- 保存されたスタックコンテキスト (stack context) への非局所的なジャンプ .\"O .SH SYNOPSIS .SH 書式 .nf .B #include .BI "void longjmp(jmp_buf " env ", int " val ); .BI "void siglongjmp(sigjmp_buf " env ", int " val ); .fi .sp .in -4n .\"O Feature Test Macro Requirements for glibc (see .\"O .BR feature_test_macros (7)): glibc 向けの機能検査マクロの要件 .RB ( feature_test_macros (7) 参照): .in .sp .BR siglongjmp (): _POSIX_C_SOURCE\ >=\ 1 || _XOPEN_SOURCE || _POSIX_C_SOURCE .\"O .SH DESCRIPTION .SH 説明 .\"O .BR longjmp () .\"O and .\"O .BR setjmp (3) .\"O are useful for dealing with errors .\"O and interrupts encountered in a low-level subroutine of a program. .\"O .BR longjmp () .\"O restores the environment saved by the last call of .\"O .BR setjmp (3) .\"O with the corresponding \fIenv\fP argument. .\"O After .\"O .BR longjmp () .\"O is completed, program execution continues as if the .\"O corresponding call of .\"O .BR setjmp (3) .\"O had just returned the value .\"O \fIval\fP. .\"O .BR longjmp () .\"O cannot cause 0 to be returned. .\"O If .\"O .BR longjmp () .\"O is invoked with a second argument of 0, 1 will be returned instead. .BR longjmp () と .BR setjmp (3) は、プログラムの低レベルなサブルーチンにおいて、 エラーや割り込みが発生した時の処理に便利である。 .BR longjmp () は、\fIenv\fP 引き数を指定して呼び出された最後の .BR setjmp (3) によって保存された環境を復元する。 .BR longjmp () の完了後、プログラムの実行は、まるで対応する .BR setjmp (3) の呼び出しが値 \fIval\fP で返って来たかように続行される。 .BR longjmp () は 0 を返すように指示することはできない。 二番目の引き数に 0 を指定して .BR longjmp () が呼ばれた場合は、代わりに 1 が返されることになる。 .P .\"O .BR siglongjmp () .\"O is similar to .\"O .BR longjmp () .\"O except for the type of .\"O its \fIenv\fP argument. .\"O If, and only if, the .\"O .BR sigsetjmp (3) .\"O call that set this .\"O \fIenv\fP used a nonzero \fIsavesigs\fP flag, .\"O .BR siglongjmp () .\"O also restores the signal mask that was saved by .\"O .BR sigsetjmp (3). .BR siglongjmp () は、引き数 \fIenv\fP の型が異なる点以外は、 .BR longjmp () と同様である。 \fIenv\fP を保存した .BR sigsetjmp (3) が 0 以外の \fIsavesigs\fP フラグで呼び出されていた場合で、 かつ、その場合にのみ、 .BR siglongjmp (3) は .BR sigsetjmp (3) より保存されていたシグナルマスクの復元を行う。 .\"O .SH "RETURN VALUE" .SH 返り値 .\"O These functions never return. これらの関数が返ることはない。 .\"O .SH "CONFORMING TO" .SH 準拠 .\"O C89, C99, and POSIX.1-2001 specify .\"O .BR longjmp (). .\"O POSIX.1-2001 specifies .\"O .BR siglongjmp (). .BR longjmp () は C89, C99, POSIX.1-2001 で規定されている。 .BR siglongjmp () は POSIX.1-2001 で規定されている。 .\"O .SH NOTES .SH 注意 .\"O POSIX does not specify whether .\"O .BR longjmp () .\"O will restore the signal context (see .\"O .BR setjmp (3) .\"O for some more details). .\"O If you want to portably save and restore signal masks, use .\"O .BR sigsetjmp () .\"O and .\"O .BR siglongjmp (). POSIX では、 .BR longjmp () がシグナルコンテキスト (signal context) を復元するかどうか規定されていない .RB ( setjmp (3) にも少し詳しい情報がある)。 移植性のある方法で、シグナルマスクを保存し復元させたい場合には、 .BR sigsetjmp (3) と .BR siglongjmp () を使うこと。 .P .\"O The values of automatic variables are unspecified after a call to .\"O .BR longjmp () .\"O if they meet all the following criteria: 以下の条件が全て成立する場合、 .BR longjmp () の呼び出しが行われた後の自動変数の値は未定義 (unspecified) となる。 .IP \(bu 3 .\"O they are local to the function that made the corresponding .\"O .BR setjmp (3) .\"O call; その自動変数が、対応する .BR setjmp (3) 呼び出しを行った関数のローカル変数である。 .IP \(bu .\"O their values are changed between the calls to .\"O .BR setjmp (3) .\"O and .\"O .BR longjmp (); .\"O and 自動変数の値が .BR setjmp (3) と .BR longjmp () の間で変更されている。 .IP \(bu .\"O they are not declared as .\"O .IR volatile . .I volatile として宣言されていない。 .P .\"O Analogous remarks apply for .\"O .BR siglongjmp (). 同様の注意が .BR siglongjmp () にもあてはまる。 .P .\"O .BR longjmp () .\"O and .\"O .BR siglongjmp () .\"O make programs hard to .\"O understand and maintain. .\"O If possible an alternative should be used. .BR longjmp () や .BR siglongjmp () を使うと、プログラムは理解しづらく、保守しにくいものになる。 別の方法が可能なら、それを使うべきである。 .\"O .SH "SEE ALSO" .SH 関連項目 .BR setjmp (3), .BR sigsetjmp (3)