]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/strerror.3
Import of man-pages 1.70
[thirdparty/man-pages.git] / man3 / strerror.3
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 );
42 .br
43 .BI "int strerror_r(int " errnum ", char *" buf ", size_t " n );
44 .fi
45 .SH DESCRIPTION
46 The \fBstrerror()\fP function returns a string describing the error
47 code passed in the argument \fIerrnum\fP, possibly using the LC_MESSAGES
48 part of the current locale to select the appropriate language.
49 This string must not be modified by the application, but may be
50 modified by a subsequent call to \fBperror()\fP or \fBstrerror()\fP.
51 No library function will modify this string.
52
53 The \fBstrerror_r()\fP function is similar to \fBstrerror()\fP, but is
54 thread safe. It returns the string in the user-supplied buffer
55 .I buf
56 of length
57 .IR n .
58
59 .SH "RETURN VALUE"
60 The \fBstrerror()\fP function returns the appropriate error description
61 string, or an unknown error message if the error code is unknown.
62 The value of \fIerrno\fP is not changed for a successful call, and is
63 set to a nonzero value upon error.
64 The \fBstrerror_r()\fP function returns 0 on success and \-1 on failure,
65 setting \fIerrno\fP.
66
67 .SH ERRORS
68 .TP
69 .B EINVAL
70 The value of
71 .I errnum
72 is not a valid error number.
73 .TP
74 .B ERANGE
75 Insufficient storage was supplied to contain the error description string.
76
77 .SH "CONFORMING TO"
78 SVID 3, POSIX, BSD 4.3, ISO/IEC 9899:1990 (C89).
79 .br
80 .BR strerror_r()
81 with prototype as given above is specified by SUSv3, and was in use
82 under Digital Unix and HP Unix. An incompatible function, with prototype
83 .sp
84 .BI "char *strerror_r(int " errnum ", char *" buf ", size_t " n );
85 .sp
86 is a GNU extension used by glibc (since 2.0),
87 and must be regarded as obsolete in view of SUSv3.
88 The GNU version may, but need not, use the user-supplied buffer.
89 If it does, the result may be truncated in case the supplied buffer
90 is too small. The result is always NUL-terminated.
91 .SH "SEE ALSO"
92 .BR errno (3),
93 .BR perror (3),
94 .BR strsignal (3)