Guardian Procedure Calls Reference Manual (G06.25+)
Guardian Procedure Calls (L)
Guardian Procedure Calls Reference Manual—522629-013
8-25
LONGJMP_ Procedure
Considerations
•
LONGJMP_ is the TAL or pTAL procedure name for the C longjmp() function.
The C
longjmp() function complies with the POSIX.1 standard.
•
Do not call LONGJMP_ with a jump buffer that contains the signal mask that was
set up by a call to the SIGSETJMP_ procedure, or the system will raise a
SIGABRT signal.
LONGJMP_ can be used with a jump buffer initialized by the SIGSETJMP_
procedure only if the call to SIGSETJMP_ does not save the signal mask.
•
LONGJMP_ does not return. Normally, return is made at the location of the
corresponding SETJMP_ procedure.
•
The jump buffer is assumed to be valid and initialized by an earlier call to
SETJMP_. If an illegal address is passed or if the caller modifies the jump buffer,
the result is undefined and could cause the system to deliver a non-deferrable
signal to the process.
•
If LONGJMP_ detects an error, a SIGABRT or SIGILL signal is raised (except for
TNS processes).
•
The jump buffer must be accessible to both the LONGJMP_ procedure call and the
associated SETJMP_ procedure call.
•
The procedure that invoked the corresponding call to SETJMP_ must still be
active. That is, the activation record of the procedure that called SETJMP_ must
still be on the stack.
•
A long jump across a transition boundary between the TNS and native
environments, in either direction, is not permitted. Any attempt to do so will be fatal
to the process.
•
A nonprivileged caller cannot jump to a privileged area. Any attempt to do so will
be fatal to the process. A privileged caller, however, can execute a long jump
across the privilege boundary; privileges are automatically turned off before control
returns to the SETJMP_ procedure.
•
As a result of optimization, the values of nonvolatile local variables in the
procedure that calls SETJMP_ might not be the same as they were when
LONGJMP_ was called if the variables are modified between the calls to SETJMP_
and LONGJMP_. C and pTAL programs can declare variables with the volatile
type qualifier; this is the only safe way of preserving local variables between calls
to SETJMP_ and LONGJMP_. Alternatively, you can make the variables global.
Example
LONGJMP_ ( env, value );