Files
oldlinux-files/Ref-docs/POSIX/susv3/functions/errno.html
2024-02-19 00:21:47 -05:00

151 lines
5.0 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>errno</title>
</head>
<body bgcolor="white">
<basefont size="3"> <a name="errno"></a> <a name="tag_03_129"></a><!-- errno -->
<!--header start-->
<center><font size="2">The Open Group Base Specifications Issue 6<br>
IEEE Std 1003.1-2001<br>
Copyright &copy; 2001 The IEEE and The Open Group, All Rights reserved.</font></center>
<!--header end-->
<hr size="2" noshade>
<h4><a name="tag_03_129_01"></a>NAME</h4>
<blockquote>errno - error return value</blockquote>
<h4><a name="tag_03_129_02"></a>SYNOPSIS</h4>
<blockquote class="synopsis">
<p><code><tt>#include &lt;errno.h&gt;</tt></code></p>
</blockquote>
<h4><a name="tag_03_129_03"></a>DESCRIPTION</h4>
<blockquote>
<p>The lvalue <i>errno</i> is used by many functions to return error values.</p>
<p>Many functions provide an error number in <i>errno</i>, which has type <b>int</b> and is defined in <a href=
"../basedefs/errno.h.html"><i>&lt;errno.h&gt;</i></a>. The value of <i>errno</i> shall be defined only after a call to a function
for which it is explicitly stated to be set and until it is changed by the next function call or if the application assigns it a
value. The value of <i>errno</i> should only be examined when it is indicated to be valid by a function's return value.
Applications shall obtain the definition of <i>errno</i> by the inclusion of <a href=
"../basedefs/errno.h.html"><i>&lt;errno.h&gt;</i></a>. No function in this volume of IEEE&nbsp;Std&nbsp;1003.1-2001 shall set
<i>errno</i> to 0.</p>
<p>It is unspecified whether <i>errno</i> is a macro or an identifier declared with external linkage. If a macro definition is
suppressed in order to access an actual object, or a program defines an identifier with the name <i>errno</i>, the behavior is
undefined.</p>
<p>The symbolic values stored in <i>errno</i> are documented in the ERRORS sections on all relevant pages.</p>
</blockquote>
<h4><a name="tag_03_129_04"></a>RETURN VALUE</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_03_129_05"></a>ERRORS</h4>
<blockquote>
<p>None.</p>
</blockquote>
<hr>
<div class="box"><em>The following sections are informative.</em></div>
<h4><a name="tag_03_129_06"></a>EXAMPLES</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_03_129_07"></a>APPLICATION USAGE</h4>
<blockquote>
<p>Previously both POSIX and X/Open documents were more restrictive than the ISO&nbsp;C standard in that they required <i>errno</i>
to be defined as an external variable, whereas the ISO&nbsp;C standard required only that <i>errno</i> be defined as a modifiable
lvalue with type <b>int</b>.</p>
<p>An application that needs to examine the value of <i>errno</i> to determine the error should set it to 0 before a function call,
then inspect it before a subsequent function call.</p>
</blockquote>
<h4><a name="tag_03_129_08"></a>RATIONALE</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_03_129_09"></a>FUTURE DIRECTIONS</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_03_129_10"></a>SEE ALSO</h4>
<blockquote>
<p><a href="xsh_chap02_03.html#tag_02_03"><i>Error Numbers</i></a> , the Base Definitions volume of IEEE&nbsp;Std&nbsp;1003.1-2001,
<a href="../basedefs/errno.h.html"><i>&lt;errno.h&gt;</i></a></p>
</blockquote>
<h4><a name="tag_03_129_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_129_12"></a>Issue 5</h4>
<blockquote>
<p>The following sentence is deleted from the DESCRIPTION: &quot;The value of <i>errno</i> is 0 at program start-up, but is never set
to 0 by any XSI function&quot;. The DESCRIPTION also no longer states that conforming implementations may support the declaration:</p>
<pre>
<tt>extern int errno;
</tt>
</pre>
</blockquote>
<h4><a name="tag_03_129_13"></a>Issue 6</h4>
<blockquote>
<p>Obsolescent text regarding defining <i>errno</i> as:</p>
<pre>
<tt>extern int errno
</tt>
</pre>
<p>is removed.</p>
<p>Text regarding no function setting <i>errno</i> to zero to indicate an error is changed to no function shall set <i>errno</i> to
zero. This is for alignment with the ISO/IEC&nbsp;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 &reg; is a registered Trademark of The Open Group.<br>
POSIX &reg; 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>