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