logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

longjmp.3p (5169B)


  1. '\" et
  2. .TH LONGJMP "3P" 2017 "IEEE/The Open Group" "POSIX Programmer's Manual"
  3. .\"
  4. .SH PROLOG
  5. This manual page is part of the POSIX Programmer's Manual.
  6. The Linux implementation of this interface may differ (consult
  7. the corresponding Linux manual page for details of Linux behavior),
  8. or the interface may not be implemented on Linux.
  9. .\"
  10. .SH NAME
  11. longjmp
  12. \(em non-local goto
  13. .SH SYNOPSIS
  14. .LP
  15. .nf
  16. #include <setjmp.h>
  17. .P
  18. void longjmp(jmp_buf \fIenv\fP, int \fIval\fP);
  19. .fi
  20. .SH DESCRIPTION
  21. The functionality described on this reference page is aligned with the
  22. ISO\ C standard. Any conflict between the requirements described here and the
  23. ISO\ C standard is unintentional. This volume of POSIX.1\(hy2017 defers to the ISO\ C standard.
  24. .P
  25. The
  26. \fIlongjmp\fR()
  27. function shall restore the environment saved by the most recent
  28. invocation of
  29. \fIsetjmp\fR()
  30. in the same process, with the corresponding
  31. .BR jmp_buf
  32. argument. If the most recent invocation of
  33. \fIsetjmp\fR()
  34. with the corresponding
  35. .BR jmp_buf
  36. occurred in another thread, or if there is no such invocation, or if
  37. the function containing the invocation of
  38. \fIsetjmp\fR()
  39. has terminated execution in the interim, or if the invocation of
  40. \fIsetjmp\fR()
  41. was within the scope of an identifier with variably modified type and
  42. execution has left that scope in the interim, the behavior is undefined.
  43. It is unspecified whether
  44. \fIlongjmp\fR()
  45. restores the signal mask, leaves the signal mask unchanged, or restores
  46. it to its value at the time
  47. \fIsetjmp\fR()
  48. was called.
  49. .P
  50. All accessible objects have values, and all other components of the
  51. abstract machine have state (for example, floating-point status flags
  52. and open files), as of the time
  53. \fIlongjmp\fR()
  54. was called, except that the values of objects of automatic storage
  55. duration are unspecified if they meet all the following conditions:
  56. .IP " *" 4
  57. They are local to the function containing the corresponding
  58. \fIsetjmp\fR()
  59. invocation.
  60. .IP " *" 4
  61. They do not have volatile-qualified type.
  62. .IP " *" 4
  63. They are changed between the
  64. \fIsetjmp\fR()
  65. invocation and
  66. \fIlongjmp\fR()
  67. call.
  68. .P
  69. Although
  70. \fIlongjmp\fR()
  71. is an async-signal-safe function, if it is invoked from a signal
  72. handler which interrupted a non-async-signal-safe function or
  73. equivalent (such as the processing equivalent to
  74. \fIexit\fR()
  75. performed after a return from the initial call to
  76. \fImain\fR()),
  77. the behavior of any subsequent call to a non-async-signal-safe
  78. function or equivalent is undefined.
  79. .P
  80. The effect of a call to
  81. \fIlongjmp\fR()
  82. where initialization of the
  83. .BR jmp_buf
  84. structure was not performed in the calling thread is undefined.
  85. .SH "RETURN VALUE"
  86. After
  87. \fIlongjmp\fR()
  88. is completed, program execution continues as if the corresponding
  89. invocation of
  90. \fIsetjmp\fR()
  91. had just returned the value specified by
  92. .IR val .
  93. The
  94. \fIlongjmp\fR()
  95. function shall not cause
  96. \fIsetjmp\fR()
  97. to return 0; if
  98. .IR val
  99. is 0,
  100. \fIsetjmp\fR()
  101. shall return 1.
  102. .SH ERRORS
  103. No errors are defined.
  104. .LP
  105. .IR "The following sections are informative."
  106. .SH EXAMPLES
  107. None.
  108. .SH "APPLICATION USAGE"
  109. Applications whose behavior depends on the value of the signal mask
  110. should not use
  111. \fIlongjmp\fR()
  112. and
  113. \fIsetjmp\fR(),
  114. since their effect on the signal mask is unspecified, but should
  115. instead use the
  116. \fIsiglongjmp\fR()
  117. and
  118. \fIsigsetjmp\fR()
  119. functions (which can save and restore the signal mask under application
  120. control).
  121. .P
  122. It is recommended that applications do not call
  123. \fIlongjmp\fR()
  124. or
  125. \fIsiglongjmp\fR()
  126. from signal handlers. To avoid undefined behavior when calling these
  127. functions from a signal handler, the application needs to ensure one
  128. of the following two things:
  129. .IP " 1." 4
  130. After the call to
  131. \fIlongjmp\fR()
  132. or
  133. \fIsiglongjmp\fR()
  134. the process only calls async-signal-safe functions and does not return
  135. from the initial call to
  136. \fImain\fR().
  137. .IP " 2." 4
  138. Any signal whose handler calls
  139. \fIlongjmp\fR()
  140. or
  141. \fIsiglongjmp\fR()
  142. is blocked during
  143. .IR every
  144. call to a non-async-signal-safe function, and no such calls are made
  145. after returning from the initial call to
  146. \fImain\fR().
  147. .SH RATIONALE
  148. None.
  149. .SH "FUTURE DIRECTIONS"
  150. None.
  151. .SH "SEE ALSO"
  152. .IR "\fIsetjmp\fR\^(\|)",
  153. .IR "\fIsigaction\fR\^(\|)",
  154. .IR "\fIsiglongjmp\fR\^(\|)",
  155. .IR "\fIsigsetjmp\fR\^(\|)"
  156. .P
  157. The Base Definitions volume of POSIX.1\(hy2017,
  158. .IR "\fB<setjmp.h>\fP"
  159. .\"
  160. .SH COPYRIGHT
  161. Portions of this text are reprinted and reproduced in electronic form
  162. from IEEE Std 1003.1-2017, Standard for Information Technology
  163. -- Portable Operating System Interface (POSIX), The Open Group Base
  164. Specifications Issue 7, 2018 Edition,
  165. Copyright (C) 2018 by the Institute of
  166. Electrical and Electronics Engineers, Inc and The Open Group.
  167. In the event of any discrepancy between this version and the original IEEE and
  168. The Open Group Standard, the original IEEE and The Open Group Standard
  169. is the referee document. The original Standard can be obtained online at
  170. http://www.opengroup.org/unix/online.html .
  171. .PP
  172. Any typographical or formatting errors that appear
  173. in this page are most likely
  174. to have been introduced during the conversion of the source files to
  175. man page format. To report such errors, see
  176. https://www.kernel.org/doc/man-pages/reporting_bugs.html .