Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

strerror_r(3) [osf1 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)

Check Out this Related Man Page

STRERROR(3)						   BSD Library Functions Manual 					       STRERROR(3)

NAME
perror, strerror, strerror_r, sys_errlist, sys_nerr -- system error messages LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <stdio.h> void perror(const char *s); extern const char * const sys_errlist[]; extern const int sys_nerr; #include <string.h> char * strerror(int errnum); int strerror_r(int errnum, char *strerrbuf, size_t buflen); DESCRIPTION
The strerror(), strerror_r(), and perror() functions look up the error message string corresponding to an error number. The strerror() function accepts an error number argument errnum and returns a pointer to the corresponding message string. The strerror_r() function renders the same result into strerrbuf for a maximum of buflen characters and returns 0 upon success. The perror() function finds the error message corresponding to the current value of the global variable errno (intro(2)) and writes it, fol- lowed by a newline, to the standard error file descriptor. If the argument s is non-NULL and does not point to the null character, this string is prepended to the message string and separated from it by a colon and space (``: ''); otherwise, only the error message string is printed. If the error number is not recognized, these functions return an error message string containing ``Unknown error: '' followed by the error number in decimal. The strerror() and strerror_r() functions return EINVAL as a warning. Error numbers recognized by this implementation fall in the range 0 <= errnum < sys_nerr. If insufficient storage is provided in strerrbuf (as specified in buflen) to contain the error string, strerror_r() returns ERANGE and strerrbuf will contain an error message that has been truncated and NUL terminated to fit the length specified by buflen. The message strings can be accessed directly using the external array sys_errlist. The external value sys_nerr contains a count of the mes- sages in sys_errlist. The use of these variables is deprecated; strerror() or strerror_r() should be used instead. SEE ALSO
intro(2), psignal(3) STANDARDS
The perror() and strerror() functions conform to ISO/IEC 9899:1999 (``ISO C99''). The strerror_r() function conforms to IEEE Std 1003.1-2001 (``POSIX.1''). HISTORY
The strerror() and perror() functions first appeared in 4.4BSD. The strerror_r() function was implemented in FreeBSD 4.4 by Wes Peters <wes@FreeBSD.org>. BUGS
For unknown error numbers, the strerror() function will return its result in a static buffer which may be overwritten by subsequent calls. The return type for strerror() is missing a type-qualifier; it should actually be const char *. Programs that use the deprecated sys_errlist variable often fail to compile because they declare it inconsistently. BSD
October 12, 2004 BSD
Man Page