Guardian Procedure Calls Reference Manual (G06.25+)

Guardian Procedure Calls (S)
Guardian Procedure Calls Reference Manual522629-013
14-62
SETJMP_ Procedure
env output
INT .EXT:ref:(JMP_BUF_TEMPLATE)
specifies the address of a previously allocated jump buffer in which the process
context of the caller is returned. The jump buffer is allocated using the
JMP_BUF_DEF DEFINE.
Considerations
SETJMP_ is the TAL or pTAL procedure name for the C setjmp() function. The
C
setjmp() function complies with the POSIX.1 standard.
Calling SETJMP_ is the functional equivalent of calling the SIGSETJMP_
procedure with
mask = 0D.
You can allocate the jump buffer for SETJMP_ using the JMP_BUF_DEF DEFINE
as follows:
JMP_BUF_DEF ( env );
where env is a legal variable name.
Alternatively, you can allocate the buffer by declaring a structure if type
JMP_BUF_TEMPLATE.
In either case, the buffer must be accessible to both the SETJMP_ procedure call
and the associated LONGJMP_ procedure call.
The jump buffer saved by the SETJMP_ procedure is normally used by a call to the
LONGJMP_ procedure. The jump buffer can be used by a call to the
SIGLONGJMP_ procedure only if the signal mask is not required.
The buffer pointer is assumed to be valid. An illegal address passed to SETJMP_
will cause unpredictable results and could cause the system to deliver a
nondeferrable signal to the process.
Do not change the contents of the jump buffer. The results of a corresponding
LONGJMP_ procedure call are undefined if the contents of the jump buffer are
changed.
Example
jmp_buf env;
JMP_BUF_DEF_ ( env );
retval := SETJMP_ ( env );
Related Programming Manual
For programming information about the SETJMP_ procedure, see the Guardian
Programmer’s Guide.