Section: POSIX Programmer's Manual (3P)
This manual page is part of the POSIX Programmer's Manual.
The Linux implementation of this interface may differ (consult
the corresponding Linux manual page for details of Linux behavior),
or the interface may not be implemented on Linux.
--- non-local goto
void longjmp(jmp_buf env, int val);
The functionality described on this reference page is aligned with the
ISO C standard. Any conflict between the requirements described here and the
ISO C standard is unintentional. This volume of POSIX.1-2008 defers to the ISO C standard.
function shall restore the environment saved by the most recent
in the same process, with the corresponding
argument. If the most recent invocation of
with the corresponding
occurred in another thread, or if there is no such invocation, or if
the function containing the invocation of
has terminated execution in the interim, or if the invocation of
was within the scope of an identifier with variably modified type and
execution has left that scope in the interim, the behavior is undefined.
It is unspecified whether
restores the signal mask, leaves the signal mask unchanged, or restores
it to its value at the time
All accessible objects have values, and all other components of the
abstract machine have state (for example, floating-point status flags
and open files), as of the time
was called, except that the values of objects of automatic storage
duration are unspecified if they meet all the following conditions:
They are local to the function containing the corresponding
They do not have volatile-qualified type.
They are changed between the
As it bypasses the usual function call and return mechanisms,
shall execute correctly in contexts of interrupts, signals, and any
of their associated functions. However, if
is invoked from a nested signal handler (that is, from a function
invoked as a result of a signal raised during the handling of another
signal), the behavior is undefined.
The effect of a call to
where initialization of the
structure was not performed in the calling thread is undefined.
is completed, program execution continues as if the corresponding
had just returned the value specified by
function shall not cause
to return 0; if
shall return 1.
No errors are defined.
The following sections are informative.
Applications whose behavior depends on the value of the signal mask
should not use
since their effect on the signal mask is unspecified, but should
instead use the
functions (which can save and restore the signal mask under application
The Base Definitions volume of POSIX.1-2008,
Portions of this text are reprinted and reproduced in electronic form
from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
-- Portable Operating System Interface (POSIX), The Open Group Base
Specifications Issue 7, Copyright (C) 2013 by the Institute of
Electrical and Electronics Engineers, Inc and The Open Group.
(This is POSIX.1-2008 with the 2013 Technical Corrigendum 1 applied.) In the
event of any discrepancy between this version and the original IEEE and
The Open Group Standard, the original IEEE and The Open Group Standard
is the referee document. The original Standard can be obtained online at
Any typographical or formatting errors that appear
in this page are most likely
to have been introduced during the conversion of the source files to
man page format. To report such errors, see