unixdev.net


Switch to SpeakEasy.net DSL

The Modular Manual Browser

Home Page
Manual: (4.2BSD)
Page:
Section:
Apropos / Subsearch:
optional field

SETJMP(3)                  Library Functions Manual                  SETJMP(3)



NAME
       setjmp, longjmp - non-local goto

SYNOPSIS
       #include <&lt;setjmp.h>&gt;

       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 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.  All acces-
       sible data have values as of the time longjmp was called.

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

SEE ALSO
       sigvec(2), sigstack(2), signal(3)

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



4th Berkeley Distribution       19 January 1983                      SETJMP(3)