]>
Commit | Line | Data |
---|---|---|
fea681da MK |
1 | .\" Copyright (C) 1993 David Metcalfe (david@prism.demon.co.uk) |
2 | .\" | |
3 | .\" Permission is granted to make and distribute verbatim copies of this | |
4 | .\" manual provided the copyright notice and this permission notice are | |
5 | .\" preserved on all copies. | |
6 | .\" | |
7 | .\" Permission is granted to copy and distribute modified versions of this | |
8 | .\" manual under the conditions for verbatim copying, provided that the | |
9 | .\" entire resulting derived work is distributed under the terms of a | |
10 | .\" permission notice identical to this one. | |
11 | .\" | |
12 | .\" Since the Linux kernel and libraries are constantly changing, this | |
13 | .\" manual page may be incorrect or out-of-date. The author(s) assume no | |
14 | .\" responsibility for errors or omissions, or for damages resulting from | |
15 | .\" the use of the information contained herein. The author(s) may not | |
16 | .\" have taken the same level of care in the production of this manual, | |
17 | .\" which is licensed free of charge, as they might when working | |
18 | .\" professionally. | |
19 | .\" | |
20 | .\" Formatted or processed versions of this manual, if unaccompanied by | |
21 | .\" the source, must acknowledge the copyright and authors of this work. | |
22 | .\" | |
23 | .\" References consulted: | |
24 | .\" Linux libc source code | |
25 | .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991) | |
26 | .\" 386BSD man pages | |
27 | .\" Modified Sat Jul 24 18:05:30 1993 by Rik Faith <faith@cs.unc.edu> | |
28 | .\" Modified Fri Feb 16 14:25:17 1996 by Andries Brouwer <aeb@cwi.nl> | |
29 | .\" Modified Sun Jul 21 20:55:44 1996 by Andries Brouwer <aeb@cwi.nl> | |
30 | .\" Modified Mon Oct 15 21:16:25 2001 by John Levon <moz@compsoc.man.ac.uk> | |
31 | .\" Modified Tue Oct 16 00:04:43 2001 by Andries Brouwer <aeb@cwi.nl> | |
32 | .\" Modified Fri Jun 20 03:04:30 2003 by Andries Brouwer <aeb@cwi.nl> | |
33 | .\" | |
34 | .TH STRERROR 3 2001-10-16 "" "Linux Programmer's Manual" | |
35 | .SH NAME | |
36 | strerror, strerror_r \- return string describing error code | |
37 | .SH SYNOPSIS | |
38 | .nf | |
39 | .B #include <string.h> | |
40 | .sp | |
41 | .BI "char *strerror(int " errnum ); | |
b99cf1e0 MK |
42 | .sp |
43 | .B #define _XOPEN_SOURCE 600 | |
44 | .B #include <string.h> | |
45 | .sp | |
fea681da MK |
46 | .BI "int strerror_r(int " errnum ", char *" buf ", size_t " n ); |
47 | .fi | |
48 | .SH DESCRIPTION | |
49 | The \fBstrerror()\fP function returns a string describing the error | |
50 | code passed in the argument \fIerrnum\fP, possibly using the LC_MESSAGES | |
51 | part of the current locale to select the appropriate language. | |
52 | This string must not be modified by the application, but may be | |
53 | modified by a subsequent call to \fBperror()\fP or \fBstrerror()\fP. | |
54 | No library function will modify this string. | |
55 | ||
56 | The \fBstrerror_r()\fP function is similar to \fBstrerror()\fP, but is | |
57 | thread safe. It returns the string in the user-supplied buffer | |
58 | .I buf | |
59 | of length | |
60 | .IR n . | |
61 | ||
62 | .SH "RETURN VALUE" | |
63 | The \fBstrerror()\fP function returns the appropriate error description | |
64 | string, or an unknown error message if the error code is unknown. | |
65 | The value of \fIerrno\fP is not changed for a successful call, and is | |
f59a3f19 | 66 | set to a non-zero value upon error. |
fea681da MK |
67 | The \fBstrerror_r()\fP function returns 0 on success and \-1 on failure, |
68 | setting \fIerrno\fP. | |
69 | ||
70 | .SH ERRORS | |
71 | .TP | |
72 | .B EINVAL | |
73 | The value of | |
74 | .I errnum | |
75 | is not a valid error number. | |
76 | .TP | |
77 | .B ERANGE | |
78 | Insufficient storage was supplied to contain the error description string. | |
79 | ||
80 | .SH "CONFORMING TO" | |
b14d4aa5 | 81 | SVID 3, POSIX, 4.3BSD, ISO/IEC 9899:1990 (C89). |
fea681da MK |
82 | .br |
83 | .BR strerror_r() | |
84 | with prototype as given above is specified by SUSv3, and was in use | |
85 | under Digital Unix and HP Unix. An incompatible function, with prototype | |
86 | .sp | |
87 | .BI "char *strerror_r(int " errnum ", char *" buf ", size_t " n ); | |
88 | .sp | |
89 | is a GNU extension used by glibc (since 2.0), | |
90 | and must be regarded as obsolete in view of SUSv3. | |
91 | The GNU version may, but need not, use the user-supplied buffer. | |
92 | If it does, the result may be truncated in case the supplied buffer | |
93 | is too small. The result is always NUL-terminated. | |
94 | .SH "SEE ALSO" | |
95 | .BR errno (3), | |
96 | .BR perror (3), | |
97 | .BR strsignal (3) |