178 lines
7.3 KiB
HTML
178 lines
7.3 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<html>
|
|
<head>
|
|
<meta name="generator" content="HTML Tidy, see www.w3.org">
|
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
|
<link type="text/css" rel="stylesheet" href="style.css"><!-- Generated by The Open Group's rhtm tool v1.2.1 -->
|
|
<!-- Copyright (c) 2001 The Open Group, All Rights Reserved -->
|
|
<title>longjmp</title>
|
|
</head>
|
|
<body bgcolor="white">
|
|
<script type="text/javascript" language="JavaScript" src="../jscript/codes.js">
|
|
</script>
|
|
|
|
<basefont size="3"> <a name="longjmp"></a> <a name="tag_03_349"></a><!-- longjmp -->
|
|
<!--header start-->
|
|
<center><font size="2">The Open Group Base Specifications Issue 6<br>
|
|
IEEE Std 1003.1-2001<br>
|
|
Copyright © 2001 The IEEE and The Open Group, All Rights reserved.</font></center>
|
|
|
|
<!--header end-->
|
|
<hr size="2" noshade>
|
|
<h4><a name="tag_03_349_01"></a>NAME</h4>
|
|
|
|
<blockquote>longjmp - non-local goto</blockquote>
|
|
|
|
<h4><a name="tag_03_349_02"></a>SYNOPSIS</h4>
|
|
|
|
<blockquote class="synopsis">
|
|
<p><code><tt>#include <<a href="../basedefs/setjmp.h.html">setjmp.h</a>><br>
|
|
<br>
|
|
void longjmp(jmp_buf</tt> <i>env</i><tt>, int</tt> <i>val</i><tt>);<br>
|
|
</tt></code></p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_349_03"></a>DESCRIPTION</h4>
|
|
|
|
<blockquote>
|
|
<div class="box"><sup>[<a href="javascript:open_code('CX')">CX</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]"
|
|
border="0"> 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 IEEE Std 1003.1-2001 defers to
|
|
the ISO C standard. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></div>
|
|
|
|
<p>The <i>longjmp</i>() function shall restore the environment saved by the most recent invocation of <a href=
|
|
"../functions/setjmp.html"><i>setjmp</i>()</a> in the same thread, with the corresponding <b>jmp_buf</b> argument. If there is no
|
|
such invocation, or if the function containing the invocation of <a href="../functions/setjmp.html"><i>setjmp</i>()</a> has
|
|
terminated execution in the interim, or if the invocation of <a href="../functions/setjmp.html"><i>setjmp</i>()</a> was within the
|
|
scope of an identifier with variably modified type and execution has left that scope in the interim, the behavior is undefined.
|
|
<sup>[<a href="javascript:open_code('CX')">CX</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
|
|
It is unspecified whether <i>longjmp</i>() restores the signal mask, leaves the signal mask unchanged, or restores it to its
|
|
value at the time <a href="../functions/setjmp.html"><i>setjmp</i>()</a> was called. <img src="../images/opt-end.gif" alt=
|
|
"[Option End]" border="0"></p>
|
|
|
|
<p>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 <i>longjmp</i>() was called, except that the values of objects of automatic storage
|
|
duration are unspecified if they meet all the following conditions:</p>
|
|
|
|
<ul>
|
|
<li>
|
|
<p>They are local to the function containing the corresponding <a href="../functions/setjmp.html"><i>setjmp</i>()</a>
|
|
invocation.</p>
|
|
</li>
|
|
|
|
<li>
|
|
<p>They do not have volatile-qualified type.</p>
|
|
</li>
|
|
|
|
<li>
|
|
<p>They are changed between the <a href="../functions/setjmp.html"><i>setjmp</i>()</a> invocation and <i>longjmp</i>() call.</p>
|
|
</li>
|
|
</ul>
|
|
|
|
<p><sup>[<a href="javascript:open_code('CX')">CX</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> As
|
|
it bypasses the usual function call and return mechanisms, <i>longjmp</i>() shall execute correctly in contexts of interrupts,
|
|
signals, and any of their associated functions. However, if <i>longjmp</i>() 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.</p>
|
|
|
|
<p>The effect of a call to <i>longjmp</i>() where initialization of the <b>jmp_buf</b> structure was not performed in the calling
|
|
thread is undefined. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_349_04"></a>RETURN VALUE</h4>
|
|
|
|
<blockquote>
|
|
<p>After <i>longjmp</i>() is completed, program execution continues as if the corresponding invocation of <a href=
|
|
"../functions/setjmp.html"><i>setjmp</i>()</a> had just returned the value specified by <i>val</i>. The <i>longjmp</i>() function
|
|
shall not cause <a href="../functions/setjmp.html"><i>setjmp</i>()</a> to return 0; if <i>val</i> is 0, <a href=
|
|
"../functions/setjmp.html"><i>setjmp</i>()</a> shall return 1.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_349_05"></a>ERRORS</h4>
|
|
|
|
<blockquote>
|
|
<p>No errors are defined.</p>
|
|
</blockquote>
|
|
|
|
<hr>
|
|
<div class="box"><em>The following sections are informative.</em></div>
|
|
|
|
<h4><a name="tag_03_349_06"></a>EXAMPLES</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_349_07"></a>APPLICATION USAGE</h4>
|
|
|
|
<blockquote>
|
|
<p>Applications whose behavior depends on the value of the signal mask should not use <i>longjmp</i>() and <a href=
|
|
"../functions/setjmp.html"><i>setjmp</i>()</a>, since their effect on the signal mask is unspecified, but should instead use the <a
|
|
href="../functions/siglongjmp.html"><i>siglongjmp</i>()</a> and <a href="../functions/sigsetjmp.html"><i>sigsetjmp</i>()</a>
|
|
functions (which can save and restore the signal mask under application control).</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_349_08"></a>RATIONALE</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_349_09"></a>FUTURE DIRECTIONS</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_349_10"></a>SEE ALSO</h4>
|
|
|
|
<blockquote>
|
|
<p><a href="setjmp.html"><i>setjmp</i>()</a> , <a href="sigaction.html"><i>sigaction</i>()</a> , <a href=
|
|
"siglongjmp.html"><i>siglongjmp</i>()</a> , <a href="sigsetjmp.html"><i>sigsetjmp</i>()</a> , the Base Definitions volume of
|
|
IEEE Std 1003.1-2001, <a href="../basedefs/setjmp.h.html"><i><setjmp.h></i></a></p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_349_11"></a>CHANGE HISTORY</h4>
|
|
|
|
<blockquote>
|
|
<p>First released in Issue 1. Derived from Issue 1 of the SVID.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_349_12"></a>Issue 5</h4>
|
|
|
|
<blockquote>
|
|
<p>The DESCRIPTION is updated for alignment with the POSIX Threads Extension.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_349_13"></a>Issue 6</h4>
|
|
|
|
<blockquote>
|
|
<p>Extensions beyond the ISO C standard are marked.</p>
|
|
|
|
<p>The following new requirements on POSIX implementations derive from alignment with the Single UNIX Specification:</p>
|
|
|
|
<ul>
|
|
<li>
|
|
<p>The DESCRIPTION now explicitly makes <i>longjmp</i>()'s effect on the signal mask unspecified.</p>
|
|
</li>
|
|
</ul>
|
|
|
|
<p>The DESCRIPTION is updated for alignment with the ISO/IEC 9899:1999 standard.</p>
|
|
</blockquote>
|
|
|
|
<div class="box"><em>End of informative text.</em></div>
|
|
|
|
<hr>
|
|
<hr size="2" noshade>
|
|
<center><font size="2"><!--footer start-->
|
|
UNIX ® is a registered Trademark of The Open Group.<br>
|
|
POSIX ® is a registered Trademark of The IEEE.<br>
|
|
[ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href=
|
|
"../utilities/contents.html">XCU</a> | <a href="../functions/contents.html">XSH</a> | <a href="../xrat/contents.html">XRAT</a>
|
|
]</font></center>
|
|
|
|
<!--footer end-->
|
|
<hr size="2" noshade>
|
|
</body>
|
|
</html>
|
|
|