Guardian Native C Library Calls Reference Manual (G06.29+, H06.08+, J06.03+)
Guardian Native C Library Calls (s) setjmp(3)
NAME
setjmp - Saves the current execution context
LIBRARY
G-series native Guardian processes: system library
G-series native OSS processes: system library
H-series and J-series native Guardian processes: implicit libraries
H-series and J-series OSS processes: implicit libraries
SYNOPSIS
#include <setjmp.h>
int setjmp(
jmp_buf env);
PARAMETERS
env Specifies the address of the jmp_buf structure in which to save the current
environment.
DESCRIPTION
The setjmp( ) function is used with the longjmp() function for handling errors and interrupts
encountered in low-level functions of a program.
The setjmp( ) function saves the current stack context in the structure specified by the env
parameter. The setjmp() function does not save the signal mask; see the sigsetjmp(3) reference
page for information on how to save the signal mask.
The calling process must not examine or modify the contents of the env parameter after calling
the setjmp() function. The results of calling the longjmp() function are undefined if the caller
changes the contents of env.
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.
Use From the Guardian Environment
This version of the setjmp() function can be used only with the OSS version or the native Guar-
dian version of the longjmp() function. It cannot be used with the TNS or accelerated version of
the longjmp() function in the Guardian environment.
RETURN VALUES
If the return is from a successful direct invocation, the setjmp() function returns the value 0
(zero). A return from a call to the longjmp() function returns to the same location as the
setjmp( ) function; in this case, the return has a nonzero value as specified in the longjmp()
function call.
ERRORS
The setjmp( ) function never sets the value of errno. Instead, if the call is unsuccessful, an
undefined signal that cannot be caught, blocked, or ignored is delivered to the calling process.
RELATED INFORMATION
Functions: longjmp(3), siglongjmp(3), sigsetjmp(3).
527192-018 Hewlett-Packard Company 6−29