1LONGJMP(3P)                POSIX Programmer's Manual               LONGJMP(3P)
2
3
4

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10

NAME

12       longjmp - non-local goto
13

SYNOPSIS

15       #include <setjmp.h>
16
17       void longjmp(jmp_buf env, int val);
18
19

DESCRIPTION

21       The longjmp() function shall restore the environment saved by the  most
22       recent  invocation of setjmp() in the same thread, with the correspond‐
23       ing jmp_buf argument. If there is no such invocation, or if  the  func‐
24       tion  containing the invocation of setjmp() has terminated execution in
25       the interim, or if the invocation of setjmp() was within the  scope  of
26       an  identifier  with variably modified type and execution has left that
27       scope in the interim, the behavior is undefined.    It  is  unspecified
28       whether  longjmp()  restores  the  signal  mask, leaves the signal mask
29       unchanged, or restores it to its value at the time setjmp() was called.
30
31       All accessible objects have values, and all  other  components  of  the
32       abstract  machine  have state (for example, floating-point status flags
33       and open files), as of the time longjmp() was called, except  that  the
34       values of objects of automatic storage duration are unspecified if they
35       meet all the following conditions:
36
37        * They are local to the function containing the corresponding setjmp()
38          invocation.
39
40        * They do not have volatile-qualified type.
41
42        * They are changed between the setjmp() invocation and longjmp() call.
43
44       As it bypasses the usual function call and return mechanisms, longjmp()
45       shall execute correctly in contexts of interrupts, signals, and any  of
46       their  associated  functions.  However,  if longjmp() is invoked from a
47       nested signal handler (that is, from a function invoked as a result  of
48       a signal raised during the handling of another signal), the behavior is
49       undefined.
50
51       The effect of a call to longjmp() where initialization of  the  jmp_buf
52       structure was not performed in the calling thread is undefined.
53

RETURN VALUE

55       After  longjmp()  is  completed,  program execution continues as if the
56       corresponding invocation of setjmp() had just returned the value speci‐
57       fied  by val. The longjmp() function shall not cause setjmp() to return
58       0; if val is 0, setjmp() shall return 1.
59

ERRORS

61       No errors are defined.
62
63       The following sections are informative.
64

EXAMPLES

66       None.
67

APPLICATION USAGE

69       Applications whose behavior depends on the value  of  the  signal  mask
70       should not use longjmp() and setjmp(), since their effect on the signal
71       mask is unspecified,  but  should  instead  use  the  siglongjmp()  and
72       sigsetjmp() functions (which can save and restore the signal mask under
73       application control).
74

RATIONALE

76       None.
77

FUTURE DIRECTIONS

79       None.
80

SEE ALSO

82       setjmp(), sigaction(), siglongjmp(), sigsetjmp(), the Base  Definitions
83       volume of IEEE Std 1003.1-2001, <setjmp.h>
84
86       Portions  of  this text are reprinted and reproduced in electronic form
87       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
88       --  Portable  Operating  System  Interface (POSIX), The Open Group Base
89       Specifications Issue 6, Copyright (C) 2001-2003  by  the  Institute  of
90       Electrical  and  Electronics  Engineers, Inc and The Open Group. In the
91       event of any discrepancy between this version and the original IEEE and
92       The  Open Group Standard, the original IEEE and The Open Group Standard
93       is the referee document. The original Standard can be  obtained  online
94       at http://www.opengroup.org/unix/online.html .
95
96
97
98IEEE/The Open Group                  2003                          LONGJMP(3P)
Impressum