Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ setjmp(3spp) — UMIPS/BSD System Programmer's Package 2.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

nofault(3spp)

SETJMP(3spp)

NAME

setjmp, longjmp − non-local goto

SYNOPSIS

#include <saio/setjmp.h>

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 value 0. 

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, which must not itself have returned in the interim.  If longjmp is called from a fault handler, see nofault(3spp), the flow of control may be altered in a manner not visible to the compiler system.  In this case, all global and static variables which may be updated between the setjmp and the longjmp, where these updates must be visible after longjmp, should be declared "volatile".  If longjmp is not invoked from a fault handler, this restriction is not necessary. 

SEE ALSO

nofault(3spp)

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