string: Add strerrorname_np and strerrordesc_np

System Internals / glibc - Adhemerval Zanella [linaro.org] - 7 July 2020 18:02 UTC

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.

325081b9eb string: Add strerrorname_np and strerrordesc_np
NEWS | 10 ++++
include/stdio.h | 1 +
manual/errno.texi | 23 ++++++++
stdio-common/errlist.c | 33 +++++++++++
stdio-common/test-strerr.c | 65 ++++++++++++++++++++++
string/Makefile | 3 +-
string/Versions | 1 +
string/strerrordesc_np.c | 26 +++++++++
string/strerrorname_np.c | 25 +++++++++
string/string.h | 7 +++
sysdeps/mach/hurd/i386/libc.abilist | 2 +
sysdeps/mach/hurd/test-err_np.c | 4 ++
sysdeps/unix/sysv/linux/aarch64/libc.abilist | 2 +
sysdeps/unix/sysv/linux/alpha/libc.abilist | 2 +
sysdeps/unix/sysv/linux/arm/be/libc.abilist | 2 +
sysdeps/unix/sysv/linux/arm/le/libc.abilist | 2 +
sysdeps/unix/sysv/linux/csky/libc.abilist | 2 +
sysdeps/unix/sysv/linux/hppa/libc.abilist | 2 +
sysdeps/unix/sysv/linux/i386/libc.abilist | 2 +
sysdeps/unix/sysv/linux/ia64/libc.abilist | 2 +
sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist | 2 +
sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist | 2 +
sysdeps/unix/sysv/linux/microblaze/be/libc.abilist | 2 +
sysdeps/unix/sysv/linux/microblaze/le/libc.abilist | 2 +
.../unix/sysv/linux/mips/mips32/fpu/libc.abilist | 2 +
.../unix/sysv/linux/mips/mips32/nofpu/libc.abilist | 2 +
.../unix/sysv/linux/mips/mips64/n32/libc.abilist | 2 +
.../unix/sysv/linux/mips/mips64/n64/libc.abilist | 2 +
sysdeps/unix/sysv/linux/nios2/libc.abilist | 2 +
.../sysv/linux/powerpc/powerpc32/fpu/libc.abilist | 2 +
.../linux/powerpc/powerpc32/nofpu/libc.abilist | 2 +
.../sysv/linux/powerpc/powerpc64/be/libc.abilist | 2 +
.../sysv/linux/powerpc/powerpc64/le/libc.abilist | 2 +
sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist | 2 +
sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist | 2 +
sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist | 2 +
sysdeps/unix/sysv/linux/sh/be/libc.abilist | 2 +
sysdeps/unix/sysv/linux/sh/le/libc.abilist | 2 +
sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist | 2 +
sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist | 2 +
sysdeps/unix/sysv/linux/x86_64/64/libc.abilist | 2 +
sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist | 2 +
42 files changed, 259 insertions(+), 1 deletion(-)

Upstream: sourceware.org


  • Share