Guardian Native C Library Calls Reference Manual (G06.28+, H06.05+)
longjmp(3) Guardian Native C Library Calls Reference Manual
NAME
longjmp - Performs a nonlocal goto
LIBRARY
G-series native Guardian processes: system library
G-series native OSS processes: system library
H-series native Guardian processes: implicit libraries
H-series OSS processes: implicit libraries
SYNOPSIS
#include <setjmp.h>
void longjmp(
jmp_buf env,
int value);
PARAMETERS
env Specifies the address of a jmp_buf structure containing the environment to be
restored.
value Specifies a nonzero value to be returned from the corresponding setjmp() call.
DESCRIPTION
The longjmp( ) function restores the environment to the values set in the env parameter by a pre-
vious call to the setjmp() function.
All accessible objects have values as of the time longjmp( ) is called, except that the values of
objects of automatic storage duration that have been changed between the setjmp( ) call and the
longjmp() call are indeterminate.
Because it bypasses the usual function call and return mechanisms, the longjmp() function exe-
cutes correctly in the context of signals and their associated functions.
The process should not depend upon preservation of the values in native processor registers or
the values in local variables after a jump. If the value of a local variable must be reused after a
jump, the variable must be typed volatile.
If the process is using IEEE floating-point data, the contents of all floating-point registers except
the status and control register are preserved.
The env parameter must have been initialized by an earlier call to the setjmp( ) function and
must not have been modified since it was saved. The results of the longjmp() call are unspecified
if env was not initialized or if it was modified since it was saved.
The extended data segment is part of the state saved by the setjmp() function. If the extended
data segment that was in use at the time of the setjmp( ) call no longer exists, the process still
jumps to the saved location. However, the process will no longer have an extended data segment
in use, even if one is in use when the longjmp() function is called.
Use From the Guardian Environment
This version of the longjmp( ) function can be used only with the OSS version or the native ver-
sion of the setjmp() function. It cannot be used with the TNS or accelerated version of the
setjmp() function in the Guardian environment.
NOTES
For a TNS/E process, if a longjmp( ) call is executed and the environment in which the setjmp( )
call was executed no longer exists, errors can occur. The conditions under which the environ-
ment of the setjmp() no longer exists include exiting the procedure that contains the setjmp()
call, and exiting an inner block with temporary storage (such as a block with declarations in C).
This condition might not be detectable, in which case the longjmp( ) occurs and, if the environ-
ment no longer exists, the contents of the temporary storage of an inner block are unpredictable.
4−32 Hewlett-Packard Company 527192-007