HPlogo MPE/iX Developer's Kit Reference Manual Volume I: HP 3000 MPE/iX Computer Systems > Chapter 4  POSIX/iX Library Function Descriptions

siglongjmp

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Index

Restore an environment previously saved by sigsetjmp().

Syntax

   #include <setjmp.h>

   void siglongjmp (sigjmp_buf env, int val);

Parameters

env

Passes information needed to restore a previous environment. This variable was used in a previous call to sigsetjmp() to save the environment. The type sigjmp_buf (defined in <setjmp.h>) defines an array of unsigned integers. For this reason, the env argument does not require an & operator..

val

Passes a value to be returned by sigsetjmp(). If a zero is passed in this argument, it is changed to a value of 1 to ensure that siglongjmp() never causes sigsetjmp() to return a zero value.

Return Values

None.

Description

The siglongjmp() function restores the environment saved in env by a previous call to the sigsetjmp() macro. If the env argument was initialized by a call to sigsetjmp() with a non-zero value passed in the savemask argument, the saved signal mask is also restored by siglongjmp(). If the env argument was not initialized by a call to sigsetjmp(), the operation of siglongjmp() is undefined.

After siglongjmp() is completed, the program executes as if the call to sigsetjmp() (which stored information into the env argument) had returned a second time. In this case, sigsetjmp() returns either the non-zero value passed in the val argument of siglongjmp() or 1 if zero was passed in val.

The restoration of the environment includes trimming the stack so that all stack frames beyond the frame marked by env are removed. The siglongjmp() function cannot add stack frames. This means that if a sequence of functions is:

   A == calls ==> B == calls ==> C

and sigsetjmp() is used in function C to save an environment in a global env, functions B or A may not contain any siglongjmp() calls that reference the env values. Only subordinate functions may issue calls to siglongjmp(). As a special case, a function may issue a siglongjmp() call that references a sigsetjmp() within itself, although this is not usually done.

The values of objects of automatic storage duration that are not qualified by volatile are indeterminate if they have changed since the call to sigsetjmp().

The siglongjmp() function will work correctly in the context of signals and interrupts and any of their associated functions. However, if the siglongjmp() function is invoked from a nested signal handler, the operation of siglongjmp() is undefined.

See Also

sigsetjmp(), POSIX 1003.1 Section 8.3.1

Feedback to webmaster