Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

strerror_r(3c) [opensolaris man page]

strerror(3C)						   Standard C Library Functions 					      strerror(3C)

NAME
strerror, strerror_r - get error message string SYNOPSIS
#include <string.h> char *strerror(int errnum); int strerror_r(int errnum, char *strerrbuf, size_t buflen); DESCRIPTION
The strerror() function maps the error number in errnum to an error message string, and returns a pointer to that string. It uses the same set of error messages as perror(3C). The returned string should not be overwritten. The strerror_r() function maps the error number in errnum to anerror message string and returns the string in the buffer pointed to by str- errbuf with length buflen. RETURN VALUES
Upon successful completion, strerror() returns a pointer to the generated message string. Otherwise, it sets errno and returns a pointer to an error message string. It returns the string "Unknown error" if errnum is not a valid error number. Upon successful completion, strerror_r() returns 0. Otherwise it sets errno and returns the value of errno to indicate the error. It returns the string "Unknown error" in the buffer pointed to by strerrbuf if errnum is not a valid error number. ERRORS
These functions may fail if: EINVAL The value of errnum is not a valid error number. The strerror_r() function may fail if: ERANGE The buflen argument specifies insufficient storage to contain the generated message string. USAGE
Messages returned from these functions are in the native language specified by the LC_MESSAGES locale category. See setlocale(3C). ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ |MT-Level |Safe | +-----------------------------+-----------------------------+ SEE ALSO
gettext(3C), perror(3C), setlocale(3C), attributes(5), standards(5) SunOS 5.11 31 Mar 2005 strerror(3C)

Check Out this Related Man Page

strerror(3)						     Library Functions Manual						       strerror(3)

NAME
strerror, strerror_r - Access message explaining function error LIBRARY
Standard C Library (libc.so, libc.a) SYNOPSIS
#include <string.h> char *strerror( int errnum); The following function does not conform to current standards and is supported only to maintain backward compatibility. int strerror_r( int errnum, char *strerrbuf, int buflen); STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: strerror(): XSH4.2 Refer to the standards(5) reference page for more information about industry standards and associated tags. PARAMETERS
Specifies an error-number value. [Tru64 UNIX] Specifies a buffer that will hold the error message. [Tru64 UNIX] Specifies the length of the buffer. DESCRIPTION
The strerror() function maps the error number specified by the errnum parameter to a error message string and returns a pointer to the string. The string pointed to by the return value is not modified by the program, but may be overwritten by a subsequent call to this function. The implementation behaves as though no other function calls the strerror() function. If a library message catalog is available for the current locale, the strerror() function stores the message from that catalog. Otherwise, it uses the default messages. The LC_MESSAGES category in the setlocale() call specifies the message catalog language, and the NLSPATH environment variable specifies the directory search path for message catalogs. The strerror_r() function is the reentrant version of the strerror() function. It is supported to maintain backward compatibility with operating system versions prior to Tru64 UNIX Version 4.0. RETURN VALUES
On successful completion, the strerror() function returns a pointer to the generated message string. If the error number is not valid, errno is set to indicate the error. On successful completion, strerror_r() provides the error message in strerrbuf, and returns a value of 0 (zero). Otherwise it returns a value of -1. ERRORS
The strerror() and strerror_r() functions set errno to the specified values for the following conditions: The errnum parameter is an invalid error number. [Tru64 UNIX] The strerrorbuf is inaccessible to the strerror_r() function. Note that the strerror_r() function truncates the error message if strerrbuf is too small. RELATED INFORMATION
Functions: intro(2), catgets(3), catopen(3), perror(3), setlocale(3) Standards: standards(5) delim off strerror(3)
Man Page