Manual Page Result
0
Command: strerror | Section: 3 | Source: OpenBSD | File: strerror.3
STRERROR(3) FreeBSD Library Functions Manual STRERROR(3)
NAME
strerror, strerror_l, strerror_r - get error message string
SYNOPSIS
#include <string.h>
char *
strerror(int errnum);
char *
strerror_l(int errnum, locale_t locale);
int
strerror_r(int errnum, char *strerrbuf, size_t buflen);
DESCRIPTION
These functions map the error number errnum to an error message string.
strerror() and strerror_l() return a string containing a maximum of
NL_TEXTMAX characters, including the trailing NUL. This string is not to
be modified by the calling program. The string returned by strerror()
may be overwritten by subsequent calls to strerror() in any thread. The
string returned by strerror_l() may be overwritten by subsequent calls to
strerror_l() in the same thread.
strerror_r() is a thread safe version of strerror() that places the error
message in the specified buffer strerrbuf.
On OpenBSD, the global locale, the thread-specific locale, and the locale
argument are ignored.
RETURN VALUES
strerror() and strerror_l() return a pointer to the error message string.
If an error occurs, the error code is stored in errno.
strerror_r() returns zero upon successful completion. If an error
occurs, the error code is stored in errno and the error code is returned.
ERRORS
All these functions may fail if:
[EINVAL] errnum is not a valid error number. The returned
error string will consist of an error message that
includes errnum.
strerror_r() may also fail if:
[ERANGE] The error message is larger than buflen characters.
The message will be truncated to fit.
SEE ALSO
intro(2), newlocale(3), perror(3), setlocale(3)
STANDARDS
The strerror() function conforms to ISO/IEC 9899:1999 ("ISO C99"). The
strerror_l() and strerror_r() functions conform to IEEE Std 1003.1-2008
("POSIX.1").
HISTORY
The strerror() function has been available since 4.3BSD-Reno,
strerror_r() since OpenBSD 3.3, and strerror_l() since OpenBSD 6.2.
CAVEATS
On systems other than OpenBSD, the LC_MESSAGES locale(1) category can
cause different strings to be returned instead of the normal error
messages; see CAVEATS in setlocale(3) for details.
FreeBSD 14.1-RELEASE-p8 May 16, 2019 FreeBSD 14.1-RELEASE-p8