202 lines
7.8 KiB
HTML
202 lines
7.8 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>strerror</title>
|
|
</head>
|
|
<body bgcolor="white">
|
|
<script type="text/javascript" language="JavaScript" src="../jscript/codes.js">
|
|
</script>
|
|
|
|
<basefont size="3"> <a name="strerror"></a> <a name="tag_03_727"></a><!-- strerror -->
|
|
<!--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_727_01"></a>NAME</h4>
|
|
|
|
<blockquote>strerror, strerror_r - get error message string</blockquote>
|
|
|
|
<h4><a name="tag_03_727_02"></a>SYNOPSIS</h4>
|
|
|
|
<blockquote class="synopsis">
|
|
<p><code><tt>#include <<a href="../basedefs/string.h.html">string.h</a>><br>
|
|
<br>
|
|
char *strerror(int</tt> <i>errnum</i><tt>);<br>
|
|
</tt></code></p>
|
|
|
|
<div class="box"><code><tt><sup>[<a href="javascript:open_code('TSF')">TSF</a>]</sup> <img src="../images/opt-start.gif" alt=
|
|
"[Option Start]" border="0"> int strerror_r(int</tt> <i>errnum</i><tt>, char *</tt><i>strerrbuf</i><tt>, size_t</tt>
|
|
<i>buflen</i><tt>); <img src="../images/opt-end.gif" alt="[Option End]" border="0"></tt></code></div>
|
|
|
|
<tt><br>
|
|
</tt></blockquote>
|
|
|
|
<h4><a name="tag_03_727_03"></a>DESCRIPTION</h4>
|
|
|
|
<blockquote>
|
|
<p>For <i>strerror</i>(): <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"></p>
|
|
|
|
<p>The <i>strerror</i>() function shall map the error number in <i>errnum</i> to a locale-dependent error message string and shall
|
|
return a pointer to it. Typically, the values for <i>errnum</i> come from <i>errno</i>, but <i>strerror</i>() shall map any value
|
|
of type <b>int</b> to a message.</p>
|
|
|
|
<p>The string pointed to shall not be modified by the application, but may be overwritten by a subsequent call to <i>strerror</i>()
|
|
<sup>[<a href="javascript:open_code('CX')">CX</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
|
|
or <a href="../functions/perror.html"><i>perror</i>()</a>. <img src="../images/opt-end.gif" alt="[Option End]" border=
|
|
"0"></p>
|
|
|
|
<p><sup>[<a href="javascript:open_code('CX')">CX</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> The
|
|
contents of the error message strings returned by <i>strerror</i>() should be determined by the setting of the <i>LC_MESSAGES</i>
|
|
category in the current locale. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></p>
|
|
|
|
<p>The implementation shall behave as if no function defined in this volume of IEEE Std 1003.1-2001 calls
|
|
<i>strerror</i>().</p>
|
|
|
|
<p><sup>[<a href="javascript:open_code('CX')">CX</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> The
|
|
<i>strerror</i>() function shall not change the setting of <i>errno</i> if successful.</p>
|
|
|
|
<p>Since no return value is reserved to indicate an error, an application wishing to check for error situations should set
|
|
<i>errno</i> to 0, then call <i>strerror</i>(), then check <i>errno</i>.</p>
|
|
|
|
<p>The <i>strerror</i>() function need not be reentrant. A function that is not required to be reentrant is not required to be
|
|
thread-safe. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></p>
|
|
|
|
<p><sup>[<a href="javascript:open_code('TSF')">TSF</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
|
|
The <i>strerror_r</i>() function shall map the error number in <i>errnum</i> to a locale-dependent error message string and shall
|
|
return the string in the buffer pointed to by <i>strerrbuf</i>, with length <i>buflen</i>. <img src="../images/opt-end.gif" alt=
|
|
"[Option End]" border="0"></p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_727_04"></a>RETURN VALUE</h4>
|
|
|
|
<blockquote>
|
|
<p>Upon successful completion, <i>strerror</i>() shall return a pointer to the generated message string. On error <i>errno</i> may
|
|
be set, but no return value is reserved to indicate an error.</p>
|
|
|
|
<p><sup>[<a href="javascript:open_code('TSF')">TSF</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
|
|
Upon successful completion, <i>strerror_r</i>() shall return 0. Otherwise, an error number shall be returned to indicate the error.
|
|
<img src="../images/opt-end.gif" alt="[Option End]" border="0"></p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_727_05"></a>ERRORS</h4>
|
|
|
|
<blockquote>
|
|
<p>These functions may fail if:</p>
|
|
|
|
<dl compact>
|
|
<dt>[EINVAL]</dt>
|
|
|
|
<dd>The value of <i>errnum</i> is not a valid error number.</dd>
|
|
</dl>
|
|
|
|
<p>The <i>strerror_r</i>() function may fail if:</p>
|
|
|
|
<dl compact>
|
|
<dt>[ERANGE]</dt>
|
|
|
|
<dd><sup>[<a href="javascript:open_code('TSF')">TSF</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
|
|
Insufficient storage was supplied via <i>strerrbuf</i> and <i>buflen</i> to contain the generated message string. <img src=
|
|
"../images/opt-end.gif" alt="[Option End]" border="0"></dd>
|
|
</dl>
|
|
</blockquote>
|
|
|
|
<hr>
|
|
<div class="box"><em>The following sections are informative.</em></div>
|
|
|
|
<h4><a name="tag_03_727_06"></a>EXAMPLES</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_727_07"></a>APPLICATION USAGE</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_727_08"></a>RATIONALE</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_727_09"></a>FUTURE DIRECTIONS</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_727_10"></a>SEE ALSO</h4>
|
|
|
|
<blockquote>
|
|
<p><a href="perror.html"><i>perror</i>()</a> , the Base Definitions volume of IEEE Std 1003.1-2001, <a href=
|
|
"../basedefs/string.h.html"><i><string.h></i></a></p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_727_11"></a>CHANGE HISTORY</h4>
|
|
|
|
<blockquote>
|
|
<p>First released in Issue 3.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_727_12"></a>Issue 5</h4>
|
|
|
|
<blockquote>
|
|
<p>The DESCRIPTION is updated to indicate that <i>errno</i> is not changed if the function is successful.</p>
|
|
|
|
<p>A note indicating that this function need not be reentrant is added to the DESCRIPTION.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_727_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>In the RETURN VALUE section, the fact that <i>errno</i> may be set is added.</p>
|
|
</li>
|
|
|
|
<li>
|
|
<p>The [EINVAL] optional error condition is added.</p>
|
|
</li>
|
|
</ul>
|
|
|
|
<p>The DESCRIPTION is updated to avoid use of the term "must" for application requirements.</p>
|
|
|
|
<p>The <i>strerror_r</i>() function is added in response to IEEE PASC Interpretation 1003.1c #39.</p>
|
|
|
|
<p>The <i>strerror_r</i>() function is marked as part of the Thread-Safe Functions option.</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>
|
|
|