mirror of https://github.com/mkerrisk/man-pages
114 lines
3.6 KiB
Plaintext
114 lines
3.6 KiB
Plaintext
.\" Copyright (c) 2001-2003 The Open Group, All Rights Reserved
|
|
.TH "STRERROR" P 2003 "IEEE/The Open Group" "POSIX Programmer's Manual"
|
|
.\" strerror
|
|
.SH NAME
|
|
strerror, strerror_r \- get error message string
|
|
.SH SYNOPSIS
|
|
.LP
|
|
\fB#include <string.h>
|
|
.br
|
|
.sp
|
|
char *strerror(int\fP \fIerrnum\fP\fB);
|
|
.br
|
|
\fP
|
|
.LP
|
|
\fBint strerror_r(int\fP \fIerrnum\fP\fB, char *\fP\fIstrerrbuf\fP\fB,
|
|
size_t\fP
|
|
\fIbuflen\fP\fB); \fP
|
|
\fB
|
|
.br
|
|
\fP
|
|
.SH DESCRIPTION
|
|
.LP
|
|
For \fIstrerror\fP(): 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.
|
|
.LP
|
|
The \fIstrerror\fP() function shall map the error number in \fIerrnum\fP
|
|
to a locale-dependent error message string and shall
|
|
return a pointer to it. Typically, the values for \fIerrnum\fP come
|
|
from \fIerrno\fP, but \fIstrerror\fP() shall map any value
|
|
of type \fBint\fP to a message.
|
|
.LP
|
|
The string pointed to shall not be modified by the application, but
|
|
may be overwritten by a subsequent call to \fIstrerror\fP()
|
|
\ or \fIperror\fP().
|
|
.LP
|
|
The
|
|
contents of the error message strings returned by \fIstrerror\fP()
|
|
should be determined by the setting of the \fILC_MESSAGES\fP
|
|
category in the current locale.
|
|
.LP
|
|
The implementation shall behave as if no function defined in this
|
|
volume of IEEE\ Std\ 1003.1-2001 calls
|
|
\fIstrerror\fP().
|
|
.LP
|
|
The
|
|
\fIstrerror\fP() function shall not change the setting of \fIerrno\fP
|
|
if successful.
|
|
.LP
|
|
Since no return value is reserved to indicate an error, an application
|
|
wishing to check for error situations should set
|
|
\fIerrno\fP to 0, then call \fIstrerror\fP(), then check \fIerrno\fP.
|
|
.LP
|
|
The \fIstrerror\fP() function need not be reentrant. A function that
|
|
is not required to be reentrant is not required to be
|
|
thread-safe.
|
|
.LP
|
|
The \fIstrerror_r\fP() function shall map the error number in \fIerrnum\fP
|
|
to a locale-dependent error message string and shall
|
|
return the string in the buffer pointed to by \fIstrerrbuf\fP, with
|
|
length \fIbuflen\fP.
|
|
.SH RETURN VALUE
|
|
.LP
|
|
Upon successful completion, \fIstrerror\fP() shall return a pointer
|
|
to the generated message string. On error \fIerrno\fP may
|
|
be set, but no return value is reserved to indicate an error.
|
|
.LP
|
|
Upon successful completion, \fIstrerror_r\fP() shall return 0. Otherwise,
|
|
an error number shall be returned to indicate the error.
|
|
.SH ERRORS
|
|
.LP
|
|
These functions may fail if:
|
|
.TP 7
|
|
.B EINVAL
|
|
The value of \fIerrnum\fP is not a valid error number.
|
|
.sp
|
|
.LP
|
|
The \fIstrerror_r\fP() function may fail if:
|
|
.TP 7
|
|
.B ERANGE
|
|
Insufficient storage was supplied via \fIstrerrbuf\fP and \fIbuflen\fP
|
|
to contain the generated message string.
|
|
.sp
|
|
.LP
|
|
\fIThe following sections are informative.\fP
|
|
.SH EXAMPLES
|
|
.LP
|
|
None.
|
|
.SH APPLICATION USAGE
|
|
.LP
|
|
None.
|
|
.SH RATIONALE
|
|
.LP
|
|
None.
|
|
.SH FUTURE DIRECTIONS
|
|
.LP
|
|
None.
|
|
.SH SEE ALSO
|
|
.LP
|
|
\fIperror\fP() , the Base Definitions volume of IEEE\ Std\ 1003.1-2001,
|
|
\fI<string.h>\fP
|
|
.SH COPYRIGHT
|
|
Portions of this text are reprinted and reproduced in electronic form
|
|
from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
|
|
-- Portable Operating System Interface (POSIX), The Open Group Base
|
|
Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
|
|
Electrical and Electronics Engineers, Inc and The Open Group. In the
|
|
event of any discrepancy between this version and the original IEEE and
|
|
The Open Group Standard, the original IEEE and The Open Group Standard
|
|
is the referee document. The original Standard can be obtained online at
|
|
http://www.opengroup.org/unix/online.html .
|