Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ sigsetjmp(3C) — CX/UX 6.20

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

setjmp(3C)

sigaction(2)

sigaltstack(2)

signal(2)

sigstack(2)

sigvec(2)

sigsetjmp(3C)

NAME

sigsetjmp, siglongjmp − non-local goto

SYNOPSIS

#include <setjmp.h>

int sigsetjmp (env, savemask)
sigjmp_buf env;
int savemask;

void siglongjmp (env, val)
sigjmp_buf env;
int val;

DESCRIPTION

These POSIX functions are useful for dealing with errors and interrupts encountered in a low-level subroutine of a program. 

sigsetjmp saves the calling process’s registers and stack environment in env (whose type, sigjmp_buf, is defined in the <setjmp.h> header file) for later use by siglongjmp.  If the value of the savemask argument is not zero, then sigsetjmp shall also save the process’s current signal mask as part of the calling environment.  sigsetjmp then returns the value 0. 

siglongjmp restores the environment saved by the last call of sigsetjmp with the corresponding env argument.  If the env argument was initialized by a call to sigsetjmp with a non-zero savemask argument, then siglongjmp will also restore the process’s saved signal mask.  After siglongjmp is completed, program execution continues as if the corresponding call of sigsetjmp (the caller of which must not itself have returned in the interim) had just returned the value val. All accessible data had values as of the time siglongjmp was called. 

siglongjmp cannot cause sigsetjmp to return the value 0.  If siglongjmp is invoked with a second argument of 0, sigsetjmp will return 1. 

SEE ALSO

setjmp(3C), sigaction(2), sigaltstack(2), signal(2), sigstack(2), sigvec(2). 

WARNING

If siglongjmp is called even though env was never primed by a call to sigsetjmp, or when the last such call was in a function which has since returned, absolute chaos is guaranteed. 

sigsetjmp does not save the current notion of whether the process is executing on the signal stack.  The result is that a siglongjmp to some place on the signal stack leaves the signal stack state incorrect. 

CX/UX Programmer’s Reference Manual

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026