mirror of https://github.com/mkerrisk/man-pages
95 lines
3.6 KiB
Groff
95 lines
3.6 KiB
Groff
.\" Copyright (C) 1993 David Metcalfe (david@prism.demon.co.uk)
|
|
.\"
|
|
.\" Permission is granted to make and distribute verbatim copies of this
|
|
.\" manual provided the copyright notice and this permission notice are
|
|
.\" preserved on all copies.
|
|
.\"
|
|
.\" Permission is granted to copy and distribute modified versions of this
|
|
.\" manual under the conditions for verbatim copying, provided that the
|
|
.\" entire resulting derived work is distributed under the terms of a
|
|
.\" permission notice identical to this one.
|
|
.\"
|
|
.\" Since the Linux kernel and libraries are constantly changing, this
|
|
.\" manual page may be incorrect or out-of-date. The author(s) assume no
|
|
.\" responsibility for errors or omissions, or for damages resulting from
|
|
.\" the use of the information contained herein. The author(s) may not
|
|
.\" have taken the same level of care in the production of this manual,
|
|
.\" which is licensed free of charge, as they might when working
|
|
.\" professionally.
|
|
.\"
|
|
.\" Formatted or processed versions of this manual, if unaccompanied by
|
|
.\" the source, must acknowledge the copyright and authors of this work.
|
|
.\"
|
|
.\" References consulted:
|
|
.\" Linux libc source code
|
|
.\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
|
|
.\" 386BSD man pages
|
|
.\" Modified Sat Jul 24 18:05:30 1993 by Rik Faith <faith@cs.unc.edu>
|
|
.\" Modified Fri Feb 16 14:25:17 1996 by Andries Brouwer <aeb@cwi.nl>
|
|
.\" Modified Sun Jul 21 20:55:44 1996 by Andries Brouwer <aeb@cwi.nl>
|
|
.\" Modified Mon Oct 15 21:16:25 2001 by John Levon <moz@compsoc.man.ac.uk>
|
|
.\" Modified Tue Oct 16 00:04:43 2001 by Andries Brouwer <aeb@cwi.nl>
|
|
.\" Modified Fri Jun 20 03:04:30 2003 by Andries Brouwer <aeb@cwi.nl>
|
|
.\"
|
|
.TH STRERROR 3 2001-10-16 "" "Linux Programmer's Manual"
|
|
.SH NAME
|
|
strerror, strerror_r \- return string describing error code
|
|
.SH SYNOPSIS
|
|
.nf
|
|
.B #include <string.h>
|
|
.sp
|
|
.BI "char *strerror(int " errnum );
|
|
.br
|
|
.BI "int strerror_r(int " errnum ", char *" buf ", size_t " n );
|
|
.fi
|
|
.SH DESCRIPTION
|
|
The \fBstrerror()\fP function returns a string describing the error
|
|
code passed in the argument \fIerrnum\fP, possibly using the LC_MESSAGES
|
|
part of the current locale to select the appropriate language.
|
|
This string must not be modified by the application, but may be
|
|
modified by a subsequent call to \fBperror()\fP or \fBstrerror()\fP.
|
|
No library function will modify this string.
|
|
|
|
The \fBstrerror_r()\fP function is similar to \fBstrerror()\fP, but is
|
|
thread safe. It returns the string in the user-supplied buffer
|
|
.I buf
|
|
of length
|
|
.IR n .
|
|
|
|
.SH "RETURN VALUE"
|
|
The \fBstrerror()\fP function returns the appropriate error description
|
|
string, or an unknown error message if the error code is unknown.
|
|
The value of \fIerrno\fP is not changed for a successful call, and is
|
|
set to a nonzero value upon error.
|
|
The \fBstrerror_r()\fP function returns 0 on success and \-1 on failure,
|
|
setting \fIerrno\fP.
|
|
|
|
.SH ERRORS
|
|
.TP
|
|
.B EINVAL
|
|
The value of
|
|
.I errnum
|
|
is not a valid error number.
|
|
.TP
|
|
.B ERANGE
|
|
Insufficient storage was supplied to contain the error description string.
|
|
|
|
.SH "CONFORMING TO"
|
|
SVID 3, POSIX, BSD 4.3, ISO/IEC 9899:1990 (C89).
|
|
.br
|
|
.BR strerror_r()
|
|
with prototype as given above is specified by SUSv3, and was in use
|
|
under Digital Unix and HP Unix. An incompatible function, with prototype
|
|
.sp
|
|
.BI "char *strerror_r(int " errnum ", char *" buf ", size_t " n );
|
|
.sp
|
|
is a GNU extension used by glibc (since 2.0),
|
|
and must be regarded as obsolete in view of SUSv3.
|
|
The GNU version may, but need not, use the user-supplied buffer.
|
|
If it does, the result may be truncated in case the supplied buffer
|
|
is too small. The result is always NUL-terminated.
|
|
.SH "SEE ALSO"
|
|
.BR errno (3),
|
|
.BR perror (3),
|
|
.BR strsignal (3)
|