Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

sigsetjmp - set label for non-local jump using signal

&pagelevel(4)&pagelevel

Syntax

#include <signal.h>

int sigrelse(int sig);
void ( *sigset(int sig, void ( *disp) (int))) (int); 

 

Description

sigsetjmp() saves its calling environment in the argument env for later use by the siglongjmp() function. sigsetjmp() is implemented as a macro.

If the value of savemask is not equal to 0, sigsetjmp() will also save the current signal mask of the process as part of the calling environment. If setjmp() were used, this would be lost.

All accessible objects will have the same values as when longjmp() was called, except for the values of "automatic" objects, which are undefined under the following conditions:

  • They are local to the function containing the corresponding setjmp() call.

  • They are not of type volatile.

  • They are changed between the setjmp invocation and the longjmp call.

sigsetjmp() may only be called in one of the following contexts:

  • as the entire controlling expression of a selection or iteration statement, e.g.:

    if (sigsetjmp(env, mask)) ...

  • as one operand of a relational operator with the other operand an integral constant expression, with the resulting expression being the entire controlling expression of a selection or iteration statement, e.g.:

    if (sigsetjmp(env, mask)==0) ...

  • as the operand of a unary "!" operator with the resulting expression being the entire controlling expression of a selection or iteration statement, e.g.:

    if (!sigsetjmp(env, mask) ...

  • as the entire expression of an expression statement (possibly cast to void), e.g.:

    (void) sigsetjmp(env, mask);

If threads are used, then the function affects the process or a thread in the following manner: If the value of savemask is not equal to 0, sigsetjmp() also stores the current signal mask of the calling thread as part of the call environment.

Return val.

0

on successful return from a direct invocation of sigsetjmp().

Return val.

!= 0

if the return is from a call to siglongjmp().

Notes

The distinction between setjmp() or longjmp() and sigsetjmp() or siglongjmp() is only significant for programs which use sigaction(), sigprocmask() or sigsuspend().

See also

siglongjmp(), signal(), sigprocmask(), sigsuspend(), setjmp.h, section “Signals”.