Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ setjmp.bsd(3) — Domain/IX SR9.5

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

sigvec(2)

sigstack(2)

signal(3C)

SETJMP(3)

NAME

setjmp, longjmp − non-local goto

USAGE

#include <setjmp.h>
 
setjmp(env) jmp_buf env;
 
longjmp(env, val) jmp_buf env;
 
_setjmp(env) jmp_buf env;
 
_longjmp(env, val) jmp_buf env;

DESCRIPTION

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

Setjmp saves its stack environment in env for later use by longjmp.  It returns a value of zero. 

Longjmp restores the environment saved by the last call of setjmp.  It then returns in such a way that execution continues, as if the call of setjmp had just returned the value val to the function that invoked setjmp.  Setjmp itself must not have returned in the interim.  All accessible data has values as of the time longjmp was called. 

Setjmp and longjmp save and restore the signal mask sigsetmask(2), while _setjmp and _longjmp manipulate only the stack and registers. 

RELATED INFORMATION

sigvec(2), sigstack(2), signal(3C)

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