about summary refs log tree commit diff
path: root/manual
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2020-05-18 17:41:25 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2020-07-07 15:02:57 -0300
commit325081b9eb2035f8f025255206889208f330b590 (patch)
tree43a32de8fdd6777e290d7310795b41ea86df12b6 /manual
parentbfe05aa289054744b68f136b701705cfd242c4de (diff)
downloadglibc-325081b9eb2035f8f025255206889208f330b590.tar.gz
glibc-325081b9eb2035f8f025255206889208f330b590.tar.xz
glibc-325081b9eb2035f8f025255206889208f330b590.zip
string: Add strerrorname_np and strerrordesc_np
The strerrorname_np returns error number name (e.g. "EINVAL" for EINVAL)
while strerrordesc_np returns string describing error number (e.g
"Invalid argument" for EINVAL).  Different than strerror,
strerrordesc_np does not attempt to translate the return description,
both functions return NULL for an invalid error number.

They should be used instead of sys_errlist and sys_nerr, both are
thread and async-signal safe.  These functions are GNU extensions.

Checked on x86-64-linux-gnu, i686-linux-gnu, powerpc64le-linux-gnu,
and s390x-linux-gnu.

Tested-by: Carlos O'Donell <carlos@redhat.com>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Diffstat (limited to 'manual')
-rw-r--r--manual/errno.texi23
1 files changed, 23 insertions, 0 deletions
diff --git a/manual/errno.texi b/manual/errno.texi
index 8cb4ce8b48..1834339220 100644
--- a/manual/errno.texi
+++ b/manual/errno.texi
@@ -1207,6 +1207,29 @@ to @code{errno}.
 The function @code{perror} is declared in @file{stdio.h}.
 @end deftypefun
 
+@deftypefun void strerrorname_np (int @var{errnum})
+@standards{GNU, string.h}
+@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
+This function returns the name describing the error @var{errnum} or
+@code{NULL} if there is no known constant with this value (e.g "EINVAL"
+for @code{EINVAL}).
+
+@pindex string.h
+This function is a GNU extension, declared in the header file @file{string.h}.
+@end deftypefun
+
+@deftypefun void strerrordesc_np (int @var{errnum})
+@standards{GNU, string.h}
+@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
+This function returns the message describing the error @var{errnum} or
+@code{NULL} if there is no known constant with this value (e.g "Invalid
+argument" for @code{EINVAL}).  Different than @code{strerror} the returned
+description is not translated.
+
+@pindex string.h
+This function is a GNU extension, declared in the header file @file{string.h}.
+@end deftypefun
+
 @code{strerror} and @code{perror} produce the exact same message for any
 given error code; the precise text varies from system to system.  With
 @theglibc{}, the messages are fairly short; there are no multi-line