longjmp, siglongjmp − nonlocal jump to a saved stack context


, int void longjmp(jmp_buf env

, int void siglongjmp(sigjmp_buf env

Feature Test Macro Requirements for glibc (see


and are useful for dealing with errors and interrupts
encountered in a low‐level subroutine of a program.
restores the environment saved by the last call of with the
corresponding env argument.  After is completed, program
execution continues as if the corresponding call of had just
returned the value cannot cause 0 to be returned.  If is
invoked with a second argument of 0, 1 will be returned
instead.  is similar to except for the type of its env
argument.  If, and only if, the call that set this env used
a nonzero savesigs flag, also restores the signal mask that
was saved by

These functions never return.

For an explanation of the terms used in this section, see

│Interface               Attribute     Value   │
│                        │ Thread safety MT‐Safe │

POSIX.1‐2001, POSIX.1‐2008, C89, C99.

POSIX.1‐2001, POSIX.1‐2008.

POSIX does not specify whether will restore the signal
context (see for some more details).  If you want to
portably save and restore signal masks, use and The values
of automatic variables are unspecified after a call to if
they meet all the following criteria:

•  they are local to the function that made the
   corresponding call;

•  their values are changed between the calls to and and

•  they are not declared as Analogous remarks apply for and
   make programs hard to understand and maintain.  If
   possible, an alternative should be used.


This page is part of release 4.04 of the Linux man‐pages
project.  A description of the project, information about
reporting bugs, and the latest version of this page, can be
found at−pages/.