~ubuntu-branches/ubuntu/precise/manpages-posix/precise

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
.\" 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 .