perror strerror strerror_r sys_errlist sys_nerr - system error messages
Lb libc
The
strerror ();
function accepts an error number argument
Fa errnum
and returns a pointer to the corresponding
message string.
The
strerror_r ();
function renders the same result into
Fa strerrbuf
for a maximum of
Fa 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, followed by a newline, to the
standard error file descriptor.
If the argument
Fa string
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
Er EINVAL
as a warning.
Error numbers recognized by this implementation fall in
the range 0 <
Fa errnum
<
Fa sys_nerr .
If insufficient storage is provided in
Fa strerrbuf
(as specified in
Fa buflen )
to contain the error string,
strerror_r ();
returns
Er ERANGE
and
Fa strerrbuf
will contain an error message that has been truncated and
NUL
terminated to fit the length specified by
Fa buflen .
The message strings can be accessed directly using the external
array
sys_errlist
The external value
sys_nerr
contains a count of the messages in
sys_errlist
The use of these variables is deprecated;
strerror ();
or
strerror_r ();
should be used instead.
The return type for
strerror ();
is missing a type-qualifier; it should actually be
Vt const char * .
Programs that use the deprecated sys_errlist variable often fail to compile because they declare it inconsistently.
Закладки на сайте Проследить за страницей |
Created 1996-2024 by Maxim Chirkov Добавить, Поддержать, Вебмастеру |