1STRERROR(P) POSIX Programmer's Manual STRERROR(P)
2
3
4
6 strerror, strerror_r - get error message string
7
9 #include <string.h>
10
11 char *strerror(int errnum);
12
13
14 int strerror_r(int errnum, char *strerrbuf, size_t buflen);
15
16
18 For strerror(): The functionality described on this reference page is
19 aligned with the ISO C standard. Any conflict between the requirements
20 described here and the ISO C standard is unintentional. This volume of
21 IEEE Std 1003.1-2001 defers to the ISO C standard.
22
23 The strerror() function shall map the error number in errnum to a
24 locale-dependent error message string and shall return a pointer to it.
25 Typically, the values for errnum come from errno, but strerror() shall
26 map any value of type int to a message.
27
28 The string pointed to shall not be modified by the application, but may
29 be overwritten by a subsequent call to strerror() or perror().
30
31 The contents of the error message strings returned by strerror() should
32 be determined by the setting of the LC_MESSAGES category in the current
33 locale.
34
35 The implementation shall behave as if no function defined in this vol‐
36 ume of IEEE Std 1003.1-2001 calls strerror().
37
38 The strerror() function shall not change the setting of errno if suc‐
39 cessful.
40
41 Since no return value is reserved to indicate an error, an application
42 wishing to check for error situations should set errno to 0, then call
43 strerror(), then check errno.
44
45 The strerror() function need not be reentrant. A function that is not
46 required to be reentrant is not required to be thread-safe.
47
48 The strerror_r() function shall map the error number in errnum to a
49 locale-dependent error message string and shall return the string in
50 the buffer pointed to by strerrbuf, with length buflen.
51
53 Upon successful completion, strerror() shall return a pointer to the
54 generated message string. On error errno may be set, but no return
55 value is reserved to indicate an error.
56
57 Upon successful completion, strerror_r() shall return 0. Otherwise, an
58 error number shall be returned to indicate the error.
59
61 These functions may fail if:
62
63 EINVAL The value of errnum is not a valid error number.
64
65
66 The strerror_r() function may fail if:
67
68 ERANGE Insufficient storage was supplied via strerrbuf and buflen to
69 contain the generated message string.
70
71
72 The following sections are informative.
73
75 None.
76
78 None.
79
81 None.
82
84 None.
85
87 perror() , the Base Definitions volume of IEEE Std 1003.1-2001,
88 <string.h>
89
91 Portions of this text are reprinted and reproduced in electronic form
92 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
93 -- Portable Operating System Interface (POSIX), The Open Group Base
94 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
95 Electrical and Electronics Engineers, Inc and The Open Group. In the
96 event of any discrepancy between this version and the original IEEE and
97 The Open Group Standard, the original IEEE and The Open Group Standard
98 is the referee document. The original Standard can be obtained online
99 at http://www.opengroup.org/unix/online.html .
100
101
102
103IEEE/The Open Group 2003 STRERROR(P)