[PATCH v5 01/13] signal: Add signum-{generic,arch}.h

classic Classic list List threaded Threaded
48 messages Options
123
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH v5 08/13] string: Simplify strerror_r

Sourceware - libc-alpha mailing list
On 6/19/20 9:43 AM, Adhemerval Zanella wrote:
> Use snprintf instead of mempcpy plus itoa_word and remove unused
> definitions.  There is no potential for infinite recursion because
> snprintf only use strerror_r for the %m specifier.
>
> Checked on x86-64-linux-gnu, i686-linux-gnu, powerpc64le-linux-gnu,
> and s390x-linux-gnu.

OK for master. I like the simplification and it makes sense to me.

No regressions on x86_64 and i686.

Tested-by: Carlos O'Donell <[hidden email]>
Reviewed-by: Carlos O'Donell <[hidden email]>

> ---
>  string/_strerror.c       | 41 ++----------------------
>  sysdeps/mach/_strerror.c | 67 +++-------------------------------------
>  2 files changed, 7 insertions(+), 101 deletions(-)
>
> diff --git a/string/_strerror.c b/string/_strerror.c
> index 01226e3d4b..da3b22f5b1 100644
> --- a/string/_strerror.c
> +++ b/string/_strerror.c
> @@ -15,22 +15,10 @@
>     License along with the GNU C Library; if not, see
>     <https://www.gnu.org/licenses/>.  */
>  
> +#include <string.h>
>  #include <libintl.h>
> -#include <stdbool.h>
>  #include <stdio.h>
>  #include <stdlib.h>
> -#include <string.h>
> -#include <sys/param.h>
> -#include <_itoa.h>
> -
> -/* It is critical here that we always use the `dcgettext' function for
> -   the message translation.  Since <libintl.h> only defines the macro
> -   `dgettext' to use `dcgettext' for optimizing programs this is not
> -   always guaranteed.  */
> -#ifndef dgettext
> -# include <locale.h> /* We need LC_MESSAGES.  */
> -# define dgettext(domainname, msgid) dcgettext (domainname, msgid, LC_MESSAGES)
> -#endif

OK.

>  
>  /* Return a string describing the errno code in ERRNUM.  */
>  char *
> @@ -39,32 +27,7 @@ __strerror_r (int errnum, char *buf, size_t buflen)
>    char *err = (char *) __get_errlist (errnum);
>    if (__glibc_unlikely (err == NULL))
>      {
> -      /* Buffer we use to print the number in.  For a maximum size for
> - `int' of 8 bytes we never need more than 20 digits.  */
> -      char numbuf[21];
> -      const char *unk = _("Unknown error ");
> -      size_t unklen = strlen (unk);
> -      char *p, *q;
> -      bool negative = errnum < 0;
> -
> -      numbuf[20] = '\0';
> -      p = _itoa_word (abs (errnum), &numbuf[20], 10, 0);
> -
> -      /* Now construct the result while taking care for the destination
> - buffer size.  */
> -      q = __mempcpy (buf, unk, MIN (unklen, buflen));
> -      if (negative && unklen < buflen)
> - {
> -  *q++ = '-';
> -  ++unklen;
> - }
> -      if (unklen < buflen)
> - memcpy (q, p, MIN ((size_t) (&numbuf[21] - p), buflen - unklen));
> -
> -      /* Terminate the string in any case.  */
> -      if (buflen > 0)
> - buf[buflen - 1] = '\0';
> -
> +      __snprintf (buf, buflen, "%s%d", _("Unknown error "), errnum);

OK. No %m specifier.

>        return buf;
>      }
>  
> diff --git a/sysdeps/mach/_strerror.c b/sysdeps/mach/_strerror.c
> index d932b1bd58..399de330d9 100644
> --- a/sysdeps/mach/_strerror.c
> +++ b/sysdeps/mach/_strerror.c
> @@ -15,22 +15,12 @@
>     License along with the GNU C Library; if not, see
>     <https://www.gnu.org/licenses/>.  */
>  
> +#include <string.h>
>  #include <libintl.h>
>  #include <stdio.h>
>  #include <string.h>
>  #include <mach/error.h>
>  #include <errorlib.h>
> -#include <sys/param.h>
> -#include <_itoa.h>
> -
> -/* It is critical here that we always use the `dcgettext' function for
> -   the message translation.  Since <libintl.h> only defines the macro
> -   `dgettext' to use `dcgettext' for optimizing programs this is not
> -   always guaranteed.  */
> -#ifndef dgettext
> -# include <locale.h> /* We need LC_MESSAGES.  */
> -# define dgettext(domainname, msgid) dcgettext (domainname, msgid, LC_MESSAGES)
> -#endif
>  

OK.

>  /* Return a string describing the errno code in ERRNUM.  */
>  char *
> @@ -50,26 +40,8 @@ __strerror_r (int errnum, char *buf, size_t buflen)
>  
>    if (system > err_max_system || ! __mach_error_systems[system].bad_sub)
>      {
> -      /* Buffer we use to print the number in.  For a maximum size for
> - `int' of 8 bytes we never need more than 20 digits.  */
> -      char numbuf[21];
> -      const char *unk = _("Error in unknown error system: ");
> -      const size_t unklen = strlen (unk);
> -      char *p, *q;
> -
> -      numbuf[20] = '\0';
> -      p = _itoa_word (errnum, &numbuf[20], 16, 1);
> -
> -      /* Now construct the result while taking care for the destination
> - buffer size.  */
> -      q = __mempcpy (buf, unk, MIN (unklen, buflen));
> -      if (unklen < buflen)
> - memcpy (q, p, MIN (&numbuf[21] - p, buflen - unklen));
> -
> -      /* Terminate the string in any case.  */
> -      if (buflen > 0)
> - buf[buflen - 1] = '\0';
> -
> +      __snprintf (buf, buflen, "%s: %d", _("Error in unknown error system: "),
> +  errnum);

OK. No %m.

>        return buf;
>      }
>  
> @@ -80,37 +52,8 @@ __strerror_r (int errnum, char *buf, size_t buflen)
>  
>    if (code >= es->subsystem[sub].max_code)
>      {
> -      /* Buffer we use to print the number in.  For a maximum size for
> - `int' of 8 bytes we never need more than 20 digits.  */
> -      char numbuf[21];
> -      const char *unk = _("Unknown error ");
> -      const size_t unklen = strlen (unk);
> -      char *p, *q;
> -      size_t len = strlen (es->subsystem[sub].subsys_name);
> -
> -      numbuf[20] = '\0';
> -      p = _itoa_word (errnum, &numbuf[20], 10, 0);
> -
> -      /* Now construct the result while taking care for the destination
> - buffer size.  */
> -      q = __mempcpy (buf, unk, MIN (unklen, buflen));
> -      if (unklen < buflen)
> - {
> -  q = __mempcpy (q, es->subsystem[sub].subsys_name,
> - MIN (len, buflen - unklen));
> -  if (unklen + len < buflen)
> -    {
> -      *q++ = ' ';
> -      if (unklen + len + 1 < buflen)
> - memcpy (q, p,
> - MIN (&numbuf[21] - p, buflen - unklen - len - 1));
> -    }
> - }
> -
> -       /* Terminate the string in any case.  */
> -      if (buflen > 0)
> - buf[buflen - 1] = '\0';
> -
> +      __snprintf (buf, buflen, "%s%s %d", _("Unknown error "),
> +  es->subsystem[sub].subsys_name, errnum);

OK. Perfect.

>        return buf;
>      }
>  
>


--
Cheers,
Carlos.

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH v5 09/13] string: Add strsignal test

Sourceware - libc-alpha mailing list
In reply to this post by Sourceware - libc-alpha mailing list
On 6/19/20 9:43 AM, Adhemerval Zanella wrote:
> Checked on x86-64-linux-gnu, i686-linux-gnu, powerpc64le-linux-gnu,
> and s390x-linux-gnu.

OK for master if you fix the typo.

No regressions on x86_64 and i686.

Tested-by: Carlos O'Donell <[hidden email]>
Reviewed-by: Carlos O'Donell <[hidden email]>

> ---
>  string/Makefile        |  5 +++-
>  string/tst-strsignal.c | 57 ++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 61 insertions(+), 1 deletion(-)
>  create mode 100644 string/tst-strsignal.c
>
> diff --git a/string/Makefile b/string/Makefile
> index e1cca5516b..470ff77ded 100644
> --- a/string/Makefile
> +++ b/string/Makefile
> @@ -65,6 +65,8 @@ tests := tester inl-tester noinl-tester testcopy test-ffs \
>  # This test allocates a lot of memory and can run for a long time.
>  xtests = tst-strcoll-overflow
>  
> +tests-container += tst-strsignal

OK.

> +
>  # This test needs libdl.
>  ifeq (yes,$(build-shared))
>  tests += test-strerror-errno
> @@ -105,7 +107,7 @@ $(objpfx)tst-svc-cmp.out: tst-svc.expect $(objpfx)tst-svc.out
>  
>  LOCALES := de_DE.UTF-8 en_US.ISO-8859-1 en_US.UTF-8 \
>             tr_TR.ISO-8859-9 tr_TR.UTF-8 cs_CZ.UTF-8 \
> -   da_DK.ISO-8859-1 en_GB.UTF-8
> +   da_DK.ISO-8859-1 en_GB.UTF-8 pt_BR.UTF-8

OK. Ugly. This list should be one per line and alpha-sorted. Some other day.

>  include ../gen-locales.mk
>  
>  $(objpfx)test-strcasecmp.out: $(gen-locales)
> @@ -115,5 +117,6 @@ $(objpfx)tst-strxfrm2.out: $(gen-locales)
>  # bug-strcoll2 needs cs_CZ.UTF-8 and da_DK.ISO-8859-1.
>  $(objpfx)bug-strcoll2.out: $(gen-locales)
>  $(objpfx)tst-strcoll-overflow.out: $(gen-locales)
> +$(objpfx)tst-strsignal.out: $(gen-locales)

OK.

>  
>  endif
> diff --git a/string/tst-strsignal.c b/string/tst-strsignal.c
> new file mode 100644
> index 0000000000..93a46dbc78
> --- /dev/null
> +++ b/string/tst-strsignal.c
> @@ -0,0 +1,57 @@
> +/* Test for strsignal.

OK.

> +
> +   Copyright (C) 2020 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library; if not, see
> +   <https://www.gnu.org/licenses/>.  */
> +
> +#include <string.h>
> +#include <stdio.h>
> +#include <signal.h>
> +#include <locale.h>
> +#include <array_length.h>
> +
> +#include <support/support.h>
> +#include <support/check.h>
> +

OK. Test a few operations of strsignal.

> +static int
> +do_test (void)
> +{
> +  xsetlocale (LC_ALL, "C");
> +
> +  TEST_COMPARE_STRING (strsignal (SIGINT),     "Interrupt");
> +  TEST_COMPARE_STRING (strsignal (-1),         "Unknown signal -1");
> +#ifdef SIGRTMIN
> +  TEST_COMPARE_STRING (strsignal (SIGRTMIN),   "Real-time signal 0");
> +#endif
> +#ifdef SIGRTMAX
> +  TEST_COMPARE_STRING (strsignal (SIGRTMAX+1), "Unknown signal 65");
> +#endif
> +
> +  xsetlocale (LC_ALL, "pt_BR.UTF-8");
> +
> +  TEST_COMPARE_STRING (strsignal (SIGINT),    "Interrup\xc3\xa7\xc3\xa3\x6f");
> +  TEST_COMPARE_STRING (strsignal (-1),        "Sinal desconhecido -1");
> +#ifdef SIGRTMI
          ^^^^^^^ Typo. SIGRTMIN.

> +  TEST_COMPARE_STRING (strsignal (SIGRTMIN),  "Sinal de tempo-real 0");
> +#endif
> +#ifdef SIGRTMAX
> +  TEST_COMPARE_STRING (strsignal (SIGRTMAX+1), "Sinal desconhecido 65");
> +#endif
> +
> +  return 0;
> +}
> +
> +#include <support/test-driver.c>
>


--
Cheers,
Carlos.

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH v5 09/13] string: Add strsignal test

Sourceware - libc-alpha mailing list
In reply to this post by Sourceware - libc-alpha mailing list
On 6/19/20 9:43 AM, Adhemerval Zanella wrote:
> +tests-container += tst-strsignal

Did you intend to put this in tests-container?

The test does nothing particularly destructive to the environment.

It will only increase the test time by running it in a container.

Likewise for patch 10.

--
Cheers,
Carlos.

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH v5 10/13] string: Add strerror, strerror_r, and strerror_l test

Sourceware - libc-alpha mailing list
In reply to this post by Sourceware - libc-alpha mailing list
On 6/19/20 9:43 AM, Adhemerval Zanella wrote:
> Checked on x86-64-linux-gnu, i686-linux-gnu, powerpc64le-linux-gnu,
> and s390x-linux-gnu.

OK for master.

No regressions on x86_64 and i686.

Tested-by: Carlos O'Donell <[hidden email]>
Reviewed-by: Carlos O'Donell <[hidden email]>

> ---
>  string/Makefile       |  3 +-
>  string/tst-strerror.c | 76 +++++++++++++++++++++++++++++++++++++++++++
>  support/Makefile      |  2 ++
>  support/support.h     |  4 +++
>  support/xnewlocale.c  | 31 ++++++++++++++++++
>  support/xuselocale.c  | 30 +++++++++++++++++
>  6 files changed, 145 insertions(+), 1 deletion(-)
>  create mode 100644 string/tst-strerror.c
>  create mode 100644 support/xnewlocale.c
>  create mode 100644 support/xuselocale.c
>
> diff --git a/string/Makefile b/string/Makefile
> index 470ff77ded..73e5ac2ebe 100644
> --- a/string/Makefile
> +++ b/string/Makefile
> @@ -65,7 +65,7 @@ tests := tester inl-tester noinl-tester testcopy test-ffs \
>  # This test allocates a lot of memory and can run for a long time.
>  xtests = tst-strcoll-overflow
>  
> -tests-container += tst-strsignal
> +tests-container += tst-strsignal tst-strerror

OK.

Note:
- It is OK to put these in tests-container, but they don't particularly
  need to be in a container. It does provide more test isolation for
  the installed translated messages.

>  
>  # This test needs libdl.
>  ifeq (yes,$(build-shared))
> @@ -118,5 +118,6 @@ $(objpfx)tst-strxfrm2.out: $(gen-locales)
>  $(objpfx)bug-strcoll2.out: $(gen-locales)
>  $(objpfx)tst-strcoll-overflow.out: $(gen-locales)
>  $(objpfx)tst-strsignal.out: $(gen-locales)
> +$(objpfx)tst-strerror.out: $(gen-locales)

OK.

>  
>  endif
> diff --git a/string/tst-strerror.c b/string/tst-strerror.c
> new file mode 100644
> index 0000000000..3af51236d7
> --- /dev/null
> +++ b/string/tst-strerror.c
> @@ -0,0 +1,76 @@
> +/* Test for strerror, strerror_r, and strerror_l.
> +
> +   Copyright (C) 2020 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library; if not, see
> +   <https://www.gnu.org/licenses/>.  */
> +
> +#include <string.h>
> +#include <stdio.h>
> +#include <errno.h>
> +#include <locale.h>
> +#include <array_length.h>
> +
> +#include <support/support.h>
> +#include <support/check.h>
> +
> +static int
> +do_test (void)
> +{
> +  xsetlocale (LC_ALL, "C");
> +
> +  TEST_COMPARE_STRING (strerror (EINVAL), "Invalid argument");
> +  TEST_COMPARE_STRING (strerror (-1),     "Unknown error -1");
> +
> +  {
> +    char buffer[32];
> +    TEST_COMPARE_STRING (strerror_r (EINVAL, buffer, 8),
> + "Invalid argument");
> +    TEST_COMPARE_STRING (strerror_r (-1, buffer, 8),
> + "Unknown");
> +    TEST_COMPARE_STRING (strerror_r (-1, buffer, 16),
> + "Unknown error -");
> +    TEST_COMPARE_STRING (strerror_r (-1, buffer, 32),
> + "Unknown error -1");
> +  }
> +
> +  locale_t l = xnewlocale (LC_ALL_MASK, "pt_BR.UTF-8", NULL);
> +
> +  TEST_COMPARE_STRING (strerror_l (EINVAL, l), "Argumento inv\303\241lido");
> +  TEST_COMPARE_STRING (strerror_l (-1, l),     "Erro desconhecido -1");
> +
> +  xuselocale (l);
> +
> +  TEST_COMPARE_STRING (strerror (EINVAL), "Argumento inv\303\241lido");
> +  TEST_COMPARE_STRING (strerror (-1),     "Erro desconhecido -1");
> +
> +  {
> +    char buffer[32];
> +    TEST_COMPARE_STRING (strerror_r (EINVAL, buffer, 8),
> + "Argumento inv\303\241lido");
> +    TEST_COMPARE_STRING (strerror_r (-1, buffer, 8),
> + "Erro de");
> +    TEST_COMPARE_STRING (strerror_r (-1, buffer, 16),
> + "Erro desconheci");
> +    TEST_COMPARE_STRING (strerror_r (-1, buffer, 32),
> + "Erro desconhecido -1");
> +  }
> +
> +  freelocale (l);
> +
> +  return 0;
> +}
> +
> +#include <support/test-driver.c>

OK.

> diff --git a/support/Makefile b/support/Makefile
> index 51484310cd..764b471033 100644
> --- a/support/Makefile
> +++ b/support/Makefile
> @@ -108,6 +108,7 @@ libsupport-routines = \
>    xmmap \
>    xmprotect \
>    xmunmap \
> +  xnewlocale \
>    xopen \
>    xpipe \
>    xpoll \
> @@ -173,6 +174,7 @@ libsupport-routines = \
>    xsymlink \
>    xsysconf \
>    xunlink \
> +  xuselocale \
>    xwaitpid \
>    xwrite \
>  
> diff --git a/support/support.h b/support/support.h
> index 8e1a6a17f7..905b5a76d8 100644
> --- a/support/support.h
> +++ b/support/support.h
> @@ -29,6 +29,8 @@
>  #include <sys/stat.h>
>  /* For ssize_t and off64_t.  */
>  #include <sys/types.h>
> +/* For locale_t.  */
> +#include <locale.h>
>  
>  __BEGIN_DECLS
>  
> @@ -92,6 +94,8 @@ char *xasprintf (const char *format, ...)
>  char *xstrdup (const char *);
>  char *xstrndup (const char *, size_t);
>  char *xsetlocale (int category, const char *locale);
> +locale_t xnewlocale (int category_mask, const char *locale, locale_t base);
> +char *xuselocale (locale_t newloc);
>  
>  /* These point to the TOP of the source/build tree, not your (or
>     support's) subdirectory.  */
> diff --git a/support/xnewlocale.c b/support/xnewlocale.c
> new file mode 100644
> index 0000000000..f532873c7f
> --- /dev/null
> +++ b/support/xnewlocale.c
> @@ -0,0 +1,31 @@
> +/* newlocale with error checking.
> +   Copyright (C) 2020 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library; if not, see
> +   <https://www.gnu.org/licenses/>.  */
> +
> +#include <support/check.h>
> +
> +#include <locale.h>
> +
> +locale_t
> +xnewlocale (int category_mask, const char *locale, locale_t base)
> +{
> +  locale_t r = newlocale (category_mask, locale, base);
> +  if (r == (locale_t) 0)
> +    FAIL_EXIT1 ("error: newlocale (%d, \"%s\", %p)\n", category_mask,
> + locale, base);
> +  return r;

OK.

> +}
> diff --git a/support/xuselocale.c b/support/xuselocale.c
> new file mode 100644
> index 0000000000..3d6125b57d
> --- /dev/null
> +++ b/support/xuselocale.c
> @@ -0,0 +1,30 @@
> +/* uselocale with error checking.
> +   Copyright (C) 2020 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library; if not, see
> +   <https://www.gnu.org/licenses/>.  */
> +
> +#include <support/check.h>
> +
> +#include <locale.h>
> +
> +locale_t
> +xuselocale (locale_t newloc)
> +{
> +  locale_t r = uselocale (newloc);
> +  if (r == (locale_t) 0)
> +    FAIL_EXIT1 ("error: uselocale (%p)\n", newloc);
> +  return r;
> +}
>

OK.

--
Cheers,
Carlos.

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH v5 11/13] string: Add strerror_l on test-strerror-errno

Sourceware - libc-alpha mailing list
In reply to this post by Sourceware - libc-alpha mailing list
On 6/19/20 9:43 AM, Adhemerval Zanella wrote:
> Checked on x86-64-linux-gnu, i686-linux-gnu, powerpc64le-linux-gnu,
> and s390x-linux-gnu.

OK for master.

No regression on x86_64 and i686.

Tested-by: Carlos O'Donell <[hidden email]>
Reviewed-by: Carlos O'Donell <[hidden email]>

> ---
>  string/test-strerror-errno.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/string/test-strerror-errno.c b/string/test-strerror-errno.c
> index 0c52561015..f3b1a98d22 100644
> --- a/string/test-strerror-errno.c
> +++ b/string/test-strerror-errno.c
> @@ -55,6 +55,11 @@ do_test (void)
>    (void) msg;
>    TEST_COMPARE (errno, 0);
>  
> +  locale_t l = xnewlocale (LC_ALL_MASK, "C", NULL);
> +  msg = strerror_l (-3, l);
> +  (void) msg;
> +  TEST_COMPARE (errno, 0);

OK, make new locale, then translate with strerror_l for an invalid errnum
and make sure errno is unchanged.

> +
>    return 0;
>  }
>  
>


--
Cheers,
Carlos.

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH v5 12/13] string: Add sigabbrev_np and sigdescr_np

Sourceware - libc-alpha mailing list
In reply to this post by Sourceware - libc-alpha mailing list
On 6/19/20 9:43 AM, Adhemerval Zanella wrote:
> The sigabbrev_np returns the abbreviated signal name (i.g. "HUP" for
> SIGHUP) while sigdescr_np returns string describing error number

s/returns string/returns the string/g
s/ error/ the error/g

> (i.g "Hangup" for SIGHUP).  Different than strsignal, sigdescr_np
> does not attempt to translate the return description and both
> functions return NULL for an invalid signal number.
>
> They should be used instead of sys_siglist or sys_sigabbrev and they
> are both thread and async-signal safe.  They are added as GNU
> extensions on string.h header (same as strsignal).

These are perfect functions to use in place of sys_siglist and
sys_sigabbrev. Thus we now have functions to access the old data in
a way that avoids exposing the data to COPY relocations (and the
size encoded in that ABI). Thanks for fixing this up.
 
> Checked on x86-64-linux-gnu, i686-linux-gnu, powerpc64le-linux-gnu,
> and s390x-linux-gnu.

OK for master if you accept the manual suggestions and commit message
changes.

No regressions on x86_64 and i686.

Tested-by: Carlos O'Donell <[hidden email]>
Reviewed-by: Carlos O'Donell <[hidden email]>

> ---
>  NEWS                                          | 10 ++++
>  include/signal.h                              |  3 +-
>  include/string.h                              |  3 ++
>  manual/signal.texi                            | 24 +++++++++
>  stdio-common/siglist.c                        |  1 +
>  string/Makefile                               |  6 ++-
>  string/Versions                               |  3 ++
>  string/sigabbrev_np.c                         | 33 ++++++++++++
>  string/sigdescr_np.c                          | 34 +++++++++++++
>  string/string.h                               |  8 +++
>  string/strsignal.c                            |  9 +---
>  string/test-sig_np.c                          | 51 +++++++++++++++++++
>  sysdeps/mach/hurd/i386/libc.abilist           |  2 +
>  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 +
>  .../sysv/linux/m68k/coldfire/libc.abilist     |  2 +
>  .../unix/sysv/linux/m68k/m680x0/libc.abilist  |  2 +
>  .../sysv/linux/microblaze/be/libc.abilist     |  2 +
>  .../sysv/linux/microblaze/le/libc.abilist     |  2 +
>  .../sysv/linux/mips/mips32/fpu/libc.abilist   |  2 +
>  .../sysv/linux/mips/mips32/nofpu/libc.abilist |  2 +
>  .../sysv/linux/mips/mips64/n32/libc.abilist   |  2 +
>  .../sysv/linux/mips/mips64/n64/libc.abilist   |  2 +
>  sysdeps/unix/sysv/linux/nios2/libc.abilist    |  2 +
>  .../linux/powerpc/powerpc32/fpu/libc.abilist  |  2 +
>  .../powerpc/powerpc32/nofpu/libc.abilist      |  2 +
>  .../linux/powerpc/powerpc64/be/libc.abilist   |  2 +
>  .../linux/powerpc/powerpc64/le/libc.abilist   |  2 +
>  .../unix/sysv/linux/riscv/rv64/libc.abilist   |  2 +
>  .../unix/sysv/linux/s390/s390-32/libc.abilist |  2 +
>  .../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 +
>  .../sysv/linux/sparc/sparc32/libc.abilist     |  2 +
>  .../sysv/linux/sparc/sparc64/libc.abilist     |  2 +
>  .../unix/sysv/linux/x86_64/64/libc.abilist    |  2 +
>  .../unix/sysv/linux/x86_64/x32/libc.abilist   |  2 +
>  43 files changed, 237 insertions(+), 10 deletions(-)
>  create mode 100644 string/sigabbrev_np.c
>  create mode 100644 string/sigdescr_np.c
>  create mode 100644 string/test-sig_np.c
>
> diff --git a/NEWS b/NEWS
> index ec39b6e056..f504772eb6 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -31,6 +31,16 @@ Major new features:
>    pthread_attr_getsigmask_np have been added.  They allow applications
>    to specify the signal mask of a thread created with pthread_create.
>  
> +* The functions sigabbrev_np and sigdescr_np have been added.  The
> +  sigabbrev_np returns the abbreviated signal name (i.g. "HUP" for SIGHUP)
> +  while sigdescr_np returns string describing signal number (i.g "Hangup"

s/returns string/returns a string/g
s/ signal/ the signal/g

> +  for SIGHUP).  Different than strsignal, sigdescr_np does not attempt
> +  to translate the return description and both functions return NULL for
> +  an invalid signal number.
> +
> +  They should be used instead of sys_siglist or sys_sigabbrev and they
> +  are both thread and async-signal safe.  These functions are GNU extensions.

OK.

> +
>  Deprecated and removed features, and other changes affecting compatibility:
>  
>  * The deprecated <sys/sysctl.h> header and the sysctl function have been
> diff --git a/include/signal.h b/include/signal.h
> index 3d6315b741..b4ee02d153 100644
> --- a/include/signal.h
> +++ b/include/signal.h
> @@ -16,7 +16,8 @@ libc_hidden_proto (__libc_current_sigrtmin)
>  libc_hidden_proto (__libc_current_sigrtmax)
>  extern const char * const __sys_siglist[_NSIG];
>  libc_hidden_proto (__sys_siglist)
> -
> +extern const char * const __sys_sigabbrev[_NSIG];
> +libc_hidden_proto (__sys_sigabbrev)

OK.

>  
>  /* Now define the internal interfaces.  */
>  extern __sighandler_t __bsd_signal (int __sig, __sighandler_t __handler);
> diff --git a/include/string.h b/include/string.h
> index ce01ad8254..f4ce138622 100644
> --- a/include/string.h
> +++ b/include/string.h
> @@ -53,6 +53,9 @@ extern char *__strerror_r (int __errnum, char *__buf, size_t __buflen);
>  
>  extern char *__strerror_l (int __errnum, locale_t __loc);
>  
> +extern const char *__sigdescr_np (int __errnum);
> +libc_hidden_proto (__sigdescr_np)

OK.

> +
>  /* Get _STRING_ARCH_unaligned.  */
>  #include <string_private.h>
>  #endif
> diff --git a/manual/signal.texi b/manual/signal.texi
> index 34def1c06c..a19dff85f8 100644
> --- a/manual/signal.texi
> +++ b/manual/signal.texi
> @@ -880,6 +880,30 @@ to @var{signum}.
>  This function is a BSD feature, declared in the header file @file{signal.h}.
>  @end deftypefun
>  
> +@deftypefun void sigdescr_np (int @var{signum})
> +@standards{GNU, string.h}
> +@safety{@prelim{}@mtsafe{@mtssigintr{}}@assafe{}@acsafe{}}

Use @mtsafe{}, because the function does not touch _sigintr at all.

> +This function returns the message describing the signal @var{signum} or
> +@code{NULL} for invalid signal number (i.g "Hangup" for @code{SIGHUP}).

s/i.g/e.g./g

> +Different than @code{strsignal} the returned description is not translated.
> +The message porints to a static storage whose lifetime is the whole lifetime

s/porints/points/g

> +of the program.
> +
> +@pindex string.h
> +This function is a GNU extension, declared in the header file @file{string.h}.
> +@end deftypefun
> +
> +@deftypefun void sigabbrev_np (int @var{signum})
> +@standards{GNU, string.h}
> +@safety{@prelim{}@mtsafe{@mtssigintr{}}@assafe{}@acsafe{}}

Use @mtsafe{}, because the function does not touch _sigintr at all.

> +This function returns the abbreviation describing the signal @var{signum} or
> +@code{NULL} for invalid signal number.  The message porints to a static

s/porints/points/g

> +storage whose lifetime is the whole lifetime of the program.
> +
> +@pindex string.h
> +This function is a GNU extension, declared in the header file @file{string.h}.
> +@end deftypefun
> +
>  @node Signal Actions
>  @section Specifying Signal Actions
>  @cindex signal actions
> diff --git a/stdio-common/siglist.c b/stdio-common/siglist.c
> index 3e29aa8227..6b020262b2 100644
> --- a/stdio-common/siglist.c
> +++ b/stdio-common/siglist.c
> @@ -34,5 +34,6 @@ const char *const __sys_sigabbrev[NSIG] =
>  #include <siglist.h>
>  #undef init_sig
>  };
> +libc_hidden_def (__sys_sigabbrev)

OK.

>  
>  #include <siglist-compat.c>
> diff --git a/string/Makefile b/string/Makefile
> index 73e5ac2ebe..e5075521b7 100644
> --- a/string/Makefile
> +++ b/string/Makefile
> @@ -44,7 +44,8 @@ routines := strcat strchr strcmp strcoll strcpy strcspn \
>       addsep replace) \
>     envz basename \
>     strcoll_l strxfrm_l string-inlines memrchr \
> -   xpg-strerror strerror_l explicit_bzero
> +   xpg-strerror strerror_l explicit_bzero \
> +   sigdescr_np sigabbrev_np

OK.

>  
>  strop-tests := memchr memcmp memcpy memmove mempcpy memset memccpy \
>     stpcpy stpncpy strcat strchr strcmp strcpy strcspn \
> @@ -60,7 +61,8 @@ tests := tester inl-tester noinl-tester testcopy test-ffs \
>     bug-envz1 tst-strxfrm2 tst-endian tst-svc2 \
>     tst-strtok_r bug-strcoll2 tst-cmp tst-xbzero-opt \
>     test-endian-types test-endian-file-scope \
> -   test-endian-sign-conversion tst-memmove-overflow
> +   test-endian-sign-conversion tst-memmove-overflow \
> +   test-sig_np

OK.

>  
>  # This test allocates a lot of memory and can run for a long time.
>  xtests = tst-strcoll-overflow
> diff --git a/string/Versions b/string/Versions
> index 9b709d12a9..6f8dd2d372 100644
> --- a/string/Versions
> +++ b/string/Versions
> @@ -85,4 +85,7 @@ libc {
>    GLIBC_2.25 {
>      explicit_bzero;
>    }
> +  GLIBC_2.32 {
> +    sigdescr_np; sigabbrev_np;
> +  }

OK.

>  }
> diff --git a/string/sigabbrev_np.c b/string/sigabbrev_np.c
> new file mode 100644
> index 0000000000..3cbe14e769
> --- /dev/null
> +++ b/string/sigabbrev_np.c
> @@ -0,0 +1,33 @@
> +/* Return string describing signal abbreviation.
> +   Copyright (C) 2020 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library; if not, see
> +   <https://www.gnu.org/licenses/>.  */
> +
> +#include <string.h>
> +#include <signal.h>
> +#include <array_length.h>
> +
> +const char *const
> +sigabbrev_np (int signum)
> +{
> +  const char *abbrev = NULL;
> +
> +  if (signum >= 0 && signum <= NSIG
> +      && signum < array_length (__sys_sigabbrev))
> +    abbrev = __sys_sigabbrev[signum];
> +
> +  return abbrev;
> +}

OK.

> diff --git a/string/sigdescr_np.c b/string/sigdescr_np.c
> new file mode 100644
> index 0000000000..5bcf814c1d
> --- /dev/null
> +++ b/string/sigdescr_np.c
> @@ -0,0 +1,34 @@
> +/* Return string describing signal.
> +   Copyright (C) 2020 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library; if not, see
> +   <https://www.gnu.org/licenses/>.  */
> +
> +#include <string.h>
> +#include <signal.h>
> +#include <array_length.h>
> +
> +const char *const
> +__sigdescr_np (int signum)
> +{
> +  const char *descr = NULL;
> +
> +  if (signum >= 0 && signum <= NSIG && signum < array_length (__sys_siglist))
> +    descr = __sys_siglist[signum];
> +
> +  return descr;
> +}

OK.

> +libc_hidden_def (__sigdescr_np)
> +weak_alias (__sigdescr_np, sigdescr_np)
> diff --git a/string/string.h b/string/string.h
> index d7ce0f4a1b..0119d7f45d 100644
> --- a/string/string.h
> +++ b/string/string.h
> @@ -454,6 +454,14 @@ extern char *strsep (char **__restrict __stringp,
>  /* Return a string describing the meaning of the signal number in SIG.  */
>  extern char *strsignal (int __sig) __THROW;
>  
> +# ifdef __USE_GNU
> +/* Return an abbreviation string for the signal number SIG.  */
> +extern const char *sigabbrev_np (int __sig) __THROW;
> +/* Return a string describing the meaning of the signal number in SIG,
> +   the result is not translated.  */
> +extern const char *sigdescr_np (int __sig) __THROW;
> +# endif
> +

OK.

>  /* Copy SRC to DEST, returning the address of the terminating '\0' in DEST.  */
>  extern char *__stpcpy (char *__restrict __dest, const char *__restrict __src)
>       __THROW __nonnull ((1, 2));
> diff --git a/string/strsignal.c b/string/strsignal.c
> index 701ce20e6e..a9b911ce6e 100644
> --- a/string/strsignal.c
> +++ b/string/strsignal.c
> @@ -21,19 +21,14 @@
>  #include <string.h>
>  #include <libintl.h>
>  #include <tls-internal.h>
> -#include <array_length.h>
>  
>  /* Return a string describing the meaning of the signal number SIGNUM.  */
>  char *
>  strsignal (int signum)
>  {
> -  const char *desc = NULL;
> -
> -  if (signum >= 0 && signum <= NSIG && signum < array_length (__sys_siglist))
> -    desc = __sys_siglist[signum];
> -
> +  const char *desc = __sigdescr_np (signum);

OK.

>    if (desc != NULL)
> -    return (char *) _(desc);
> +    return _(desc);

OK.

>  
>    struct tls_internal_t *tls_internal = __glibc_tls_internal ();
>    free (tls_internal->strsignal_buf);
> diff --git a/string/test-sig_np.c b/string/test-sig_np.c
> new file mode 100644
> index 0000000000..8b5117050c
> --- /dev/null
> +++ b/string/test-sig_np.c
> @@ -0,0 +1,51 @@
> +/* Test and sigabbrev_np and sigdescr_np.
> +   Copyright (C) 2020 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library; if not, see
> +   <https://www.gnu.org/licenses/>.  */
> +
> +#include <string.h>
> +#include <signal.h>
> +#include <array_length.h>
> +
> +#include <support/support.h>
> +#include <support/check.h>
> +
> +static const struct test_t
> +{
> +  int errno;
> +  const char *abbrev;
> +  const char *descr;
> +} tests[] =
> +{
> +#define N_(name)                      name
> +#define init_sig(sig, abbrev, desc)   { sig, abbrev, desc },
> +#include <siglist.h>
> +#undef init_sig
> +};
> +
> +static int
> +do_test (void)
> +{
> +  for (size_t i = 0; i < array_length (tests); i++)
> +    {
> +      TEST_COMPARE_STRING (sigabbrev_np (tests[i].errno), tests[i].abbrev);
> +      TEST_COMPARE_STRING (sigdescr_np (tests[i].errno), tests[i].descr);
> +    }
> +
> +  return 0;
> +}
> +
> +#include <support/test-driver.c>

OK.

> diff --git a/sysdeps/mach/hurd/i386/libc.abilist b/sysdeps/mach/hurd/i386/libc.abilist
> index 60696d827f..ff8ad98d03 100644
> --- a/sysdeps/mach/hurd/i386/libc.abilist
> +++ b/sysdeps/mach/hurd/i386/libc.abilist
> @@ -2182,6 +2182,8 @@ GLIBC_2.3.4 xdr_quad_t F
>  GLIBC_2.3.4 xdr_u_quad_t F
>  GLIBC_2.30 twalk_r F
>  GLIBC_2.32 mach_print F
> +GLIBC_2.32 sigabbrev_np F
> +GLIBC_2.32 sigdescr_np F
>  GLIBC_2.32 thrd_current F
>  GLIBC_2.32 thrd_equal F
>  GLIBC_2.32 thrd_sleep F
> diff --git a/sysdeps/unix/sysv/linux/aarch64/libc.abilist b/sysdeps/unix/sysv/linux/aarch64/libc.abilist
> index 48c790b15d..bb6045d8a6 100644
> --- a/sysdeps/unix/sysv/linux/aarch64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/aarch64/libc.abilist
> @@ -2155,3 +2155,5 @@ GLIBC_2.32 pthread_attr_setsigmask_np F
>  GLIBC_2.32 pthread_getaffinity_np F
>  GLIBC_2.32 pthread_getattr_np F
>  GLIBC_2.32 pthread_sigmask F
> +GLIBC_2.32 sigabbrev_np F
> +GLIBC_2.32 sigdescr_np F
> diff --git a/sysdeps/unix/sysv/linux/alpha/libc.abilist b/sysdeps/unix/sysv/linux/alpha/libc.abilist
> index cb70cb974f..8e15a58eaf 100644
> --- a/sysdeps/unix/sysv/linux/alpha/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/alpha/libc.abilist
> @@ -2237,6 +2237,8 @@ GLIBC_2.32 pthread_attr_setsigmask_np F
>  GLIBC_2.32 pthread_getaffinity_np F
>  GLIBC_2.32 pthread_getattr_np F
>  GLIBC_2.32 pthread_sigmask F
> +GLIBC_2.32 sigabbrev_np F
> +GLIBC_2.32 sigdescr_np F
>  GLIBC_2.4 _IO_fprintf F
>  GLIBC_2.4 _IO_printf F
>  GLIBC_2.4 _IO_sprintf F
> diff --git a/sysdeps/unix/sysv/linux/arm/be/libc.abilist b/sysdeps/unix/sysv/linux/arm/be/libc.abilist
> index 573eca117e..ce82b840e8 100644
> --- a/sysdeps/unix/sysv/linux/arm/be/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/arm/be/libc.abilist
> @@ -139,6 +139,8 @@ GLIBC_2.32 pthread_attr_setsigmask_np F
>  GLIBC_2.32 pthread_getaffinity_np F
>  GLIBC_2.32 pthread_getattr_np F
>  GLIBC_2.32 pthread_sigmask F
> +GLIBC_2.32 sigabbrev_np F
> +GLIBC_2.32 sigdescr_np F
>  GLIBC_2.4 _Exit F
>  GLIBC_2.4 _IO_2_1_stderr_ D 0xa0
>  GLIBC_2.4 _IO_2_1_stdin_ D 0xa0
> diff --git a/sysdeps/unix/sysv/linux/arm/le/libc.abilist b/sysdeps/unix/sysv/linux/arm/le/libc.abilist
> index 8a8633f0a4..c7a436cd42 100644
> --- a/sysdeps/unix/sysv/linux/arm/le/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/arm/le/libc.abilist
> @@ -136,6 +136,8 @@ GLIBC_2.32 pthread_attr_setsigmask_np F
>  GLIBC_2.32 pthread_getaffinity_np F
>  GLIBC_2.32 pthread_getattr_np F
>  GLIBC_2.32 pthread_sigmask F
> +GLIBC_2.32 sigabbrev_np F
> +GLIBC_2.32 sigdescr_np F
>  GLIBC_2.4 _Exit F
>  GLIBC_2.4 _IO_2_1_stderr_ D 0xa0
>  GLIBC_2.4 _IO_2_1_stdin_ D 0xa0
> diff --git a/sysdeps/unix/sysv/linux/csky/libc.abilist b/sysdeps/unix/sysv/linux/csky/libc.abilist
> index 3042a93084..7f51d47b2f 100644
> --- a/sysdeps/unix/sysv/linux/csky/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/csky/libc.abilist
> @@ -2099,3 +2099,5 @@ GLIBC_2.32 pthread_attr_setsigmask_np F
>  GLIBC_2.32 pthread_getaffinity_np F
>  GLIBC_2.32 pthread_getattr_np F
>  GLIBC_2.32 pthread_sigmask F
> +GLIBC_2.32 sigabbrev_np F
> +GLIBC_2.32 sigdescr_np F
> diff --git a/sysdeps/unix/sysv/linux/hppa/libc.abilist b/sysdeps/unix/sysv/linux/hppa/libc.abilist
> index a02a576321..053cda00a4 100644
> --- a/sysdeps/unix/sysv/linux/hppa/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/hppa/libc.abilist
> @@ -2058,6 +2058,8 @@ GLIBC_2.32 pthread_attr_setsigmask_np F
>  GLIBC_2.32 pthread_getaffinity_np F
>  GLIBC_2.32 pthread_getattr_np F
>  GLIBC_2.32 pthread_sigmask F
> +GLIBC_2.32 sigabbrev_np F
> +GLIBC_2.32 sigdescr_np F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/i386/libc.abilist b/sysdeps/unix/sysv/linux/i386/libc.abilist
> index f0b9c9e070..f18de50f9e 100644
> --- a/sysdeps/unix/sysv/linux/i386/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/i386/libc.abilist
> @@ -2224,6 +2224,8 @@ GLIBC_2.32 pthread_attr_setsigmask_np F
>  GLIBC_2.32 pthread_getaffinity_np F
>  GLIBC_2.32 pthread_getattr_np F
>  GLIBC_2.32 pthread_sigmask F
> +GLIBC_2.32 sigabbrev_np F
> +GLIBC_2.32 sigdescr_np F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/ia64/libc.abilist b/sysdeps/unix/sysv/linux/ia64/libc.abilist
> index 1534fd7a24..a1966cac5a 100644
> --- a/sysdeps/unix/sysv/linux/ia64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/ia64/libc.abilist
> @@ -2090,6 +2090,8 @@ GLIBC_2.32 pthread_attr_setsigmask_np F
>  GLIBC_2.32 pthread_getaffinity_np F
>  GLIBC_2.32 pthread_getattr_np F
>  GLIBC_2.32 pthread_sigmask F
> +GLIBC_2.32 sigabbrev_np F
> +GLIBC_2.32 sigdescr_np F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
> index 9a0ada4b52..8f44bc9231 100644
> --- a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
> @@ -140,6 +140,8 @@ GLIBC_2.32 pthread_attr_setsigmask_np F
>  GLIBC_2.32 pthread_getaffinity_np F
>  GLIBC_2.32 pthread_getattr_np F
>  GLIBC_2.32 pthread_sigmask F
> +GLIBC_2.32 sigabbrev_np F
> +GLIBC_2.32 sigdescr_np F
>  GLIBC_2.4 _Exit F
>  GLIBC_2.4 _IO_2_1_stderr_ D 0x98
>  GLIBC_2.4 _IO_2_1_stdin_ D 0x98
> diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
> index 333c35bf16..088f2fa0f2 100644
> --- a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
> @@ -2170,6 +2170,8 @@ GLIBC_2.32 pthread_attr_setsigmask_np F
>  GLIBC_2.32 pthread_getaffinity_np F
>  GLIBC_2.32 pthread_getattr_np F
>  GLIBC_2.32 pthread_sigmask F
> +GLIBC_2.32 sigabbrev_np F
> +GLIBC_2.32 sigdescr_np F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
> index 824eceec11..34c1c4fdca 100644
> --- a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
> @@ -2150,3 +2150,5 @@ GLIBC_2.32 pthread_attr_setsigmask_np F
>  GLIBC_2.32 pthread_getaffinity_np F
>  GLIBC_2.32 pthread_getattr_np F
>  GLIBC_2.32 pthread_sigmask F
> +GLIBC_2.32 sigabbrev_np F
> +GLIBC_2.32 sigdescr_np F
> diff --git a/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
> index 5a6dcdd21b..099d51e893 100644
> --- a/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
> @@ -2147,3 +2147,5 @@ GLIBC_2.32 pthread_attr_setsigmask_np F
>  GLIBC_2.32 pthread_getaffinity_np F
>  GLIBC_2.32 pthread_getattr_np F
>  GLIBC_2.32 pthread_sigmask F
> +GLIBC_2.32 sigabbrev_np F
> +GLIBC_2.32 sigdescr_np F
> diff --git a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
> index 6e5dbb28f1..ea86646c3b 100644
> --- a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
> @@ -2141,6 +2141,8 @@ GLIBC_2.32 pthread_attr_setsigmask_np F
>  GLIBC_2.32 pthread_getaffinity_np F
>  GLIBC_2.32 pthread_getattr_np F
>  GLIBC_2.32 pthread_sigmask F
> +GLIBC_2.32 sigabbrev_np F
> +GLIBC_2.32 sigdescr_np F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
> index 3ee64614b2..9adac43e36 100644
> --- a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
> @@ -2139,6 +2139,8 @@ GLIBC_2.32 pthread_attr_setsigmask_np F
>  GLIBC_2.32 pthread_getaffinity_np F
>  GLIBC_2.32 pthread_getattr_np F
>  GLIBC_2.32 pthread_sigmask F
> +GLIBC_2.32 sigabbrev_np F
> +GLIBC_2.32 sigdescr_np F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
> index dc62615524..c42c093cfb 100644
> --- a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
> @@ -2147,6 +2147,8 @@ GLIBC_2.32 pthread_attr_setsigmask_np F
>  GLIBC_2.32 pthread_getaffinity_np F
>  GLIBC_2.32 pthread_getattr_np F
>  GLIBC_2.32 pthread_sigmask F
> +GLIBC_2.32 sigabbrev_np F
> +GLIBC_2.32 sigdescr_np F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
> index 8cf78bcf51..605e60a35e 100644
> --- a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
> @@ -2141,6 +2141,8 @@ GLIBC_2.32 pthread_attr_setsigmask_np F
>  GLIBC_2.32 pthread_getaffinity_np F
>  GLIBC_2.32 pthread_getattr_np F
>  GLIBC_2.32 pthread_sigmask F
> +GLIBC_2.32 sigabbrev_np F
> +GLIBC_2.32 sigdescr_np F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/nios2/libc.abilist b/sysdeps/unix/sysv/linux/nios2/libc.abilist
> index 7817aeb0e2..7a57babca5 100644
> --- a/sysdeps/unix/sysv/linux/nios2/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/nios2/libc.abilist
> @@ -2188,3 +2188,5 @@ GLIBC_2.32 pthread_attr_setsigmask_np F
>  GLIBC_2.32 pthread_getaffinity_np F
>  GLIBC_2.32 pthread_getattr_np F
>  GLIBC_2.32 pthread_sigmask F
> +GLIBC_2.32 sigabbrev_np F
> +GLIBC_2.32 sigdescr_np F
> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
> index ca04e8f2d3..c3745c3733 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
> @@ -2197,6 +2197,8 @@ GLIBC_2.32 pthread_attr_setsigmask_np F
>  GLIBC_2.32 pthread_getaffinity_np F
>  GLIBC_2.32 pthread_getattr_np F
>  GLIBC_2.32 pthread_sigmask F
> +GLIBC_2.32 sigabbrev_np F
> +GLIBC_2.32 sigdescr_np F
>  GLIBC_2.4 _IO_fprintf F
>  GLIBC_2.4 _IO_printf F
>  GLIBC_2.4 _IO_sprintf F
> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
> index 10cb895639..719512e999 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
> @@ -2230,6 +2230,8 @@ GLIBC_2.32 pthread_attr_setsigmask_np F
>  GLIBC_2.32 pthread_getaffinity_np F
>  GLIBC_2.32 pthread_getattr_np F
>  GLIBC_2.32 pthread_sigmask F
> +GLIBC_2.32 sigabbrev_np F
> +GLIBC_2.32 sigdescr_np F
>  GLIBC_2.4 _IO_fprintf F
>  GLIBC_2.4 _IO_printf F
>  GLIBC_2.4 _IO_sprintf F
> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
> index 96ddc448d7..3f79daa39c 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
> @@ -2060,6 +2060,8 @@ GLIBC_2.32 pthread_attr_setsigmask_np F
>  GLIBC_2.32 pthread_getaffinity_np F
>  GLIBC_2.32 pthread_getattr_np F
>  GLIBC_2.32 pthread_sigmask F
> +GLIBC_2.32 sigabbrev_np F
> +GLIBC_2.32 sigdescr_np F
>  GLIBC_2.4 _IO_fprintf F
>  GLIBC_2.4 _IO_printf F
>  GLIBC_2.4 _IO_sprintf F
> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
> index deddb53d83..af1a2ae8a6 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
> @@ -2350,3 +2350,5 @@ GLIBC_2.32 pthread_attr_setsigmask_np F
>  GLIBC_2.32 pthread_getaffinity_np F
>  GLIBC_2.32 pthread_getattr_np F
>  GLIBC_2.32 pthread_sigmask F
> +GLIBC_2.32 sigabbrev_np F
> +GLIBC_2.32 sigdescr_np F
> diff --git a/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist b/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
> index 58217dcb13..ff5b64c1dd 100644
> --- a/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
> @@ -2117,3 +2117,5 @@ GLIBC_2.32 pthread_attr_setsigmask_np F
>  GLIBC_2.32 pthread_getaffinity_np F
>  GLIBC_2.32 pthread_getattr_np F
>  GLIBC_2.32 pthread_sigmask F
> +GLIBC_2.32 sigabbrev_np F
> +GLIBC_2.32 sigdescr_np F
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
> index c22c29b35a..576caca63c 100644
> --- a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
> @@ -2195,6 +2195,8 @@ GLIBC_2.32 pthread_attr_setsigmask_np F
>  GLIBC_2.32 pthread_getaffinity_np F
>  GLIBC_2.32 pthread_getattr_np F
>  GLIBC_2.32 pthread_sigmask F
> +GLIBC_2.32 sigabbrev_np F
> +GLIBC_2.32 sigdescr_np F
>  GLIBC_2.4 _IO_fprintf F
>  GLIBC_2.4 _IO_printf F
>  GLIBC_2.4 _IO_sprintf F
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
> index 568f1727c4..7201b10288 100644
> --- a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
> @@ -2096,6 +2096,8 @@ GLIBC_2.32 pthread_attr_setsigmask_np F
>  GLIBC_2.32 pthread_getaffinity_np F
>  GLIBC_2.32 pthread_getattr_np F
>  GLIBC_2.32 pthread_sigmask F
> +GLIBC_2.32 sigabbrev_np F
> +GLIBC_2.32 sigdescr_np F
>  GLIBC_2.4 _IO_fprintf F
>  GLIBC_2.4 _IO_printf F
>  GLIBC_2.4 _IO_sprintf F
> diff --git a/sysdeps/unix/sysv/linux/sh/be/libc.abilist b/sysdeps/unix/sysv/linux/sh/be/libc.abilist
> index d9988dae90..4f954ac7ee 100644
> --- a/sysdeps/unix/sysv/linux/sh/be/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/sh/be/libc.abilist
> @@ -2065,6 +2065,8 @@ GLIBC_2.32 pthread_attr_setsigmask_np F
>  GLIBC_2.32 pthread_getaffinity_np F
>  GLIBC_2.32 pthread_getattr_np F
>  GLIBC_2.32 pthread_sigmask F
> +GLIBC_2.32 sigabbrev_np F
> +GLIBC_2.32 sigdescr_np F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/sh/le/libc.abilist b/sysdeps/unix/sysv/linux/sh/le/libc.abilist
> index 39edeffe82..9db9ba5cc0 100644
> --- a/sysdeps/unix/sysv/linux/sh/le/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/sh/le/libc.abilist
> @@ -2062,6 +2062,8 @@ GLIBC_2.32 pthread_attr_setsigmask_np F
>  GLIBC_2.32 pthread_getaffinity_np F
>  GLIBC_2.32 pthread_getattr_np F
>  GLIBC_2.32 pthread_sigmask F
> +GLIBC_2.32 sigabbrev_np F
> +GLIBC_2.32 sigdescr_np F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
> index 8668e15e8c..ecb54db317 100644
> --- a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
> @@ -2186,6 +2186,8 @@ GLIBC_2.32 pthread_attr_setsigmask_np F
>  GLIBC_2.32 pthread_getaffinity_np F
>  GLIBC_2.32 pthread_getattr_np F
>  GLIBC_2.32 pthread_sigmask F
> +GLIBC_2.32 sigabbrev_np F
> +GLIBC_2.32 sigdescr_np F
>  GLIBC_2.4 _IO_fprintf F
>  GLIBC_2.4 _IO_printf F
>  GLIBC_2.4 _IO_sprintf F
> diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
> index eb884afa3e..74bd6efed8 100644
> --- a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
> @@ -2113,6 +2113,8 @@ GLIBC_2.32 pthread_attr_setsigmask_np F
>  GLIBC_2.32 pthread_getaffinity_np F
>  GLIBC_2.32 pthread_getattr_np F
>  GLIBC_2.32 pthread_sigmask F
> +GLIBC_2.32 sigabbrev_np F
> +GLIBC_2.32 sigdescr_np F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
> index a208fb3556..50e45a43e8 100644
> --- a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
> @@ -2071,6 +2071,8 @@ GLIBC_2.32 pthread_attr_setsigmask_np F
>  GLIBC_2.32 pthread_getaffinity_np F
>  GLIBC_2.32 pthread_getattr_np F
>  GLIBC_2.32 pthread_sigmask F
> +GLIBC_2.32 sigabbrev_np F
> +GLIBC_2.32 sigdescr_np F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
> index 3eca3493e2..59b26b097d 100644
> --- a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
> @@ -2168,3 +2168,5 @@ GLIBC_2.32 pthread_attr_setsigmask_np F
>  GLIBC_2.32 pthread_getaffinity_np F
>  GLIBC_2.32 pthread_getattr_np F
>  GLIBC_2.32 pthread_sigmask F
> +GLIBC_2.32 sigabbrev_np F
> +GLIBC_2.32 sigdescr_np F
>

OK.

--
Cheers,
Carlos.

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH v5 13/13] string: Add strerrorname and strerrordesc

Sourceware - libc-alpha mailing list
In reply to this post by Sourceware - libc-alpha mailing list
On 6/19/20 9:43 AM, Adhemerval Zanella wrote:
> The strerrorname returns error number name (i.g. "EINVAL" for EINVAL)
> while strerrordesc returns string describing error number (i.g
> "Invalid argument" for EINVAL).  Different than strerror, strerrordesc
> does not attempt to translate the return description and both functions
> return NULL for an invalid error number.
>
> They should be used instead of sys_errlist and sys_nerr and both are

s/and both/, both/g

> 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.

Why not strerrorname_np or strerrordesc_np? We don't have to use *_np,
but these functions are fiarly close in name to 'strerror' and so it
might be beneficial to use _np at the end, like you did for sigabbrev_np
and sigdescr_np. Thoughts?

No regression on x86_64 and i686.

Tested-by: Carlos O'Donell <[hidden email]>

> ---
>  NEWS                                          | 10 +++
>  include/stdio.h                               |  1 +
>  manual/errno.texi                             | 23 +++++++
>  stdio-common/errlist.c                        | 33 ++++++++++
>  stdio-common/test-strerr.c                    | 65 +++++++++++++++++++
>  string/Makefile                               |  2 +-
>  string/Versions                               |  1 +
>  string/strerrordesc.c                         | 26 ++++++++
>  string/strerrorname.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 +
>  .../sysv/linux/m68k/coldfire/libc.abilist     |  2 +
>  .../unix/sysv/linux/m68k/m680x0/libc.abilist  |  2 +
>  .../sysv/linux/microblaze/be/libc.abilist     |  2 +
>  .../sysv/linux/microblaze/le/libc.abilist     |  2 +
>  .../sysv/linux/mips/mips32/fpu/libc.abilist   |  2 +
>  .../sysv/linux/mips/mips32/nofpu/libc.abilist |  2 +
>  .../sysv/linux/mips/mips64/n32/libc.abilist   |  2 +
>  .../sysv/linux/mips/mips64/n64/libc.abilist   |  2 +
>  sysdeps/unix/sysv/linux/nios2/libc.abilist    |  2 +
>  .../linux/powerpc/powerpc32/fpu/libc.abilist  |  2 +
>  .../powerpc/powerpc32/nofpu/libc.abilist      |  2 +
>  .../linux/powerpc/powerpc64/be/libc.abilist   |  2 +
>  .../linux/powerpc/powerpc64/le/libc.abilist   |  2 +
>  .../unix/sysv/linux/riscv/rv64/libc.abilist   |  2 +
>  .../unix/sysv/linux/s390/s390-32/libc.abilist |  2 +
>  .../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 +
>  .../sysv/linux/sparc/sparc32/libc.abilist     |  2 +
>  .../sysv/linux/sparc/sparc64/libc.abilist     |  2 +
>  .../unix/sysv/linux/x86_64/64/libc.abilist    |  2 +
>  .../unix/sysv/linux/x86_64/x32/libc.abilist   |  2 +
>  42 files changed, 258 insertions(+), 1 deletion(-)
>  create mode 100644 stdio-common/test-strerr.c
>  create mode 100644 string/strerrordesc.c
>  create mode 100644 string/strerrorname.c
>  create mode 100644 sysdeps/mach/hurd/test-err_np.c
>
> diff --git a/NEWS b/NEWS
> index f504772eb6..888727581b 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -41,6 +41,16 @@ Major new features:
>    They should be used instead of sys_siglist or sys_sigabbrev and they
>    are both thread and async-signal safe.  These functions are GNU extensions.
>  
> +* The functions strerrorname and strerrordesc have been added.  The
> +  strerroname returns error number name (i.g. "EINVAL" for EINVAL) while

s/i.g./e.g./g

> +  strerrordesc returns string describing error number (i.g "Invalid argument"
> +  for EINVAL).  Different than strerror, strerrordesc does not attempt to
> +  translate the return description and both functions return NULL for an
> +  invalid error number.
> +
> +  They should be used instead of sys_errlist and sys_nerr and both are

s/and both/, both/g

> +  thread and async-signal safe.  These functions are GNU extensions.
> +
>  Deprecated and removed features, and other changes affecting compatibility:
>  
>  * The deprecated <sys/sysctl.h> header and the sysctl function have been
> diff --git a/include/stdio.h b/include/stdio.h
> index 9e3bf6fe42..bc67d020d4 100644
> --- a/include/stdio.h
> +++ b/include/stdio.h
> @@ -187,6 +187,7 @@ libc_hidden_proto (__libc_readline_unlocked);
>  
>  extern const char *const _sys_errlist_internal[] attribute_hidden;
>  extern const char *__get_errlist (int) attribute_hidden;
> +extern const char *__get_errname (int) attribute_hidden;

OK.

>  
>  libc_hidden_ldbl_proto (__asprintf)
>  
> diff --git a/manual/errno.texi b/manual/errno.texi
> index 8cb4ce8b48..dfc4001af0 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 (int @var{errnum})
> +@standards{GNU, string.h}
> +@safety{@prelim{}@mtsafe{@mtssigintr{}}@assafe{}@acsafe{}}

Use @mtsafe{} since it doesn't touch _sigintr.

> +This function returns the name describing the error @var{errnum} or
> +@code{NULL} if there is no known E* constant with this value (i.g "EINVAL"> +for @code{EINVAL}).

s/E*//g

> +
> +@pindex string.h
> +This function is a GNU extension, declared in the header file @file{string.h}.
> +@end deftypefun
> +
> +@deftypefun void errdesc_np (int @var{errnum})
> +@standards{GNU, string.h}
> +@safety{@prelim{}@mtsafe{@mtssigintr{}}@assafe{}@acsafe{}}

Use @mtsafe{} since it doesn't touch _sigintr.

> +This function returns the message describing the error @var{errnum} or
> +@code{NULL} if there is no known E* constant with this value (i.g "Invalid

s/E*//g

> +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
> diff --git a/stdio-common/errlist.c b/stdio-common/errlist.c
> index df52356066..d15f13a22a 100644
> --- a/stdio-common/errlist.c
> +++ b/stdio-common/errlist.c
> @@ -35,4 +35,37 @@ __get_errlist (int errnum)
>    return NULL;
>  }
>  
> +static const union sys_errname_t
> +{
> +  struct
> +  {
> +#define MSGSTRFIELD1(line) str##line
> +#define MSGSTRFIELD(line)  MSGSTRFIELD1(line)
> +#define _S(n, str)         char MSGSTRFIELD(__LINE__)[sizeof(str)];
> +#include <errlist.h>
> +#undef _S
> +  };
> +  char str[0];
> +} _sys_errname = { {
> +#define _S(n, s) s,
> +#include <errlist.h>
> +#undef _S
> +} };
> +
> +static const unsigned short _sys_errnameidx[] =
> +{
> +#define _S(n, s) [n] = offsetof(union sys_errname_t, MSGSTRFIELD(__LINE__)),
> +#include <errlist.h>
> +#undef _S
> +};
> +
> +const char *
> +__get_errname (int errnum)
> +{
> +  if (errnum < 0 || errnum >= array_length (_sys_errnameidx)
> +      || (errnum > 0 && _sys_errnameidx[errnum] == 0))
> +    return NULL;
> +  return _sys_errname.str + _sys_errnameidx[errnum];
> +}

OK.

> +
>  #include <errlist-compat.c>
> diff --git a/stdio-common/test-strerr.c b/stdio-common/test-strerr.c
> new file mode 100644
> index 0000000000..baa8d8e6d4
> --- /dev/null
> +++ b/stdio-common/test-strerr.c
> @@ -0,0 +1,65 @@
> +/* Test strerrorname and strerrordesc.
> +   Copyright (C) 2020 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.

OK.

> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library; if not, see
> +   <https://www.gnu.org/licenses/>.  */
> +
> +#include <string.h>
> +#include <errno.h>
> +#include <array_length.h>
> +
> +#include <support/support.h>
> +#include <support/check.h>
> +
> +#define N_(name)      name
> +
> +static const char *const errlist[] =
> +  {
> +/* This file is auto-generated from errlist.def.  */
> +#include <errlist.h>

OK. We cross reference the entire errlist.

> +  };
> +
> +#define MSGSTR_T errname_t
> +#define MSGSTR   errname
> +#define MSGIDX   errnameidx
> +#include <errlist-name.h>
> +#undef MSGSTR
> +#undef MSGIDX
> +
> +static int
> +do_test (void)
> +{
> +  TEST_VERIFY (strerrordesc (-1) == NULL);
> +  TEST_VERIFY (strerrordesc (array_length (errlist)) == NULL);

OK.

> +  for (size_t i = 0; i < array_length (errlist); i++)
> +    {
> +      if (errlist[i] == NULL)
> +        continue;
> +      TEST_COMPARE_STRING (strerrordesc (i), errlist[i]);
> +    }
> +
> +  TEST_VERIFY (strerrorname (-1) == NULL);
> +  TEST_VERIFY (strerrorname (array_length (errlist)) == NULL);
> +  for (size_t i = 0; i < array_length (errlist); i++)
> +    {
> +      if (errlist[i] == NULL)
> +        continue;
> +      TEST_COMPARE_STRING (strerrorname (i), errname.str + errnameidx[i]);
> +    }
> +
> +  return 0;
> +}

OK.

> +
> +#include <support/test-driver.c>
> diff --git a/string/Makefile b/string/Makefile
> index e5075521b7..fd06409197 100644
> --- a/string/Makefile
> +++ b/string/Makefile
> @@ -45,7 +45,7 @@ routines := strcat strchr strcmp strcoll strcpy strcspn \
>     envz basename \
>     strcoll_l strxfrm_l string-inlines memrchr \
>     xpg-strerror strerror_l explicit_bzero \
> -   sigdescr_np sigabbrev_np
> +   sigdescr_np sigabbrev_np strerrorname strerrordesc

Why not _np also?

>  
>  strop-tests := memchr memcmp memcpy memmove mempcpy memset memccpy \
>     stpcpy stpncpy strcat strchr strcmp strcpy strcspn \
> diff --git a/string/Versions b/string/Versions
> index 6f8dd2d372..7727fca001 100644
> --- a/string/Versions
> +++ b/string/Versions
> @@ -87,5 +87,6 @@ libc {
>    }
>    GLIBC_2.32 {
>      sigdescr_np; sigabbrev_np;
> +    strerrordesc; strerrorname;

Likewise.

>    }
>  }
> diff --git a/string/strerrordesc.c b/string/strerrordesc.c
> new file mode 100644
> index 0000000000..f59448f2d1
> --- /dev/null
> +++ b/string/strerrordesc.c
> @@ -0,0 +1,26 @@
> +/* Return string describing error number.
> +   Copyright (C) 2020 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library; if not, see
> +   <https://www.gnu.org/licenses/>.  */
> +
> +#include <stdio.h>
> +
> +const char *
> +__strerrordesc (int errnum)
> +{
> +  return __get_errlist (errnum);
> +}

OK.

> +weak_alias (__strerrordesc, strerrordesc)
> diff --git a/string/strerrorname.c b/string/strerrorname.c
> new file mode 100644
> index 0000000000..889ea0d245
> --- /dev/null
> +++ b/string/strerrorname.c
> @@ -0,0 +1,25 @@
> +/* Return string describing errno name.
> +   Copyright (C) 2020 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library; if not, see
> +   <https://www.gnu.org/licenses/>.  */
> +
> +#include <stdio.h>
> +
> +const char *
> +strerrorname (int errnum)
> +{
> +  return __get_errname (errnum);
> +}

OK.

> diff --git a/string/string.h b/string/string.h
> index 0119d7f45d..bb90219ada 100644
> --- a/string/string.h
> +++ b/string/string.h
> @@ -428,6 +428,13 @@ extern int __xpg_strerror_r (int __errnum, char *__buf, size_t __buflen)
>  extern char *strerror_r (int __errnum, char *__buf, size_t __buflen)
>       __THROW __nonnull ((2)) __wur  __attr_access ((__write_only__, 2, 3));
>  # endif
> +
> +# ifdef __USE_GNU

OK. GNU extension.

> +/* Return a string describing the meaning of tthe error in ERR.  */
> +extern const char *strerrordesc (int __err) __THROW;
> +/* Return a string with the error name in ERR.  */
> +extern const char *strerrorname (int __err) __THROW;
> +# endif
>  #endif
>  
>  #ifdef __USE_XOPEN2K8
> diff --git a/sysdeps/mach/hurd/i386/libc.abilist b/sysdeps/mach/hurd/i386/libc.abilist
> index ff8ad98d03..193ceba987 100644
> --- a/sysdeps/mach/hurd/i386/libc.abilist
> +++ b/sysdeps/mach/hurd/i386/libc.abilist
> @@ -2181,6 +2181,8 @@ GLIBC_2.3.4 setsourcefilter F
>  GLIBC_2.3.4 xdr_quad_t F
>  GLIBC_2.3.4 xdr_u_quad_t F
>  GLIBC_2.30 twalk_r F
> +GLIBC_2.32 errdescr_np F
> +GLIBC_2.32 errname_np F
>  GLIBC_2.32 mach_print F
>  GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
> diff --git a/sysdeps/mach/hurd/test-err_np.c b/sysdeps/mach/hurd/test-err_np.c
> new file mode 100644
> index 0000000000..3127141128
> --- /dev/null
> +++ b/sysdeps/mach/hurd/test-err_np.c
> @@ -0,0 +1,4 @@
> +#include <mach/error.h>
> +
> +#define ERR_MAP(value) err_get_code (value)
> +#include <stdio-common/test-err_np.c>
> diff --git a/sysdeps/unix/sysv/linux/aarch64/libc.abilist b/sysdeps/unix/sysv/linux/aarch64/libc.abilist
> index bb6045d8a6..f0529706ee 100644
> --- a/sysdeps/unix/sysv/linux/aarch64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/aarch64/libc.abilist
> @@ -2157,3 +2157,5 @@ GLIBC_2.32 pthread_getattr_np F
>  GLIBC_2.32 pthread_sigmask F
>  GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
> +GLIBC_2.32 strerrordesc F
> +GLIBC_2.32 strerrorname F
> diff --git a/sysdeps/unix/sysv/linux/alpha/libc.abilist b/sysdeps/unix/sysv/linux/alpha/libc.abilist
> index 8e15a58eaf..ac892eceda 100644
> --- a/sysdeps/unix/sysv/linux/alpha/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/alpha/libc.abilist
> @@ -2239,6 +2239,8 @@ GLIBC_2.32 pthread_getattr_np F
>  GLIBC_2.32 pthread_sigmask F
>  GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
> +GLIBC_2.32 strerrordesc F
> +GLIBC_2.32 strerrorname F
>  GLIBC_2.4 _IO_fprintf F
>  GLIBC_2.4 _IO_printf F
>  GLIBC_2.4 _IO_sprintf F
> diff --git a/sysdeps/unix/sysv/linux/arm/be/libc.abilist b/sysdeps/unix/sysv/linux/arm/be/libc.abilist
> index ce82b840e8..af574dfb9d 100644
> --- a/sysdeps/unix/sysv/linux/arm/be/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/arm/be/libc.abilist
> @@ -141,6 +141,8 @@ GLIBC_2.32 pthread_getattr_np F
>  GLIBC_2.32 pthread_sigmask F
>  GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
> +GLIBC_2.32 strerrordesc F
> +GLIBC_2.32 strerrorname F
>  GLIBC_2.4 _Exit F
>  GLIBC_2.4 _IO_2_1_stderr_ D 0xa0
>  GLIBC_2.4 _IO_2_1_stdin_ D 0xa0
> diff --git a/sysdeps/unix/sysv/linux/arm/le/libc.abilist b/sysdeps/unix/sysv/linux/arm/le/libc.abilist
> index c7a436cd42..bb0e8bf312 100644
> --- a/sysdeps/unix/sysv/linux/arm/le/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/arm/le/libc.abilist
> @@ -138,6 +138,8 @@ GLIBC_2.32 pthread_getattr_np F
>  GLIBC_2.32 pthread_sigmask F
>  GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
> +GLIBC_2.32 strerrordesc F
> +GLIBC_2.32 strerrorname F
>  GLIBC_2.4 _Exit F
>  GLIBC_2.4 _IO_2_1_stderr_ D 0xa0
>  GLIBC_2.4 _IO_2_1_stdin_ D 0xa0
> diff --git a/sysdeps/unix/sysv/linux/csky/libc.abilist b/sysdeps/unix/sysv/linux/csky/libc.abilist
> index 7f51d47b2f..8a612ece3e 100644
> --- a/sysdeps/unix/sysv/linux/csky/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/csky/libc.abilist
> @@ -2101,3 +2101,5 @@ GLIBC_2.32 pthread_getattr_np F
>  GLIBC_2.32 pthread_sigmask F
>  GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
> +GLIBC_2.32 strerrordesc F
> +GLIBC_2.32 strerrorname F
> diff --git a/sysdeps/unix/sysv/linux/hppa/libc.abilist b/sysdeps/unix/sysv/linux/hppa/libc.abilist
> index 053cda00a4..ccb61a322a 100644
> --- a/sysdeps/unix/sysv/linux/hppa/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/hppa/libc.abilist
> @@ -2060,6 +2060,8 @@ GLIBC_2.32 pthread_getattr_np F
>  GLIBC_2.32 pthread_sigmask F
>  GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
> +GLIBC_2.32 strerrordesc F
> +GLIBC_2.32 strerrorname F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/i386/libc.abilist b/sysdeps/unix/sysv/linux/i386/libc.abilist
> index f18de50f9e..bc5329d7b9 100644
> --- a/sysdeps/unix/sysv/linux/i386/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/i386/libc.abilist
> @@ -2226,6 +2226,8 @@ GLIBC_2.32 pthread_getattr_np F
>  GLIBC_2.32 pthread_sigmask F
>  GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
> +GLIBC_2.32 strerrordesc F
> +GLIBC_2.32 strerrorname F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/ia64/libc.abilist b/sysdeps/unix/sysv/linux/ia64/libc.abilist
> index a1966cac5a..8f8cbfa80b 100644
> --- a/sysdeps/unix/sysv/linux/ia64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/ia64/libc.abilist
> @@ -2092,6 +2092,8 @@ GLIBC_2.32 pthread_getattr_np F
>  GLIBC_2.32 pthread_sigmask F
>  GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
> +GLIBC_2.32 strerrordesc F
> +GLIBC_2.32 strerrorname F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
> index 8f44bc9231..802e16ac7d 100644
> --- a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
> @@ -142,6 +142,8 @@ GLIBC_2.32 pthread_getattr_np F
>  GLIBC_2.32 pthread_sigmask F
>  GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
> +GLIBC_2.32 strerrordesc F
> +GLIBC_2.32 strerrorname F
>  GLIBC_2.4 _Exit F
>  GLIBC_2.4 _IO_2_1_stderr_ D 0x98
>  GLIBC_2.4 _IO_2_1_stdin_ D 0x98
> diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
> index 088f2fa0f2..62bfa336b8 100644
> --- a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
> @@ -2172,6 +2172,8 @@ GLIBC_2.32 pthread_getattr_np F
>  GLIBC_2.32 pthread_sigmask F
>  GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
> +GLIBC_2.32 strerrordesc F
> +GLIBC_2.32 strerrorname F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
> index 34c1c4fdca..680c7b0c77 100644
> --- a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
> @@ -2152,3 +2152,5 @@ GLIBC_2.32 pthread_getattr_np F
>  GLIBC_2.32 pthread_sigmask F
>  GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
> +GLIBC_2.32 strerrordesc F
> +GLIBC_2.32 strerrorname F
> diff --git a/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
> index 099d51e893..e102493f6c 100644
> --- a/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
> @@ -2149,3 +2149,5 @@ GLIBC_2.32 pthread_getattr_np F
>  GLIBC_2.32 pthread_sigmask F
>  GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
> +GLIBC_2.32 strerrordesc F
> +GLIBC_2.32 strerrorname F
> diff --git a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
> index ea86646c3b..28588017fa 100644
> --- a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
> @@ -2143,6 +2143,8 @@ GLIBC_2.32 pthread_getattr_np F
>  GLIBC_2.32 pthread_sigmask F
>  GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
> +GLIBC_2.32 strerrordesc F
> +GLIBC_2.32 strerrorname F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
> index 9adac43e36..64c99116c0 100644
> --- a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
> @@ -2141,6 +2141,8 @@ GLIBC_2.32 pthread_getattr_np F
>  GLIBC_2.32 pthread_sigmask F
>  GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
> +GLIBC_2.32 strerrordesc F
> +GLIBC_2.32 strerrorname F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
> index c42c093cfb..7e197736d8 100644
> --- a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
> @@ -2149,6 +2149,8 @@ GLIBC_2.32 pthread_getattr_np F
>  GLIBC_2.32 pthread_sigmask F
>  GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
> +GLIBC_2.32 strerrordesc F
> +GLIBC_2.32 strerrorname F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
> index 605e60a35e..e1964effc6 100644
> --- a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
> @@ -2143,6 +2143,8 @@ GLIBC_2.32 pthread_getattr_np F
>  GLIBC_2.32 pthread_sigmask F
>  GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
> +GLIBC_2.32 strerrordesc F
> +GLIBC_2.32 strerrorname F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/nios2/libc.abilist b/sysdeps/unix/sysv/linux/nios2/libc.abilist
> index 7a57babca5..f647f86c09 100644
> --- a/sysdeps/unix/sysv/linux/nios2/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/nios2/libc.abilist
> @@ -2190,3 +2190,5 @@ GLIBC_2.32 pthread_getattr_np F
>  GLIBC_2.32 pthread_sigmask F
>  GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
> +GLIBC_2.32 strerrordesc F
> +GLIBC_2.32 strerrorname F
> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
> index c3745c3733..8998f3e0ab 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
> @@ -2199,6 +2199,8 @@ GLIBC_2.32 pthread_getattr_np F
>  GLIBC_2.32 pthread_sigmask F
>  GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
> +GLIBC_2.32 strerrordesc F
> +GLIBC_2.32 strerrorname F
>  GLIBC_2.4 _IO_fprintf F
>  GLIBC_2.4 _IO_printf F
>  GLIBC_2.4 _IO_sprintf F
> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
> index 719512e999..a96c6d1ce2 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
> @@ -2232,6 +2232,8 @@ GLIBC_2.32 pthread_getattr_np F
>  GLIBC_2.32 pthread_sigmask F
>  GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
> +GLIBC_2.32 strerrordesc F
> +GLIBC_2.32 strerrorname F
>  GLIBC_2.4 _IO_fprintf F
>  GLIBC_2.4 _IO_printf F
>  GLIBC_2.4 _IO_sprintf F
> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
> index 3f79daa39c..f9f0a9dd93 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
> @@ -2062,6 +2062,8 @@ GLIBC_2.32 pthread_getattr_np F
>  GLIBC_2.32 pthread_sigmask F
>  GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
> +GLIBC_2.32 strerrordesc F
> +GLIBC_2.32 strerrorname F
>  GLIBC_2.4 _IO_fprintf F
>  GLIBC_2.4 _IO_printf F
>  GLIBC_2.4 _IO_sprintf F
> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
> index af1a2ae8a6..921098b1f3 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
> @@ -2352,3 +2352,5 @@ GLIBC_2.32 pthread_getattr_np F
>  GLIBC_2.32 pthread_sigmask F
>  GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
> +GLIBC_2.32 strerrordesc F
> +GLIBC_2.32 strerrorname F
> diff --git a/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist b/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
> index ff5b64c1dd..1e65005b9f 100644
> --- a/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
> @@ -2119,3 +2119,5 @@ GLIBC_2.32 pthread_getattr_np F
>  GLIBC_2.32 pthread_sigmask F
>  GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
> +GLIBC_2.32 strerrordesc F
> +GLIBC_2.32 strerrorname F
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
> index 576caca63c..b31811135b 100644
> --- a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
> @@ -2197,6 +2197,8 @@ GLIBC_2.32 pthread_getattr_np F
>  GLIBC_2.32 pthread_sigmask F
>  GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
> +GLIBC_2.32 strerrordesc F
> +GLIBC_2.32 strerrorname F
>  GLIBC_2.4 _IO_fprintf F
>  GLIBC_2.4 _IO_printf F
>  GLIBC_2.4 _IO_sprintf F
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
> index 7201b10288..c30fc0ef71 100644
> --- a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
> @@ -2098,6 +2098,8 @@ GLIBC_2.32 pthread_getattr_np F
>  GLIBC_2.32 pthread_sigmask F
>  GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
> +GLIBC_2.32 strerrordesc F
> +GLIBC_2.32 strerrorname F
>  GLIBC_2.4 _IO_fprintf F
>  GLIBC_2.4 _IO_printf F
>  GLIBC_2.4 _IO_sprintf F
> diff --git a/sysdeps/unix/sysv/linux/sh/be/libc.abilist b/sysdeps/unix/sysv/linux/sh/be/libc.abilist
> index 4f954ac7ee..9cbe4a650a 100644
> --- a/sysdeps/unix/sysv/linux/sh/be/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/sh/be/libc.abilist
> @@ -2067,6 +2067,8 @@ GLIBC_2.32 pthread_getattr_np F
>  GLIBC_2.32 pthread_sigmask F
>  GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
> +GLIBC_2.32 strerrordesc F
> +GLIBC_2.32 strerrorname F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/sh/le/libc.abilist b/sysdeps/unix/sysv/linux/sh/le/libc.abilist
> index 9db9ba5cc0..c00327a607 100644
> --- a/sysdeps/unix/sysv/linux/sh/le/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/sh/le/libc.abilist
> @@ -2064,6 +2064,8 @@ GLIBC_2.32 pthread_getattr_np F
>  GLIBC_2.32 pthread_sigmask F
>  GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
> +GLIBC_2.32 strerrordesc F
> +GLIBC_2.32 strerrorname F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
> index ecb54db317..a990eee8f8 100644
> --- a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
> @@ -2188,6 +2188,8 @@ GLIBC_2.32 pthread_getattr_np F
>  GLIBC_2.32 pthread_sigmask F
>  GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
> +GLIBC_2.32 strerrordesc F
> +GLIBC_2.32 strerrorname F
>  GLIBC_2.4 _IO_fprintf F
>  GLIBC_2.4 _IO_printf F
>  GLIBC_2.4 _IO_sprintf F
> diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
> index 74bd6efed8..e988546b20 100644
> --- a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
> @@ -2115,6 +2115,8 @@ GLIBC_2.32 pthread_getattr_np F
>  GLIBC_2.32 pthread_sigmask F
>  GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
> +GLIBC_2.32 strerrordesc F
> +GLIBC_2.32 strerrorname F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
> index 50e45a43e8..fa10e68d3a 100644
> --- a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
> @@ -2073,6 +2073,8 @@ GLIBC_2.32 pthread_getattr_np F
>  GLIBC_2.32 pthread_sigmask F
>  GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
> +GLIBC_2.32 strerrordesc F
> +GLIBC_2.32 strerrorname F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
> index 59b26b097d..29119996ae 100644
> --- a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
> +++ b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
> @@ -2170,3 +2170,5 @@ GLIBC_2.32 pthread_getattr_np F
>  GLIBC_2.32 pthread_sigmask F
>  GLIBC_2.32 sigabbrev_np F
>  GLIBC_2.32 sigdescr_np F
> +GLIBC_2.32 strerrordesc F
> +GLIBC_2.32 strerrorname F
>

OK.

--
Cheers,
Carlos.

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH v5 02/13] signal: Move sys_siglist to a compat symbol

Sourceware - libc-alpha mailing list
In reply to this post by Sourceware - libc-alpha mailing list


On 02/07/2020 15:32, Carlos O'Donell wrote:

> On 6/19/20 9:43 AM, Adhemerval Zanella wrote:
>> The symbol was deprecated by strsignal and its usage imposes issues
>> such as copy relocations.
>>
>> Its internal name is changed to __sys_siglist and __sys_sigabbrev to
>> avoid static linking usage.  The compat code is also refactored, since
>> both Linux and Hurd usage the same strategy: export the same array with
>> different object sizes.
>>
>> The libSegfault change avoids calling strsignal on the SIGFAULT signal
>> handler (the current usage is already sketchy, adding a call that
>> potentially issue locale internal function is even sketchier).
>>
>> Checked on x86_64-linux-gnu and i686-linux-gnu. I also run a check-abi
>> on all affected platforms.
>
> OK for master.
>
> Reviewed-by: Carlos O'Donell <[hidden email]>
>
>> ---

>>
>> diff --git a/NEWS b/NEWS
>> index a660fc59a8..0f5fa0f3b1 100644
>> --- a/NEWS
>> +++ b/NEWS
>> @@ -51,6 +51,12 @@ Deprecated and removed features, and other changes affecting compatibility:
>>  * ldconfig now defaults to the new format for ld.so.cache. glibc has
>>    already supported this format for almost 20 years.
>>  
>> +* The deprecated arrays sys_siglist, _sys_siglist, and sys_sigabbrev
>> +  are no longer available to newly linked binaries, and their declarations
>> +  have been removed from <string.h>.  They are exported solely as
>> +  compatibility symbols to support old binaries.  All programs should use
>> +  strsignal instead.
>
> OK. Thanks for the NEWS entry.
>
> Could you please update:
> https://sourceware.org/glibc/wiki/Release/2.32#Packaging_Changes
> to indicate this change might affect downstream distros and cause FTBS
> which will need fixing by rewriting to use strsignal()? A code example in
> the wiki might help downstream fix things up.

Done, I plan to extend the entry with an example of using the new safe
interface once I reach the patch in my rebase.

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH v5 03/13] signal: Move sys_errlist to a compat symbol

Sourceware - libc-alpha mailing list
In reply to this post by Sourceware - libc-alpha mailing list


On 02/07/2020 15:48, Carlos O'Donell wrote:

> On 6/19/20 9:43 AM, Adhemerval Zanella wrote:
>> The symbol is deprecated by strerror since its usage imposes some issues
>> such as copy relocations.
>
> Agreed, thanks for deprecating this.
>  
>> Its internal name is also changed to _sys_errlist_internal to avoid
>> static linking usage.  The compat code is also refactored by removing
>> the over enginered errlist-compat.c generation from manual entried and
>> extra comment token in linker script file.  It disantangle the code
>> generation from manual and simplify both Linux and Hurd compat code.
>>
>> The definitions from errlist.c are moved to errlist.h and a new test
>> is added to avoid a new errno entry without an associated one in manual.
>>
>> Checked on x86_64-linux-gnu and i686-linux-gnu. I also run a check-abi
>> on all affected platforms.
>
> OK for master if you copy all TRANS statements into C-style comments
> in the final committed version of errlist.h, these are special comments
> processed by po/Makefile instructions to gettext.
>
> I verified that libc.pot regeneration catches all the translations
> in errlist.h (but the translation helper text in TRANS is missing as
> noted).

Ack, I have copied all the TRANS comment of the new sysdeps/gnu/errlist.h.

>> diff --git a/NEWS b/NEWS
>> index 0f5fa0f3b1..df03a34657 100644
>> --- a/NEWS
>> +++ b/NEWS
>> @@ -57,6 +57,12 @@ Deprecated and removed features, and other changes affecting compatibility:
>>    compatibility symbols to support old binaries.  All programs should use
>>    strsignal instead.
>>  
>> +* The deprecated symbols sys_errlist, _sys_errlist, sys_nerr, and _sys_nerr
>> +  are no longer available to newly linked binaries, and their declarations
>> +  have been removed from from <stdio.h>.  They are exported solely as
>> +  compatibility symbols to support old binaries.  All programs should use
>> +  strerror or strerror_r instead.
>
> OK. Thanks for that.
>
> Likewise see my note about updating packaging change notes in the wiki for
> the release such that we have a summary for downstream maintainers that may
> need to fix distro software. While they might read the NEWS it's easier to
> point them at a detailed list of packaging changes that we write (and the
> audience for those is downstream distro maintainers rather than the more
> generic NEWS information).

Ack, I have added a note and I plan to extend it once I go in the
extension review.

>
>> diff --git a/sysdeps/gnu/errlist.h b/sysdeps/gnu/errlist.h
>> new file mode 100644
>> index 0000000000..d4c857b9a9
>> --- /dev/null
>> +++ b/sysdeps/gnu/errlist.h
>> @@ -0,0 +1,448 @@
>> +#ifndef ERR_MAP
>> +#define ERR_MAP(value) value
>
> Please move all of the TRANS entries into this file as C-style comments.
>
> They are required information for the accurate translation of the strings.

Ack, I have added them.
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH v5 04/13] linux: Fix __NSIG_WORDS and add __NSIG_BYTES

Sourceware - libc-alpha mailing list
In reply to this post by Sourceware - libc-alpha mailing list


On 02/07/2020 16:08, Carlos O'Donell wrote:
> On 6/19/20 9:43 AM, Adhemerval Zanella wrote:
>> The __NSIG_WORDS value is based on minimum number of words to hold
>> the maximum number of signal supported by the architecture.  Maximum
>
> s/signal/signals/g

Ack.

>
>> number of signals non multiple of word is rounded up.
>
> ^^^ This sentence needs rewriting for clarity in the commit message.

In fact I think this setence is redundant, the first one already states
that __NSIG_WORDS is suffice to represent all the supported signals
and the rounding up should be implicit to obtain it. I removed the
confusing sentence.

>  
>> This patch also adds __NSIG_BYTES, which is the number of bytes
>> required to represent the support number of signals.  It is used on
>
> s/support/supported/g, s/on/in/g

Ack.

>
>> syscall which takes a sigset_t.
>
> s/sycall/syscalls/g

Ack.

>
> Conceptually I like changes like this which move from hard-coded values
> like foo/8 to more concrete semantics e.g. use a value that represents
> what you want to express (and not the result of some other computation).
>  
>> Checked on x86_64-linux-gnu and i686-linux-gnu.
>
> OK for master with cleaned up commit message.
>
> No regressions on x86_64 and i686.
>
> Tested-by: Carlos O'Donell <[hidden email]>
> Reviewed-by: Carlos O'Donell <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH v5 05/13] string: Remove old TLS usage on strsignal

Sourceware - libc-alpha mailing list
In reply to this post by Sourceware - libc-alpha mailing list


On 02/07/2020 16:32, Carlos O'Donell wrote:
> On 6/19/20 9:43 AM, Adhemerval Zanella wrote:
>> The per-thread state is refactored two use two strategies:
>>
>>   1. The default one uses a TLS structure, which will be place in the
>>      static TLS space (using __thread keyword).
>
> s/place/placed/g

Ack.

>
> OK.
>  
>>   2. Linux allocates on struct pthread and access it through THREAD_*
>>      macros.
>
> s/on/via/g

Ack.

>
> OK.
>
>  
>> The default strategy has the disadvantage of increasing libc.so static
>> TLS consumption and thus descreasing the possible surplus used in
>> some scenarios (which might be mitigated by BZ#25051 fix).
>
> s/descreasing/decreasing/g

Ack.

>
>>
>> It is used only on Hurd, where accessing the thread point in single
>
> s/point in/storage in the/g

Ack.

>
>> thread case is not straightforward (afaiu, Hurd developers could
>> correct me here).
>>
>> The fallback static allocation used for allocation failure is also
>> removed: defining its size is problematic without synchronize with
>
> s/synchronize/synchronizing/g

Ack




Reply | Threaded
Open this post in threaded view
|

Re: [PATCH v5 06/13] string: Implement strerror in terms of strerror_l

Sourceware - libc-alpha mailing list
In reply to this post by Sourceware - libc-alpha mailing list


On 02/07/2020 16:44, Carlos O'Donell wrote:
> On 6/19/20 9:43 AM, Adhemerval Zanella wrote:
>> Checked on x86-64-linux-gnu, i686-linux-gnu, powerpc64le-linux-gnu,
>> and s390x-linux-gnu.
>
> OK for master if you accept the NEWS changes suggested.
>
> Please make sure to follow up with the linux man pages project to update
> their strerror documentation, particularly now that strerror is now
> MT-Safe, which is a good step forward.

Ack.

>
> Tested-by: Carlos O'Donell <[hidden email]>
> Reviewed-by: Carlos O'Donell <[hidden email]>
>
>> ---
>>  NEWS                      |  4 ++++
>>  include/string.h          |  4 ++++
>>  string/strerror.c         | 22 ++--------------------
>>  string/strerror_l.c       | 15 ++++++++++-----
>>  sysdeps/mach/strerror_l.c |  4 +++-
>>  5 files changed, 23 insertions(+), 26 deletions(-)
>>
>> diff --git a/NEWS b/NEWS
>> index df03a34657..ec39b6e056 100644
>> --- a/NEWS
>> +++ b/NEWS
>> @@ -63,6 +63,10 @@ Deprecated and removed features, and other changes affecting compatibility:
>>    compatibility symbols to support old binaries.  All programs should use
>>    strerror or strerror_r instead.
>>  
>> +* Both strerror and strerror_l now share the same internal buffer, meaning
>> +  that the returned string pointer might be invalidated or contents might
>> +  be overwritten in subsequent calls of either symbol.
>
> Suggest:
>
> * Both strerror and strerror_l now share the same internal buffer in the calling
>   thread, meaning that the returned string pointer may be invalided or contents
>   might be overwritten on subsequent calls in the same thread or if the thread
>   is terminated.

Ack, I just adjusted the line wrap to fit on 78 columns and add
the note it makes the strerror MT-safe:

* Both strerror and strerror_l now share the same internal buffer in the
  calling thread, meaning that the returned string pointer may be invalided
  or contents might be overwritten on subsequent calls in the same thread or
  if the thread is terminated.  It makes strerror MT-safe.

>
> Notes:
> - If the thread is terminated then __libc_thread_freeres will free the storage
>   via __glibc_tls_internal_free.
> - It is only within the calling thread that this matters. It makes strerror
>   MT-safe.

I have add this implementation detail notes on commit message.

>
>> +
>>  Changes to build and runtime requirements:
>>  
>>  * powerpc64le requires GCC 7.4 or newer.  This is required for supporting
>> diff --git a/include/string.h b/include/string.h
>> index 4d622f1c03..3a33327cc0 100644
>> --- a/include/string.h
>> +++ b/include/string.h
>> @@ -4,6 +4,7 @@
>>  /* Some of these are defined as macros in the real string.h, so we must
>>     prototype them before including it.  */
>>  #include <sys/types.h>
>> +#include <locale.h>
>
> OK.
>
>>  
>>  extern void *__memccpy (void *__dest, const void *__src,
>>   int __c, size_t __n);
>> @@ -50,6 +51,8 @@ extern int __ffs (int __i) __attribute__ ((const));
>>  
>>  extern char *__strerror_r (int __errnum, char *__buf, size_t __buflen);
>>  
>> +extern char *__strerror_l (int __errnum, locale_t __loc);
>> +
>
> OK
>
>>  /* Called as part of the thread shutdown sequence.  */
>>  void __strerror_thread_freeres (void) attribute_hidden;
>>  
>> @@ -113,6 +116,7 @@ libc_hidden_proto (memmem)
>>  extern __typeof (memmem) __memmem;
>>  libc_hidden_proto (__memmem)
>>  libc_hidden_proto (__ffs)
>> +libc_hidden_proto (__strerror_l)
>
> OK.
>
>>  
>>  #if IS_IN (libc)
>>  /* Avoid hidden reference to IFUNC symbol __explicit_bzero_chk.  */
>> diff --git a/string/strerror.c b/string/strerror.c
>> index 283ab70f91..35c749016e 100644
>> --- a/string/strerror.c
>> +++ b/string/strerror.c
>> @@ -15,29 +15,11 @@
>>     License along with the GNU C Library; if not, see
>>     <https://www.gnu.org/licenses/>.  */
>>  
>> -#include <libintl.h>
>> -#include <stdio.h>
>>  #include <string.h>
>> -#include <errno.h>
>> -
>> -/* Return a string describing the errno code in ERRNUM.
>> -   The storage is good only until the next call to strerror.
>> -   Writing to the storage causes undefined behavior.  */
>> -libc_freeres_ptr (static char *buf);
>> +#include <locale/localeinfo.h>
>>  
>>  char *
>>  strerror (int errnum)
>>  {
>> -  char *ret = __strerror_r (errnum, NULL, 0);
>> -  int saved_errno;
>> -
>> -  if (__glibc_likely (ret != NULL))
>> -    return ret;
>> -  saved_errno = errno;
>> -  if (buf == NULL)
>> -    buf = malloc (1024);
>> -  __set_errno (saved_errno);
>> -  if (buf == NULL)
>> -    return _("Unknown error");
>> -  return __strerror_r (errnum, buf, 1024);
>> +  return __strerror_l (errnum, __libc_tsd_get (locale_t, LOCALE));
>
> OK.
>
>>  }
>> diff --git a/string/strerror_l.c b/string/strerror_l.c
>> index 309f42e66b..017bd14b99 100644
>> --- a/string/strerror_l.c
>> +++ b/string/strerror_l.c
>> @@ -20,8 +20,7 @@
>>  #include <stdio.h>
>>  #include <stdlib.h>
>>  #include <string.h>
>> -#include <sys/param.h>
>> -#include <libc-symbols.h>
>> +#include <errno.h>
>>  
>>  static __thread char *last_value;
>>  
>> @@ -38,8 +37,9 @@ translate (const char *str, locale_t loc)
>>  
>>  /* Return a string describing the errno code in ERRNUM.  */
>>  char *
>> -strerror_l (int errnum, locale_t loc)
>> +__strerror_l (int errnum, locale_t loc)
>>  {
>> +  int saved_errno = errno;
>>    char *err = (char *) __get_errlist (errnum);
>>    if (__glibc_unlikely (err == NULL))
>>      {
>> @@ -48,11 +48,16 @@ strerror_l (int errnum, locale_t loc)
>>        translate ("Unknown error ", loc), errnum) == -1)
>>   last_value = NULL;
>>  
>> -      return last_value;
>> +      err = last_value;
>>      }
>> +  else
>> +    err = (char *) translate (err, loc);
>>  
>> -  return (char *) translate (err, loc);
>> +  __set_errno (saved_errno);
>> +  return err;
>>  }
>> +weak_alias (__strerror_l, strerror_l)
>> +libc_hidden_def (__strerror_l)
>
> OK.
>
>>  
>>  void
>>  __strerror_thread_freeres (void)
>> diff --git a/sysdeps/mach/strerror_l.c b/sysdeps/mach/strerror_l.c
>> index f514af341e..b6c9fdbe80 100644
>> --- a/sysdeps/mach/strerror_l.c
>> +++ b/sysdeps/mach/strerror_l.c
>> @@ -42,7 +42,7 @@ translate (const char *str, locale_t loc)
>>  
>>  /* Return a string describing the errno code in ERRNUM.  */
>>  char *
>> -strerror_l (int errnum, locale_t loc)
>> +__strerror_l (int errnum, locale_t loc)
>>  {
>>    int system;
>>    int sub;
>> @@ -86,6 +86,8 @@ strerror_l (int errnum, locale_t loc)
>>  
>>    return (char *) translate (es->subsystem[sub].codes[code], loc);
>>  }
>> +weak_alias (__strerror_l, strerror_l)
>> +libc_hidden_def (__strerror_l)
>
> OK.
>
>>  
>>  /* This is called when a thread is exiting to free the last_value string.  */
>>  void
>>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH v5 09/13] string: Add strsignal test

Sourceware - libc-alpha mailing list
In reply to this post by Sourceware - libc-alpha mailing list


On 02/07/2020 17:01, Carlos O'Donell wrote:
> On 6/19/20 9:43 AM, Adhemerval Zanella wrote:
>> +tests-container += tst-strsignal
>
> Did you intend to put this in tests-container?

I have added them for some reason in development, but indeed there
is no need.  I have removed it from tests-container.

>
> The test does nothing particularly destructive to the environment.
>
> It will only increase the test time by running it in a container.
>
> Likewise for patch 10.
>

I also moved it to the default tests.
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH v5 12/13] string: Add sigabbrev_np and sigdescr_np

Sourceware - libc-alpha mailing list
In reply to this post by Sourceware - libc-alpha mailing list


On 02/07/2020 18:13, Carlos O'Donell wrote:
> On 6/19/20 9:43 AM, Adhemerval Zanella wrote:
>> The sigabbrev_np returns the abbreviated signal name (i.g. "HUP" for
>> SIGHUP) while sigdescr_np returns string describing error number
>
> s/returns string/returns the string/g
> s/ error/ the error/g

Ack.

>
>> (i.g "Hangup" for SIGHUP).  Different than strsignal, sigdescr_np
>> does not attempt to translate the return description and both
>> functions return NULL for an invalid signal number.
>>
>> They should be used instead of sys_siglist or sys_sigabbrev and they
>> are both thread and async-signal safe.  They are added as GNU
>> extensions on string.h header (same as strsignal).
>
> These are perfect functions to use in place of sys_siglist and
> sys_sigabbrev. Thus we now have functions to access the old data in
> a way that avoids exposing the data to COPY relocations (and the
> size encoded in that ABI). Thanks for fixing this up.
>  
>> Checked on x86-64-linux-gnu, i686-linux-gnu, powerpc64le-linux-gnu,
>> and s390x-linux-gnu.
>
> OK for master if you accept the manual suggestions and commit message
> changes.

Done, I also extended a bit the release wiki with a simple example on
how to use these interfaces.

>
> No regressions on x86_64 and i686.
>
> Tested-by: Carlos O'Donell <[hidden email]>
> Reviewed-by: Carlos O'Donell <[hidden email]>
>

>>
>> diff --git a/NEWS b/NEWS
>> index ec39b6e056..f504772eb6 100644
>> --- a/NEWS
>> +++ b/NEWS
>> @@ -31,6 +31,16 @@ Major new features:
>>    pthread_attr_getsigmask_np have been added.  They allow applications
>>    to specify the signal mask of a thread created with pthread_create.
>>  
>> +* The functions sigabbrev_np and sigdescr_np have been added.  The
>> +  sigabbrev_np returns the abbreviated signal name (i.g. "HUP" for SIGHUP)
>> +  while sigdescr_np returns string describing signal number (i.g "Hangup"
>
> s/returns string/returns a string/g
> s/ signal/ the signal/g

Ack.

>
>> +  for SIGHUP).  Different than strsignal, sigdescr_np does not attempt
>> +  to translate the return description and both functions return NULL for
>> +  an invalid signal number.
>> +
>> +  They should be used instead of sys_siglist or sys_sigabbrev and they
>> +  are both thread and async-signal safe.  These functions are GNU extensions.
>
> OK.
>
>> +
>>  Deprecated and removed features, and other changes affecting compatibility:
>>  
>>  * The deprecated <sys/sysctl.h> header and the sysctl function have been
>> diff --git a/include/signal.h b/include/signal.h
>> index 3d6315b741..b4ee02d153 100644
>> --- a/include/signal.h
>> +++ b/include/signal.h
>> @@ -16,7 +16,8 @@ libc_hidden_proto (__libc_current_sigrtmin)
>>  libc_hidden_proto (__libc_current_sigrtmax)
>>  extern const char * const __sys_siglist[_NSIG];
>>  libc_hidden_proto (__sys_siglist)
>> -
>> +extern const char * const __sys_sigabbrev[_NSIG];
>> +libc_hidden_proto (__sys_sigabbrev)
>
> OK.
>
>>  
>>  /* Now define the internal interfaces.  */
>>  extern __sighandler_t __bsd_signal (int __sig, __sighandler_t __handler);
>> diff --git a/include/string.h b/include/string.h
>> index ce01ad8254..f4ce138622 100644
>> --- a/include/string.h
>> +++ b/include/string.h
>> @@ -53,6 +53,9 @@ extern char *__strerror_r (int __errnum, char *__buf, size_t __buflen);
>>  
>>  extern char *__strerror_l (int __errnum, locale_t __loc);
>>  
>> +extern const char *__sigdescr_np (int __errnum);
>> +libc_hidden_proto (__sigdescr_np)
>
> OK.
>
>> +
>>  /* Get _STRING_ARCH_unaligned.  */
>>  #include <string_private.h>
>>  #endif
>> diff --git a/manual/signal.texi b/manual/signal.texi
>> index 34def1c06c..a19dff85f8 100644
>> --- a/manual/signal.texi
>> +++ b/manual/signal.texi
>> @@ -880,6 +880,30 @@ to @var{signum}.
>>  This function is a BSD feature, declared in the header file @file{signal.h}.
>>  @end deftypefun
>>  
>> +@deftypefun void sigdescr_np (int @var{signum})
>> +@standards{GNU, string.h}
>> +@safety{@prelim{}@mtsafe{@mtssigintr{}}@assafe{}@acsafe{}}
>
> Use @mtsafe{}, because the function does not touch _sigintr at all.

Ack.

>
>> +This function returns the message describing the signal @var{signum} or
>> +@code{NULL} for invalid signal number (i.g "Hangup" for @code{SIGHUP}).
>
> s/i.g/e.g./g

Ack.

>
>> +Different than @code{strsignal} the returned description is not translated.
>> +The message porints to a static storage whose lifetime is the whole lifetime
>
> s/porints/points/g

ACk.

>
>> +of the program.
>> +
>> +@pindex string.h
>> +This function is a GNU extension, declared in the header file @file{string.h}.
>> +@end deftypefun
>> +
>> +@deftypefun void sigabbrev_np (int @var{signum})
>> +@standards{GNU, string.h}
>> +@safety{@prelim{}@mtsafe{@mtssigintr{}}@assafe{}@acsafe{}}
>
> Use @mtsafe{}, because the function does not touch _sigintr at all.

Ack.

>
>> +This function returns the abbreviation describing the signal @var{signum} or
>> +@code{NULL} for invalid signal number.  The message porints to a static
>
> s/porints/points/g

Ack.
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH v5 13/13] string: Add strerrorname and strerrordesc

Sourceware - libc-alpha mailing list
In reply to this post by Sourceware - libc-alpha mailing list


On 02/07/2020 18:43, Carlos O'Donell wrote:

> On 6/19/20 9:43 AM, Adhemerval Zanella wrote:
>> The strerrorname returns error number name (i.g. "EINVAL" for EINVAL)
>> while strerrordesc returns string describing error number (i.g
>> "Invalid argument" for EINVAL).  Different than strerror, strerrordesc
>> does not attempt to translate the return description and both functions
>> return NULL for an invalid error number.
>>
>> They should be used instead of sys_errlist and sys_nerr and both are
>
> s/and both/, both/g

Ack.

>
>> 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.
>
> Why not strerrorname_np or strerrordesc_np? We don't have to use *_np,
> but these functions are fiarly close in name to 'strerror' and so it
> might be beneficial to use _np at the end, like you did for sigabbrev_np
> and sigdescr_np. Thoughts?

I don't have a strong preference here, on a patch iteration I used
the the _np suffix and Florian has pointed out the str* namespace
is reserved for libc implementations.

But I think the _np is slight better to indicate it is an extension.
If it is eventually adopted by other system without the _np suffix
we can easily create an alias.

So I have added the _np suffix.

>
> No regression on x86_64 and i686.
>
> Tested-by: Carlos O'Donell <[hidden email]>

Should I add the Reviewed-by as well?

>
>> ---
>>  NEWS                                          | 10 +++
>>  include/stdio.h                               |  1 +
>>  manual/errno.texi                             | 23 +++++++
>>  stdio-common/errlist.c                        | 33 ++++++++++
>>  stdio-common/test-strerr.c                    | 65 +++++++++++++++++++
>>  string/Makefile                               |  2 +-
>>  string/Versions                               |  1 +
>>  string/strerrordesc.c                         | 26 ++++++++
>>  string/strerrorname.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 +
>>  .../sysv/linux/m68k/coldfire/libc.abilist     |  2 +
>>  .../unix/sysv/linux/m68k/m680x0/libc.abilist  |  2 +
>>  .../sysv/linux/microblaze/be/libc.abilist     |  2 +
>>  .../sysv/linux/microblaze/le/libc.abilist     |  2 +
>>  .../sysv/linux/mips/mips32/fpu/libc.abilist   |  2 +
>>  .../sysv/linux/mips/mips32/nofpu/libc.abilist |  2 +
>>  .../sysv/linux/mips/mips64/n32/libc.abilist   |  2 +
>>  .../sysv/linux/mips/mips64/n64/libc.abilist   |  2 +
>>  sysdeps/unix/sysv/linux/nios2/libc.abilist    |  2 +
>>  .../linux/powerpc/powerpc32/fpu/libc.abilist  |  2 +
>>  .../powerpc/powerpc32/nofpu/libc.abilist      |  2 +
>>  .../linux/powerpc/powerpc64/be/libc.abilist   |  2 +
>>  .../linux/powerpc/powerpc64/le/libc.abilist   |  2 +
>>  .../unix/sysv/linux/riscv/rv64/libc.abilist   |  2 +
>>  .../unix/sysv/linux/s390/s390-32/libc.abilist |  2 +
>>  .../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 +
>>  .../sysv/linux/sparc/sparc32/libc.abilist     |  2 +
>>  .../sysv/linux/sparc/sparc64/libc.abilist     |  2 +
>>  .../unix/sysv/linux/x86_64/64/libc.abilist    |  2 +
>>  .../unix/sysv/linux/x86_64/x32/libc.abilist   |  2 +
>>  42 files changed, 258 insertions(+), 1 deletion(-)
>>  create mode 100644 stdio-common/test-strerr.c
>>  create mode 100644 string/strerrordesc.c
>>  create mode 100644 string/strerrorname.c
>>  create mode 100644 sysdeps/mach/hurd/test-err_np.c
>>
>> diff --git a/NEWS b/NEWS
>> index f504772eb6..888727581b 100644
>> --- a/NEWS
>> +++ b/NEWS
>> @@ -41,6 +41,16 @@ Major new features:
>>    They should be used instead of sys_siglist or sys_sigabbrev and they
>>    are both thread and async-signal safe.  These functions are GNU extensions.
>>  
>> +* The functions strerrorname and strerrordesc have been added.  The
>> +  strerroname returns error number name (i.g. "EINVAL" for EINVAL) while
>
> s/i.g./e.g./g

Ack.

>
>> +  strerrordesc returns string describing error number (i.g "Invalid argument"
>> +  for EINVAL).  Different than strerror, strerrordesc does not attempt to
>> +  translate the return description and both functions return NULL for an
>> +  invalid error number.
>> +
>> +  They should be used instead of sys_errlist and sys_nerr and both are
>
> s/and both/, both/g

Ack.

>
>> +  thread and async-signal safe.  These functions are GNU extensions.
>> +
>>  Deprecated and removed features, and other changes affecting compatibility:
>>  
>>  * The deprecated <sys/sysctl.h> header and the sysctl function have been
>> diff --git a/include/stdio.h b/include/stdio.h
>> index 9e3bf6fe42..bc67d020d4 100644
>> --- a/include/stdio.h
>> +++ b/include/stdio.h
>> @@ -187,6 +187,7 @@ libc_hidden_proto (__libc_readline_unlocked);
>>  
>>  extern const char *const _sys_errlist_internal[] attribute_hidden;
>>  extern const char *__get_errlist (int) attribute_hidden;
>> +extern const char *__get_errname (int) attribute_hidden;
>
> OK.
>
>>  
>>  libc_hidden_ldbl_proto (__asprintf)
>>  
>> diff --git a/manual/errno.texi b/manual/errno.texi
>> index 8cb4ce8b48..dfc4001af0 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 (int @var{errnum})
>> +@standards{GNU, string.h}
>> +@safety{@prelim{}@mtsafe{@mtssigintr{}}@assafe{}@acsafe{}}
>
> Use @mtsafe{} since it doesn't touch _sigintr.
>
>> +This function returns the name describing the error @var{errnum} or
>> +@code{NULL} if there is no known E* constant with this value (i.g "EINVAL"> +for @code{EINVAL}).
>
> s/E*//g

Ack.

>
>> +
>> +@pindex string.h
>> +This function is a GNU extension, declared in the header file @file{string.h}.
>> +@end deftypefun
>> +
>> +@deftypefun void errdesc_np (int @var{errnum})
>> +@standards{GNU, string.h}
>> +@safety{@prelim{}@mtsafe{@mtssigintr{}}@assafe{}@acsafe{}}
>
> Use @mtsafe{} since it doesn't touch _sigintr.

Ack.

>
>> +This function returns the message describing the error @var{errnum} or
>> +@code{NULL} if there is no known E* constant with this value (i.g "Invalid
>
> s/E*//g
>
>> +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
>> diff --git a/stdio-common/errlist.c b/stdio-common/errlist.c
>> index df52356066..d15f13a22a 100644
>> --- a/stdio-common/errlist.c
>> +++ b/stdio-common/errlist.c
>> @@ -35,4 +35,37 @@ __get_errlist (int errnum)
>>    return NULL;
>>  }
>>  
>> +static const union sys_errname_t
>> +{
>> +  struct
>> +  {
>> +#define MSGSTRFIELD1(line) str##line
>> +#define MSGSTRFIELD(line)  MSGSTRFIELD1(line)
>> +#define _S(n, str)         char MSGSTRFIELD(__LINE__)[sizeof(str)];
>> +#include <errlist.h>
>> +#undef _S
>> +  };
>> +  char str[0];
>> +} _sys_errname = { {
>> +#define _S(n, s) s,
>> +#include <errlist.h>
>> +#undef _S
>> +} };
>> +
>> +static const unsigned short _sys_errnameidx[] =
>> +{
>> +#define _S(n, s) [n] = offsetof(union sys_errname_t, MSGSTRFIELD(__LINE__)),
>> +#include <errlist.h>
>> +#undef _S
>> +};
>> +
>> +const char *
>> +__get_errname (int errnum)
>> +{
>> +  if (errnum < 0 || errnum >= array_length (_sys_errnameidx)
>> +      || (errnum > 0 && _sys_errnameidx[errnum] == 0))
>> +    return NULL;
>> +  return _sys_errname.str + _sys_errnameidx[errnum];
>> +}
>
> OK.
>
>> +
>>  #include <errlist-compat.c>
>> diff --git a/stdio-common/test-strerr.c b/stdio-common/test-strerr.c
>> new file mode 100644
>> index 0000000000..baa8d8e6d4
>> --- /dev/null
>> +++ b/stdio-common/test-strerr.c
>> @@ -0,0 +1,65 @@
>> +/* Test strerrorname and strerrordesc.
>> +   Copyright (C) 2020 Free Software Foundation, Inc.
>> +   This file is part of the GNU C Library.
>
> OK.
>
>> +
>> +   The GNU C Library is free software; you can redistribute it and/or
>> +   modify it under the terms of the GNU Lesser General Public
>> +   License as published by the Free Software Foundation; either
>> +   version 2.1 of the License, or (at your option) any later version.
>> +
>> +   The GNU C Library is distributed in the hope that it will be useful,
>> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
>> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
>> +   Lesser General Public License for more details.
>> +
>> +   You should have received a copy of the GNU Lesser General Public
>> +   License along with the GNU C Library; if not, see
>> +   <https://www.gnu.org/licenses/>.  */
>> +
>> +#include <string.h>
>> +#include <errno.h>
>> +#include <array_length.h>
>> +
>> +#include <support/support.h>
>> +#include <support/check.h>
>> +
>> +#define N_(name)      name
>> +
>> +static const char *const errlist[] =
>> +  {
>> +/* This file is auto-generated from errlist.def.  */
>> +#include <errlist.h>
>
> OK. We cross reference the entire errlist.
>
>> +  };
>> +
>> +#define MSGSTR_T errname_t
>> +#define MSGSTR   errname
>> +#define MSGIDX   errnameidx
>> +#include <errlist-name.h>
>> +#undef MSGSTR
>> +#undef MSGIDX
>> +
>> +static int
>> +do_test (void)
>> +{
>> +  TEST_VERIFY (strerrordesc (-1) == NULL);
>> +  TEST_VERIFY (strerrordesc (array_length (errlist)) == NULL);
>
> OK.
>
>> +  for (size_t i = 0; i < array_length (errlist); i++)
>> +    {
>> +      if (errlist[i] == NULL)
>> +        continue;
>> +      TEST_COMPARE_STRING (strerrordesc (i), errlist[i]);
>> +    }
>> +
>> +  TEST_VERIFY (strerrorname (-1) == NULL);
>> +  TEST_VERIFY (strerrorname (array_length (errlist)) == NULL);
>> +  for (size_t i = 0; i < array_length (errlist); i++)
>> +    {
>> +      if (errlist[i] == NULL)
>> +        continue;
>> +      TEST_COMPARE_STRING (strerrorname (i), errname.str + errnameidx[i]);
>> +    }
>> +
>> +  return 0;
>> +}
>
> OK.
>
>> +
>> +#include <support/test-driver.c>
>> diff --git a/string/Makefile b/string/Makefile
>> index e5075521b7..fd06409197 100644
>> --- a/string/Makefile
>> +++ b/string/Makefile
>> @@ -45,7 +45,7 @@ routines := strcat strchr strcmp strcoll strcpy strcspn \
>>     envz basename \
>>     strcoll_l strxfrm_l string-inlines memrchr \
>>     xpg-strerror strerror_l explicit_bzero \
>> -   sigdescr_np sigabbrev_np
>> +   sigdescr_np sigabbrev_np strerrorname strerrordesc
>
> Why not _np also?
>
>>  
>>  strop-tests := memchr memcmp memcpy memmove mempcpy memset memccpy \
>>     stpcpy stpncpy strcat strchr strcmp strcpy strcspn \
>> diff --git a/string/Versions b/string/Versions
>> index 6f8dd2d372..7727fca001 100644
>> --- a/string/Versions
>> +++ b/string/Versions
>> @@ -87,5 +87,6 @@ libc {
>>    }
>>    GLIBC_2.32 {
>>      sigdescr_np; sigabbrev_np;
>> +    strerrordesc; strerrorname;
>
> Likewise.
>
>>    }
>>  }
>> diff --git a/string/strerrordesc.c b/string/strerrordesc.c
>> new file mode 100644
>> index 0000000000..f59448f2d1
>> --- /dev/null
>> +++ b/string/strerrordesc.c
>> @@ -0,0 +1,26 @@
>> +/* Return string describing error number.
>> +   Copyright (C) 2020 Free Software Foundation, Inc.
>> +   This file is part of the GNU C Library.
>> +
>> +   The GNU C Library is free software; you can redistribute it and/or
>> +   modify it under the terms of the GNU Lesser General Public
>> +   License as published by the Free Software Foundation; either
>> +   version 2.1 of the License, or (at your option) any later version.
>> +
>> +   The GNU C Library is distributed in the hope that it will be useful,
>> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
>> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
>> +   Lesser General Public License for more details.
>> +
>> +   You should have received a copy of the GNU Lesser General Public
>> +   License along with the GNU C Library; if not, see
>> +   <https://www.gnu.org/licenses/>.  */
>> +
>> +#include <stdio.h>
>> +
>> +const char *
>> +__strerrordesc (int errnum)
>> +{
>> +  return __get_errlist (errnum);
>> +}
>
> OK.
>
>> +weak_alias (__strerrordesc, strerrordesc)
>> diff --git a/string/strerrorname.c b/string/strerrorname.c
>> new file mode 100644
>> index 0000000000..889ea0d245
>> --- /dev/null
>> +++ b/string/strerrorname.c
>> @@ -0,0 +1,25 @@
>> +/* Return string describing errno name.
>> +   Copyright (C) 2020 Free Software Foundation, Inc.
>> +   This file is part of the GNU C Library.
>> +
>> +   The GNU C Library is free software; you can redistribute it and/or
>> +   modify it under the terms of the GNU Lesser General Public
>> +   License as published by the Free Software Foundation; either
>> +   version 2.1 of the License, or (at your option) any later version.
>> +
>> +   The GNU C Library is distributed in the hope that it will be useful,
>> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
>> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
>> +   Lesser General Public License for more details.
>> +
>> +   You should have received a copy of the GNU Lesser General Public
>> +   License along with the GNU C Library; if not, see
>> +   <https://www.gnu.org/licenses/>.  */
>> +
>> +#include <stdio.h>
>> +
>> +const char *
>> +strerrorname (int errnum)
>> +{
>> +  return __get_errname (errnum);
>> +}
>
> OK.
>
>> diff --git a/string/string.h b/string/string.h
>> index 0119d7f45d..bb90219ada 100644
>> --- a/string/string.h
>> +++ b/string/string.h
>> @@ -428,6 +428,13 @@ extern int __xpg_strerror_r (int __errnum, char *__buf, size_t __buflen)
>>  extern char *strerror_r (int __errnum, char *__buf, size_t __buflen)
>>       __THROW __nonnull ((2)) __wur  __attr_access ((__write_only__, 2, 3));
>>  # endif
>> +
>> +# ifdef __USE_GNU
>
> OK. GNU extension.
>
>> +/* Return a string describing the meaning of tthe error in ERR.  */
>> +extern const char *strerrordesc (int __err) __THROW;
>> +/* Return a string with the error name in ERR.  */
>> +extern const char *strerrorname (int __err) __THROW;
>> +# endif
>>  #endif
>>  
>>  #ifdef __USE_XOPEN2K8
>> diff --git a/sysdeps/mach/hurd/i386/libc.abilist b/sysdeps/mach/hurd/i386/libc.abilist
>> index ff8ad98d03..193ceba987 100644
>> --- a/sysdeps/mach/hurd/i386/libc.abilist
>> +++ b/sysdeps/mach/hurd/i386/libc.abilist
>> @@ -2181,6 +2181,8 @@ GLIBC_2.3.4 setsourcefilter F
>>  GLIBC_2.3.4 xdr_quad_t F
>>  GLIBC_2.3.4 xdr_u_quad_t F
>>  GLIBC_2.30 twalk_r F
>> +GLIBC_2.32 errdescr_np F
>> +GLIBC_2.32 errname_np F
>>  GLIBC_2.32 mach_print F
>>  GLIBC_2.32 sigabbrev_np F
>>  GLIBC_2.32 sigdescr_np F
>> diff --git a/sysdeps/mach/hurd/test-err_np.c b/sysdeps/mach/hurd/test-err_np.c
>> new file mode 100644
>> index 0000000000..3127141128
>> --- /dev/null
>> +++ b/sysdeps/mach/hurd/test-err_np.c
>> @@ -0,0 +1,4 @@
>> +#include <mach/error.h>
>> +
>> +#define ERR_MAP(value) err_get_code (value)
>> +#include <stdio-common/test-err_np.c>
>> diff --git a/sysdeps/unix/sysv/linux/aarch64/libc.abilist b/sysdeps/unix/sysv/linux/aarch64/libc.abilist
>> index bb6045d8a6..f0529706ee 100644
>> --- a/sysdeps/unix/sysv/linux/aarch64/libc.abilist
>> +++ b/sysdeps/unix/sysv/linux/aarch64/libc.abilist
>> @@ -2157,3 +2157,5 @@ GLIBC_2.32 pthread_getattr_np F
>>  GLIBC_2.32 pthread_sigmask F
>>  GLIBC_2.32 sigabbrev_np F
>>  GLIBC_2.32 sigdescr_np F
>> +GLIBC_2.32 strerrordesc F
>> +GLIBC_2.32 strerrorname F
>> diff --git a/sysdeps/unix/sysv/linux/alpha/libc.abilist b/sysdeps/unix/sysv/linux/alpha/libc.abilist
>> index 8e15a58eaf..ac892eceda 100644
>> --- a/sysdeps/unix/sysv/linux/alpha/libc.abilist
>> +++ b/sysdeps/unix/sysv/linux/alpha/libc.abilist
>> @@ -2239,6 +2239,8 @@ GLIBC_2.32 pthread_getattr_np F
>>  GLIBC_2.32 pthread_sigmask F
>>  GLIBC_2.32 sigabbrev_np F
>>  GLIBC_2.32 sigdescr_np F
>> +GLIBC_2.32 strerrordesc F
>> +GLIBC_2.32 strerrorname F
>>  GLIBC_2.4 _IO_fprintf F
>>  GLIBC_2.4 _IO_printf F
>>  GLIBC_2.4 _IO_sprintf F
>> diff --git a/sysdeps/unix/sysv/linux/arm/be/libc.abilist b/sysdeps/unix/sysv/linux/arm/be/libc.abilist
>> index ce82b840e8..af574dfb9d 100644
>> --- a/sysdeps/unix/sysv/linux/arm/be/libc.abilist
>> +++ b/sysdeps/unix/sysv/linux/arm/be/libc.abilist
>> @@ -141,6 +141,8 @@ GLIBC_2.32 pthread_getattr_np F
>>  GLIBC_2.32 pthread_sigmask F
>>  GLIBC_2.32 sigabbrev_np F
>>  GLIBC_2.32 sigdescr_np F
>> +GLIBC_2.32 strerrordesc F
>> +GLIBC_2.32 strerrorname F
>>  GLIBC_2.4 _Exit F
>>  GLIBC_2.4 _IO_2_1_stderr_ D 0xa0
>>  GLIBC_2.4 _IO_2_1_stdin_ D 0xa0
>> diff --git a/sysdeps/unix/sysv/linux/arm/le/libc.abilist b/sysdeps/unix/sysv/linux/arm/le/libc.abilist
>> index c7a436cd42..bb0e8bf312 100644
>> --- a/sysdeps/unix/sysv/linux/arm/le/libc.abilist
>> +++ b/sysdeps/unix/sysv/linux/arm/le/libc.abilist
>> @@ -138,6 +138,8 @@ GLIBC_2.32 pthread_getattr_np F
>>  GLIBC_2.32 pthread_sigmask F
>>  GLIBC_2.32 sigabbrev_np F
>>  GLIBC_2.32 sigdescr_np F
>> +GLIBC_2.32 strerrordesc F
>> +GLIBC_2.32 strerrorname F
>>  GLIBC_2.4 _Exit F
>>  GLIBC_2.4 _IO_2_1_stderr_ D 0xa0
>>  GLIBC_2.4 _IO_2_1_stdin_ D 0xa0
>> diff --git a/sysdeps/unix/sysv/linux/csky/libc.abilist b/sysdeps/unix/sysv/linux/csky/libc.abilist
>> index 7f51d47b2f..8a612ece3e 100644
>> --- a/sysdeps/unix/sysv/linux/csky/libc.abilist
>> +++ b/sysdeps/unix/sysv/linux/csky/libc.abilist
>> @@ -2101,3 +2101,5 @@ GLIBC_2.32 pthread_getattr_np F
>>  GLIBC_2.32 pthread_sigmask F
>>  GLIBC_2.32 sigabbrev_np F
>>  GLIBC_2.32 sigdescr_np F
>> +GLIBC_2.32 strerrordesc F
>> +GLIBC_2.32 strerrorname F
>> diff --git a/sysdeps/unix/sysv/linux/hppa/libc.abilist b/sysdeps/unix/sysv/linux/hppa/libc.abilist
>> index 053cda00a4..ccb61a322a 100644
>> --- a/sysdeps/unix/sysv/linux/hppa/libc.abilist
>> +++ b/sysdeps/unix/sysv/linux/hppa/libc.abilist
>> @@ -2060,6 +2060,8 @@ GLIBC_2.32 pthread_getattr_np F
>>  GLIBC_2.32 pthread_sigmask F
>>  GLIBC_2.32 sigabbrev_np F
>>  GLIBC_2.32 sigdescr_np F
>> +GLIBC_2.32 strerrordesc F
>> +GLIBC_2.32 strerrorname F
>>  GLIBC_2.4 __confstr_chk F
>>  GLIBC_2.4 __fgets_chk F
>>  GLIBC_2.4 __fgets_unlocked_chk F
>> diff --git a/sysdeps/unix/sysv/linux/i386/libc.abilist b/sysdeps/unix/sysv/linux/i386/libc.abilist
>> index f18de50f9e..bc5329d7b9 100644
>> --- a/sysdeps/unix/sysv/linux/i386/libc.abilist
>> +++ b/sysdeps/unix/sysv/linux/i386/libc.abilist
>> @@ -2226,6 +2226,8 @@ GLIBC_2.32 pthread_getattr_np F
>>  GLIBC_2.32 pthread_sigmask F
>>  GLIBC_2.32 sigabbrev_np F
>>  GLIBC_2.32 sigdescr_np F
>> +GLIBC_2.32 strerrordesc F
>> +GLIBC_2.32 strerrorname F
>>  GLIBC_2.4 __confstr_chk F
>>  GLIBC_2.4 __fgets_chk F
>>  GLIBC_2.4 __fgets_unlocked_chk F
>> diff --git a/sysdeps/unix/sysv/linux/ia64/libc.abilist b/sysdeps/unix/sysv/linux/ia64/libc.abilist
>> index a1966cac5a..8f8cbfa80b 100644
>> --- a/sysdeps/unix/sysv/linux/ia64/libc.abilist
>> +++ b/sysdeps/unix/sysv/linux/ia64/libc.abilist
>> @@ -2092,6 +2092,8 @@ GLIBC_2.32 pthread_getattr_np F
>>  GLIBC_2.32 pthread_sigmask F
>>  GLIBC_2.32 sigabbrev_np F
>>  GLIBC_2.32 sigdescr_np F
>> +GLIBC_2.32 strerrordesc F
>> +GLIBC_2.32 strerrorname F
>>  GLIBC_2.4 __confstr_chk F
>>  GLIBC_2.4 __fgets_chk F
>>  GLIBC_2.4 __fgets_unlocked_chk F
>> diff --git a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
>> index 8f44bc9231..802e16ac7d 100644
>> --- a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
>> +++ b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
>> @@ -142,6 +142,8 @@ GLIBC_2.32 pthread_getattr_np F
>>  GLIBC_2.32 pthread_sigmask F
>>  GLIBC_2.32 sigabbrev_np F
>>  GLIBC_2.32 sigdescr_np F
>> +GLIBC_2.32 strerrordesc F
>> +GLIBC_2.32 strerrorname F
>>  GLIBC_2.4 _Exit F
>>  GLIBC_2.4 _IO_2_1_stderr_ D 0x98
>>  GLIBC_2.4 _IO_2_1_stdin_ D 0x98
>> diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
>> index 088f2fa0f2..62bfa336b8 100644
>> --- a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
>> +++ b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
>> @@ -2172,6 +2172,8 @@ GLIBC_2.32 pthread_getattr_np F
>>  GLIBC_2.32 pthread_sigmask F
>>  GLIBC_2.32 sigabbrev_np F
>>  GLIBC_2.32 sigdescr_np F
>> +GLIBC_2.32 strerrordesc F
>> +GLIBC_2.32 strerrorname F
>>  GLIBC_2.4 __confstr_chk F
>>  GLIBC_2.4 __fgets_chk F
>>  GLIBC_2.4 __fgets_unlocked_chk F
>> diff --git a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
>> index 34c1c4fdca..680c7b0c77 100644
>> --- a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
>> +++ b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
>> @@ -2152,3 +2152,5 @@ GLIBC_2.32 pthread_getattr_np F
>>  GLIBC_2.32 pthread_sigmask F
>>  GLIBC_2.32 sigabbrev_np F
>>  GLIBC_2.32 sigdescr_np F
>> +GLIBC_2.32 strerrordesc F
>> +GLIBC_2.32 strerrorname F
>> diff --git a/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
>> index 099d51e893..e102493f6c 100644
>> --- a/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
>> +++ b/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
>> @@ -2149,3 +2149,5 @@ GLIBC_2.32 pthread_getattr_np F
>>  GLIBC_2.32 pthread_sigmask F
>>  GLIBC_2.32 sigabbrev_np F
>>  GLIBC_2.32 sigdescr_np F
>> +GLIBC_2.32 strerrordesc F
>> +GLIBC_2.32 strerrorname F
>> diff --git a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
>> index ea86646c3b..28588017fa 100644
>> --- a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
>> +++ b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
>> @@ -2143,6 +2143,8 @@ GLIBC_2.32 pthread_getattr_np F
>>  GLIBC_2.32 pthread_sigmask F
>>  GLIBC_2.32 sigabbrev_np F
>>  GLIBC_2.32 sigdescr_np F
>> +GLIBC_2.32 strerrordesc F
>> +GLIBC_2.32 strerrorname F
>>  GLIBC_2.4 __confstr_chk F
>>  GLIBC_2.4 __fgets_chk F
>>  GLIBC_2.4 __fgets_unlocked_chk F
>> diff --git a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
>> index 9adac43e36..64c99116c0 100644
>> --- a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
>> +++ b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
>> @@ -2141,6 +2141,8 @@ GLIBC_2.32 pthread_getattr_np F
>>  GLIBC_2.32 pthread_sigmask F
>>  GLIBC_2.32 sigabbrev_np F
>>  GLIBC_2.32 sigdescr_np F
>> +GLIBC_2.32 strerrordesc F
>> +GLIBC_2.32 strerrorname F
>>  GLIBC_2.4 __confstr_chk F
>>  GLIBC_2.4 __fgets_chk F
>>  GLIBC_2.4 __fgets_unlocked_chk F
>> diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
>> index c42c093cfb..7e197736d8 100644
>> --- a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
>> +++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
>> @@ -2149,6 +2149,8 @@ GLIBC_2.32 pthread_getattr_np F
>>  GLIBC_2.32 pthread_sigmask F
>>  GLIBC_2.32 sigabbrev_np F
>>  GLIBC_2.32 sigdescr_np F
>> +GLIBC_2.32 strerrordesc F
>> +GLIBC_2.32 strerrorname F
>>  GLIBC_2.4 __confstr_chk F
>>  GLIBC_2.4 __fgets_chk F
>>  GLIBC_2.4 __fgets_unlocked_chk F
>> diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
>> index 605e60a35e..e1964effc6 100644
>> --- a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
>> +++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
>> @@ -2143,6 +2143,8 @@ GLIBC_2.32 pthread_getattr_np F
>>  GLIBC_2.32 pthread_sigmask F
>>  GLIBC_2.32 sigabbrev_np F
>>  GLIBC_2.32 sigdescr_np F
>> +GLIBC_2.32 strerrordesc F
>> +GLIBC_2.32 strerrorname F
>>  GLIBC_2.4 __confstr_chk F
>>  GLIBC_2.4 __fgets_chk F
>>  GLIBC_2.4 __fgets_unlocked_chk F
>> diff --git a/sysdeps/unix/sysv/linux/nios2/libc.abilist b/sysdeps/unix/sysv/linux/nios2/libc.abilist
>> index 7a57babca5..f647f86c09 100644
>> --- a/sysdeps/unix/sysv/linux/nios2/libc.abilist
>> +++ b/sysdeps/unix/sysv/linux/nios2/libc.abilist
>> @@ -2190,3 +2190,5 @@ GLIBC_2.32 pthread_getattr_np F
>>  GLIBC_2.32 pthread_sigmask F
>>  GLIBC_2.32 sigabbrev_np F
>>  GLIBC_2.32 sigdescr_np F
>> +GLIBC_2.32 strerrordesc F
>> +GLIBC_2.32 strerrorname F
>> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
>> index c3745c3733..8998f3e0ab 100644
>> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
>> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
>> @@ -2199,6 +2199,8 @@ GLIBC_2.32 pthread_getattr_np F
>>  GLIBC_2.32 pthread_sigmask F
>>  GLIBC_2.32 sigabbrev_np F
>>  GLIBC_2.32 sigdescr_np F
>> +GLIBC_2.32 strerrordesc F
>> +GLIBC_2.32 strerrorname F
>>  GLIBC_2.4 _IO_fprintf F
>>  GLIBC_2.4 _IO_printf F
>>  GLIBC_2.4 _IO_sprintf F
>> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
>> index 719512e999..a96c6d1ce2 100644
>> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
>> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
>> @@ -2232,6 +2232,8 @@ GLIBC_2.32 pthread_getattr_np F
>>  GLIBC_2.32 pthread_sigmask F
>>  GLIBC_2.32 sigabbrev_np F
>>  GLIBC_2.32 sigdescr_np F
>> +GLIBC_2.32 strerrordesc F
>> +GLIBC_2.32 strerrorname F
>>  GLIBC_2.4 _IO_fprintf F
>>  GLIBC_2.4 _IO_printf F
>>  GLIBC_2.4 _IO_sprintf F
>> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
>> index 3f79daa39c..f9f0a9dd93 100644
>> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
>> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
>> @@ -2062,6 +2062,8 @@ GLIBC_2.32 pthread_getattr_np F
>>  GLIBC_2.32 pthread_sigmask F
>>  GLIBC_2.32 sigabbrev_np F
>>  GLIBC_2.32 sigdescr_np F
>> +GLIBC_2.32 strerrordesc F
>> +GLIBC_2.32 strerrorname F
>>  GLIBC_2.4 _IO_fprintf F
>>  GLIBC_2.4 _IO_printf F
>>  GLIBC_2.4 _IO_sprintf F
>> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
>> index af1a2ae8a6..921098b1f3 100644
>> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
>> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
>> @@ -2352,3 +2352,5 @@ GLIBC_2.32 pthread_getattr_np F
>>  GLIBC_2.32 pthread_sigmask F
>>  GLIBC_2.32 sigabbrev_np F
>>  GLIBC_2.32 sigdescr_np F
>> +GLIBC_2.32 strerrordesc F
>> +GLIBC_2.32 strerrorname F
>> diff --git a/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist b/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
>> index ff5b64c1dd..1e65005b9f 100644
>> --- a/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
>> +++ b/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
>> @@ -2119,3 +2119,5 @@ GLIBC_2.32 pthread_getattr_np F
>>  GLIBC_2.32 pthread_sigmask F
>>  GLIBC_2.32 sigabbrev_np F
>>  GLIBC_2.32 sigdescr_np F
>> +GLIBC_2.32 strerrordesc F
>> +GLIBC_2.32 strerrorname F
>> diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
>> index 576caca63c..b31811135b 100644
>> --- a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
>> +++ b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
>> @@ -2197,6 +2197,8 @@ GLIBC_2.32 pthread_getattr_np F
>>  GLIBC_2.32 pthread_sigmask F
>>  GLIBC_2.32 sigabbrev_np F
>>  GLIBC_2.32 sigdescr_np F
>> +GLIBC_2.32 strerrordesc F
>> +GLIBC_2.32 strerrorname F
>>  GLIBC_2.4 _IO_fprintf F
>>  GLIBC_2.4 _IO_printf F
>>  GLIBC_2.4 _IO_sprintf F
>> diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
>> index 7201b10288..c30fc0ef71 100644
>> --- a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
>> +++ b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
>> @@ -2098,6 +2098,8 @@ GLIBC_2.32 pthread_getattr_np F
>>  GLIBC_2.32 pthread_sigmask F
>>  GLIBC_2.32 sigabbrev_np F
>>  GLIBC_2.32 sigdescr_np F
>> +GLIBC_2.32 strerrordesc F
>> +GLIBC_2.32 strerrorname F
>>  GLIBC_2.4 _IO_fprintf F
>>  GLIBC_2.4 _IO_printf F
>>  GLIBC_2.4 _IO_sprintf F
>> diff --git a/sysdeps/unix/sysv/linux/sh/be/libc.abilist b/sysdeps/unix/sysv/linux/sh/be/libc.abilist
>> index 4f954ac7ee..9cbe4a650a 100644
>> --- a/sysdeps/unix/sysv/linux/sh/be/libc.abilist
>> +++ b/sysdeps/unix/sysv/linux/sh/be/libc.abilist
>> @@ -2067,6 +2067,8 @@ GLIBC_2.32 pthread_getattr_np F
>>  GLIBC_2.32 pthread_sigmask F
>>  GLIBC_2.32 sigabbrev_np F
>>  GLIBC_2.32 sigdescr_np F
>> +GLIBC_2.32 strerrordesc F
>> +GLIBC_2.32 strerrorname F
>>  GLIBC_2.4 __confstr_chk F
>>  GLIBC_2.4 __fgets_chk F
>>  GLIBC_2.4 __fgets_unlocked_chk F
>> diff --git a/sysdeps/unix/sysv/linux/sh/le/libc.abilist b/sysdeps/unix/sysv/linux/sh/le/libc.abilist
>> index 9db9ba5cc0..c00327a607 100644
>> --- a/sysdeps/unix/sysv/linux/sh/le/libc.abilist
>> +++ b/sysdeps/unix/sysv/linux/sh/le/libc.abilist
>> @@ -2064,6 +2064,8 @@ GLIBC_2.32 pthread_getattr_np F
>>  GLIBC_2.32 pthread_sigmask F
>>  GLIBC_2.32 sigabbrev_np F
>>  GLIBC_2.32 sigdescr_np F
>> +GLIBC_2.32 strerrordesc F
>> +GLIBC_2.32 strerrorname F
>>  GLIBC_2.4 __confstr_chk F
>>  GLIBC_2.4 __fgets_chk F
>>  GLIBC_2.4 __fgets_unlocked_chk F
>> diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
>> index ecb54db317..a990eee8f8 100644
>> --- a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
>> +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
>> @@ -2188,6 +2188,8 @@ GLIBC_2.32 pthread_getattr_np F
>>  GLIBC_2.32 pthread_sigmask F
>>  GLIBC_2.32 sigabbrev_np F
>>  GLIBC_2.32 sigdescr_np F
>> +GLIBC_2.32 strerrordesc F
>> +GLIBC_2.32 strerrorname F
>>  GLIBC_2.4 _IO_fprintf F
>>  GLIBC_2.4 _IO_printf F
>>  GLIBC_2.4 _IO_sprintf F
>> diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
>> index 74bd6efed8..e988546b20 100644
>> --- a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
>> +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
>> @@ -2115,6 +2115,8 @@ GLIBC_2.32 pthread_getattr_np F
>>  GLIBC_2.32 pthread_sigmask F
>>  GLIBC_2.32 sigabbrev_np F
>>  GLIBC_2.32 sigdescr_np F
>> +GLIBC_2.32 strerrordesc F
>> +GLIBC_2.32 strerrorname F
>>  GLIBC_2.4 __confstr_chk F
>>  GLIBC_2.4 __fgets_chk F
>>  GLIBC_2.4 __fgets_unlocked_chk F
>> diff --git a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
>> index 50e45a43e8..fa10e68d3a 100644
>> --- a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
>> +++ b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
>> @@ -2073,6 +2073,8 @@ GLIBC_2.32 pthread_getattr_np F
>>  GLIBC_2.32 pthread_sigmask F
>>  GLIBC_2.32 sigabbrev_np F
>>  GLIBC_2.32 sigdescr_np F
>> +GLIBC_2.32 strerrordesc F
>> +GLIBC_2.32 strerrorname F
>>  GLIBC_2.4 __confstr_chk F
>>  GLIBC_2.4 __fgets_chk F
>>  GLIBC_2.4 __fgets_unlocked_chk F
>> diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
>> index 59b26b097d..29119996ae 100644
>> --- a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
>> +++ b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
>> @@ -2170,3 +2170,5 @@ GLIBC_2.32 pthread_getattr_np F
>>  GLIBC_2.32 pthread_sigmask F
>>  GLIBC_2.32 sigabbrev_np F
>>  GLIBC_2.32 sigdescr_np F
>> +GLIBC_2.32 strerrordesc F
>> +GLIBC_2.32 strerrorname F
>>
>
> OK.
>
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH v5 13/13] string: Add strerrorname and strerrordesc

Sourceware - libc-alpha mailing list
On 7/3/20 5:01 PM, Adhemerval Zanella wrote:

>
>
> On 02/07/2020 18:43, Carlos O'Donell wrote:
>> On 6/19/20 9:43 AM, Adhemerval Zanella wrote:
>>> The strerrorname returns error number name (i.g. "EINVAL" for EINVAL)
>>> while strerrordesc returns string describing error number (i.g
>>> "Invalid argument" for EINVAL).  Different than strerror, strerrordesc
>>> does not attempt to translate the return description and both functions
>>> return NULL for an invalid error number.
>>>
>>> They should be used instead of sys_errlist and sys_nerr and both are
>>
>> s/and both/, both/g
>
> Ack.
>
>>
>>> 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.
>>
>> Why not strerrorname_np or strerrordesc_np? We don't have to use *_np,
>> but these functions are fiarly close in name to 'strerror' and so it
>> might be beneficial to use _np at the end, like you did for sigabbrev_np
>> and sigdescr_np. Thoughts?
>
> I don't have a strong preference here, on a patch iteration I used
> the the _np suffix and Florian has pointed out the str* namespace
> is reserved for libc implementations.
>
> But I think the _np is slight better to indicate it is an extension.
> If it is eventually adopted by other system without the _np suffix
> we can easily create an alias.
>
> So I have added the _np suffix.
>
>>
>> No regression on x86_64 and i686.
>>
>> Tested-by: Carlos O'Donell <[hidden email]>
>
> Should I add the Reviewed-by as well?

No. I want to review the final patch and I'll give Reviewed-by there.

--
Cheers,
Carlos.

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH v5 13/13] string: Add strerrorname and strerrordesc

Sourceware - libc-alpha mailing list


On 03/07/2020 18:19, Carlos O'Donell wrote:

> On 7/3/20 5:01 PM, Adhemerval Zanella wrote:
>>
>>
>> On 02/07/2020 18:43, Carlos O'Donell wrote:
>>> On 6/19/20 9:43 AM, Adhemerval Zanella wrote:
>>>> The strerrorname returns error number name (i.g. "EINVAL" for EINVAL)
>>>> while strerrordesc returns string describing error number (i.g
>>>> "Invalid argument" for EINVAL).  Different than strerror, strerrordesc
>>>> does not attempt to translate the return description and both functions
>>>> return NULL for an invalid error number.
>>>>
>>>> They should be used instead of sys_errlist and sys_nerr and both are
>>>
>>> s/and both/, both/g
>>
>> Ack.
>>
>>>
>>>> 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.
>>>
>>> Why not strerrorname_np or strerrordesc_np? We don't have to use *_np,
>>> but these functions are fiarly close in name to 'strerror' and so it
>>> might be beneficial to use _np at the end, like you did for sigabbrev_np
>>> and sigdescr_np. Thoughts?
>>
>> I don't have a strong preference here, on a patch iteration I used
>> the the _np suffix and Florian has pointed out the str* namespace
>> is reserved for libc implementations.
>>
>> But I think the _np is slight better to indicate it is an extension.
>> If it is eventually adopted by other system without the _np suffix
>> we can easily create an alias.
>>
>> So I have added the _np suffix.
>>
>>>
>>> No regression on x86_64 and i686.
>>>
>>> Tested-by: Carlos O'Donell <[hidden email]>
>>
>> Should I add the Reviewed-by as well?
>
> No. I want to review the final patch and I'll give Reviewed-by there.
>

Alright, should I re-send it with the _np changes?
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH v5 13/13] string: Add strerrorname and strerrordesc

Sourceware - libc-alpha mailing list
On 7/3/20 6:34 PM, Adhemerval Zanella wrote:

>
>
> On 03/07/2020 18:19, Carlos O'Donell wrote:
>> On 7/3/20 5:01 PM, Adhemerval Zanella wrote:
>>>
>>>
>>> On 02/07/2020 18:43, Carlos O'Donell wrote:
>>>> On 6/19/20 9:43 AM, Adhemerval Zanella wrote:
>>>>> The strerrorname returns error number name (i.g. "EINVAL" for EINVAL)
>>>>> while strerrordesc returns string describing error number (i.g
>>>>> "Invalid argument" for EINVAL).  Different than strerror, strerrordesc
>>>>> does not attempt to translate the return description and both functions
>>>>> return NULL for an invalid error number.
>>>>>
>>>>> They should be used instead of sys_errlist and sys_nerr and both are
>>>>
>>>> s/and both/, both/g
>>>
>>> Ack.
>>>
>>>>
>>>>> 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.
>>>>
>>>> Why not strerrorname_np or strerrordesc_np? We don't have to use *_np,
>>>> but these functions are fiarly close in name to 'strerror' and so it
>>>> might be beneficial to use _np at the end, like you did for sigabbrev_np
>>>> and sigdescr_np. Thoughts?
>>>
>>> I don't have a strong preference here, on a patch iteration I used
>>> the the _np suffix and Florian has pointed out the str* namespace
>>> is reserved for libc implementations.
>>>
>>> But I think the _np is slight better to indicate it is an extension.
>>> If it is eventually adopted by other system without the _np suffix
>>> we can easily create an alias.
>>>
>>> So I have added the _np suffix.
>>>
>>>>
>>>> No regression on x86_64 and i686.
>>>>
>>>> Tested-by: Carlos O'Donell <[hidden email]>
>>>
>>> Should I add the Reviewed-by as well?
>>
>> No. I want to review the final patch and I'll give Reviewed-by there.
>>
>
> Alright, should I re-send it with the _np changes?
 
Yes please. I think the _np APIs are very clearly intended to be APIs
within a known namespace e.g. str* which are non-portable and then we
can try to get POSIX to standardize on existing practice.

--
Cheers,
Carlos.

Reply | Threaded
Open this post in threaded view
|

[PATCH v6] string: Add strerrorname_np and strerrordesc_np

Sourceware - libc-alpha mailing list
The strerrorname_np returns error number name (i.g. "EINVAL" for EINVAL)
while strerrordesc_np returns string describing error number (i.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 <[hidden email]>
---
 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 +
 .../sysv/linux/m68k/coldfire/libc.abilist     |  2 +
 .../unix/sysv/linux/m68k/m680x0/libc.abilist  |  2 +
 .../sysv/linux/microblaze/be/libc.abilist     |  2 +
 .../sysv/linux/microblaze/le/libc.abilist     |  2 +
 .../sysv/linux/mips/mips32/fpu/libc.abilist   |  2 +
 .../sysv/linux/mips/mips32/nofpu/libc.abilist |  2 +
 .../sysv/linux/mips/mips64/n32/libc.abilist   |  2 +
 .../sysv/linux/mips/mips64/n64/libc.abilist   |  2 +
 sysdeps/unix/sysv/linux/nios2/libc.abilist    |  2 +
 .../linux/powerpc/powerpc32/fpu/libc.abilist  |  2 +
 .../powerpc/powerpc32/nofpu/libc.abilist      |  2 +
 .../linux/powerpc/powerpc64/be/libc.abilist   |  2 +
 .../linux/powerpc/powerpc64/le/libc.abilist   |  2 +
 .../unix/sysv/linux/riscv/rv64/libc.abilist   |  2 +
 .../unix/sysv/linux/s390/s390-32/libc.abilist |  2 +
 .../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 +
 .../sysv/linux/sparc/sparc32/libc.abilist     |  2 +
 .../sysv/linux/sparc/sparc64/libc.abilist     |  2 +
 .../unix/sysv/linux/x86_64/64/libc.abilist    |  2 +
 .../unix/sysv/linux/x86_64/x32/libc.abilist   |  2 +
 42 files changed, 259 insertions(+), 1 deletion(-)
 create mode 100644 stdio-common/test-strerr.c
 create mode 100644 string/strerrordesc_np.c
 create mode 100644 string/strerrorname_np.c
 create mode 100644 sysdeps/mach/hurd/test-err_np.c

diff --git a/NEWS b/NEWS
index ee91175567..b63b022267 100644
--- a/NEWS
+++ b/NEWS
@@ -41,6 +41,16 @@ Major new features:
   They should be used instead of sys_siglist or sys_sigabbrev and they
   are both thread and async-signal safe.  These functions are GNU extensions.
 
+* The functions strerrorname_np and strerrordesc_np have been added.  The
+  strerroname_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 and both are
+  thread and async-signal safe.  These functions are GNU extensions.
+
 Deprecated and removed features, and other changes affecting compatibility:
 
 * The deprecated <sys/sysctl.h> header and the sysctl function have been
diff --git a/include/stdio.h b/include/stdio.h
index 9e3bf6fe42..bc67d020d4 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -187,6 +187,7 @@ libc_hidden_proto (__libc_readline_unlocked);
 
 extern const char *const _sys_errlist_internal[] attribute_hidden;
 extern const char *__get_errlist (int) attribute_hidden;
+extern const char *__get_errname (int) attribute_hidden;
 
 libc_hidden_ldbl_proto (__asprintf)
 
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
diff --git a/stdio-common/errlist.c b/stdio-common/errlist.c
index df52356066..d15f13a22a 100644
--- a/stdio-common/errlist.c
+++ b/stdio-common/errlist.c
@@ -35,4 +35,37 @@ __get_errlist (int errnum)
   return NULL;
 }
 
+static const union sys_errname_t
+{
+  struct
+  {
+#define MSGSTRFIELD1(line) str##line
+#define MSGSTRFIELD(line)  MSGSTRFIELD1(line)
+#define _S(n, str)         char MSGSTRFIELD(__LINE__)[sizeof(str)];
+#include <errlist.h>
+#undef _S
+  };
+  char str[0];
+} _sys_errname = { {
+#define _S(n, s) s,
+#include <errlist.h>
+#undef _S
+} };
+
+static const unsigned short _sys_errnameidx[] =
+{
+#define _S(n, s) [n] = offsetof(union sys_errname_t, MSGSTRFIELD(__LINE__)),
+#include <errlist.h>
+#undef _S
+};
+
+const char *
+__get_errname (int errnum)
+{
+  if (errnum < 0 || errnum >= array_length (_sys_errnameidx)
+      || (errnum > 0 && _sys_errnameidx[errnum] == 0))
+    return NULL;
+  return _sys_errname.str + _sys_errnameidx[errnum];
+}
+
 #include <errlist-compat.c>
diff --git a/stdio-common/test-strerr.c b/stdio-common/test-strerr.c
new file mode 100644
index 0000000000..fded208118
--- /dev/null
+++ b/stdio-common/test-strerr.c
@@ -0,0 +1,65 @@
+/* Test strerrorname_np and strerrordesc_np.
+   Copyright (C) 2020 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <string.h>
+#include <errno.h>
+#include <array_length.h>
+
+#include <support/support.h>
+#include <support/check.h>
+
+#define N_(name)      name
+
+static const char *const errlist[] =
+  {
+/* This file is auto-generated from errlist.def.  */
+#include <errlist.h>
+  };
+
+#define MSGSTR_T errname_t
+#define MSGSTR   errname
+#define MSGIDX   errnameidx
+#include <errlist-name.h>
+#undef MSGSTR
+#undef MSGIDX
+
+static int
+do_test (void)
+{
+  TEST_VERIFY (strerrordesc_np (-1) == NULL);
+  TEST_VERIFY (strerrordesc_np (array_length (errlist)) == NULL);
+  for (size_t i = 0; i < array_length (errlist); i++)
+    {
+      if (errlist[i] == NULL)
+        continue;
+      TEST_COMPARE_STRING (strerrordesc_np (i), errlist[i]);
+    }
+
+  TEST_VERIFY (strerrorname_np (-1) == NULL);
+  TEST_VERIFY (strerrorname_np (array_length (errlist)) == NULL);
+  for (size_t i = 0; i < array_length (errlist); i++)
+    {
+      if (errlist[i] == NULL)
+        continue;
+      TEST_COMPARE_STRING (strerrorname_np (i), errname.str + errnameidx[i]);
+    }
+
+  return 0;
+}
+
+#include <support/test-driver.c>
diff --git a/string/Makefile b/string/Makefile
index 8fe7e17fe2..f8d3104e16 100644
--- a/string/Makefile
+++ b/string/Makefile
@@ -45,7 +45,8 @@ routines := strcat strchr strcmp strcoll strcpy strcspn \
    envz basename \
    strcoll_l strxfrm_l string-inlines memrchr \
    xpg-strerror strerror_l explicit_bzero \
-   sigdescr_np sigabbrev_np
+   sigdescr_np sigabbrev_np strerrorname_np \
+   strerrordesc_np
 
 strop-tests := memchr memcmp memcpy memmove mempcpy memset memccpy \
    stpcpy stpncpy strcat strchr strcmp strcpy strcspn \
diff --git a/string/Versions b/string/Versions
index 6f8dd2d372..298ecd401a 100644
--- a/string/Versions
+++ b/string/Versions
@@ -87,5 +87,6 @@ libc {
   }
   GLIBC_2.32 {
     sigdescr_np; sigabbrev_np;
+    strerrordesc_np; strerrorname_np;
   }
 }
diff --git a/string/strerrordesc_np.c b/string/strerrordesc_np.c
new file mode 100644
index 0000000000..cdaf3a7f44
--- /dev/null
+++ b/string/strerrordesc_np.c
@@ -0,0 +1,26 @@
+/* Return string describing error number.
+   Copyright (C) 2020 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdio.h>
+
+const char *
+__strerrordesc_np (int errnum)
+{
+  return __get_errlist (errnum);
+}
+weak_alias (__strerrordesc_np, strerrordesc_np)
diff --git a/string/strerrorname_np.c b/string/strerrorname_np.c
new file mode 100644
index 0000000000..bc337d20c2
--- /dev/null
+++ b/string/strerrorname_np.c
@@ -0,0 +1,25 @@
+/* Return string describing errno name.
+   Copyright (C) 2020 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdio.h>
+
+const char *
+strerrorname_np (int errnum)
+{
+  return __get_errname (errnum);
+}
diff --git a/string/string.h b/string/string.h
index 0119d7f45d..b0be00c0f7 100644
--- a/string/string.h
+++ b/string/string.h
@@ -428,6 +428,13 @@ extern int __xpg_strerror_r (int __errnum, char *__buf, size_t __buflen)
 extern char *strerror_r (int __errnum, char *__buf, size_t __buflen)
      __THROW __nonnull ((2)) __wur  __attr_access ((__write_only__, 2, 3));
 # endif
+
+# ifdef __USE_GNU
+/* Return a string describing the meaning of tthe error in ERR.  */
+extern const char *strerrordesc_np (int __err) __THROW;
+/* Return a string with the error name in ERR.  */
+extern const char *strerrorname_np (int __err) __THROW;
+# endif
 #endif
 
 #ifdef __USE_XOPEN2K8
diff --git a/sysdeps/mach/hurd/i386/libc.abilist b/sysdeps/mach/hurd/i386/libc.abilist
index 6e52e9b74a..de41e535ef 100644
--- a/sysdeps/mach/hurd/i386/libc.abilist
+++ b/sysdeps/mach/hurd/i386/libc.abilist
@@ -2181,6 +2181,8 @@ GLIBC_2.3.4 setsourcefilter F
 GLIBC_2.3.4 xdr_quad_t F
 GLIBC_2.3.4 xdr_u_quad_t F
 GLIBC_2.30 twalk_r F
+GLIBC_2.32 errdescr_np F
+GLIBC_2.32 errname_np F
 GLIBC_2.32 mach_print F
 GLIBC_2.32 mremap F
 GLIBC_2.32 sigabbrev_np F
diff --git a/sysdeps/mach/hurd/test-err_np.c b/sysdeps/mach/hurd/test-err_np.c
new file mode 100644
index 0000000000..3127141128
--- /dev/null
+++ b/sysdeps/mach/hurd/test-err_np.c
@@ -0,0 +1,4 @@
+#include <mach/error.h>
+
+#define ERR_MAP(value) err_get_code (value)
+#include <stdio-common/test-err_np.c>
diff --git a/sysdeps/unix/sysv/linux/aarch64/libc.abilist b/sysdeps/unix/sysv/linux/aarch64/libc.abilist
index bb6045d8a6..c7d8ab90c3 100644
--- a/sysdeps/unix/sysv/linux/aarch64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/aarch64/libc.abilist
@@ -2157,3 +2157,5 @@ GLIBC_2.32 pthread_getattr_np F
 GLIBC_2.32 pthread_sigmask F
 GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
+GLIBC_2.32 strerrordesc_np F
+GLIBC_2.32 strerrorname_np F
diff --git a/sysdeps/unix/sysv/linux/alpha/libc.abilist b/sysdeps/unix/sysv/linux/alpha/libc.abilist
index 8e15a58eaf..e93eee7931 100644
--- a/sysdeps/unix/sysv/linux/alpha/libc.abilist
+++ b/sysdeps/unix/sysv/linux/alpha/libc.abilist
@@ -2239,6 +2239,8 @@ GLIBC_2.32 pthread_getattr_np F
 GLIBC_2.32 pthread_sigmask F
 GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
+GLIBC_2.32 strerrordesc_np F
+GLIBC_2.32 strerrorname_np F
 GLIBC_2.4 _IO_fprintf F
 GLIBC_2.4 _IO_printf F
 GLIBC_2.4 _IO_sprintf F
diff --git a/sysdeps/unix/sysv/linux/arm/be/libc.abilist b/sysdeps/unix/sysv/linux/arm/be/libc.abilist
index ce82b840e8..02e75d655a 100644
--- a/sysdeps/unix/sysv/linux/arm/be/libc.abilist
+++ b/sysdeps/unix/sysv/linux/arm/be/libc.abilist
@@ -141,6 +141,8 @@ GLIBC_2.32 pthread_getattr_np F
 GLIBC_2.32 pthread_sigmask F
 GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
+GLIBC_2.32 strerrordesc_np F
+GLIBC_2.32 strerrorname_np F
 GLIBC_2.4 _Exit F
 GLIBC_2.4 _IO_2_1_stderr_ D 0xa0
 GLIBC_2.4 _IO_2_1_stdin_ D 0xa0
diff --git a/sysdeps/unix/sysv/linux/arm/le/libc.abilist b/sysdeps/unix/sysv/linux/arm/le/libc.abilist
index c7a436cd42..ad30a662b9 100644
--- a/sysdeps/unix/sysv/linux/arm/le/libc.abilist
+++ b/sysdeps/unix/sysv/linux/arm/le/libc.abilist
@@ -138,6 +138,8 @@ GLIBC_2.32 pthread_getattr_np F
 GLIBC_2.32 pthread_sigmask F
 GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
+GLIBC_2.32 strerrordesc_np F
+GLIBC_2.32 strerrorname_np F
 GLIBC_2.4 _Exit F
 GLIBC_2.4 _IO_2_1_stderr_ D 0xa0
 GLIBC_2.4 _IO_2_1_stdin_ D 0xa0
diff --git a/sysdeps/unix/sysv/linux/csky/libc.abilist b/sysdeps/unix/sysv/linux/csky/libc.abilist
index 7f51d47b2f..e5174594a1 100644
--- a/sysdeps/unix/sysv/linux/csky/libc.abilist
+++ b/sysdeps/unix/sysv/linux/csky/libc.abilist
@@ -2101,3 +2101,5 @@ GLIBC_2.32 pthread_getattr_np F
 GLIBC_2.32 pthread_sigmask F
 GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
+GLIBC_2.32 strerrordesc_np F
+GLIBC_2.32 strerrorname_np F
diff --git a/sysdeps/unix/sysv/linux/hppa/libc.abilist b/sysdeps/unix/sysv/linux/hppa/libc.abilist
index 053cda00a4..8e00ff5e5d 100644
--- a/sysdeps/unix/sysv/linux/hppa/libc.abilist
+++ b/sysdeps/unix/sysv/linux/hppa/libc.abilist
@@ -2060,6 +2060,8 @@ GLIBC_2.32 pthread_getattr_np F
 GLIBC_2.32 pthread_sigmask F
 GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
+GLIBC_2.32 strerrordesc_np F
+GLIBC_2.32 strerrorname_np F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/i386/libc.abilist b/sysdeps/unix/sysv/linux/i386/libc.abilist
index f18de50f9e..c84fb17c81 100644
--- a/sysdeps/unix/sysv/linux/i386/libc.abilist
+++ b/sysdeps/unix/sysv/linux/i386/libc.abilist
@@ -2226,6 +2226,8 @@ GLIBC_2.32 pthread_getattr_np F
 GLIBC_2.32 pthread_sigmask F
 GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
+GLIBC_2.32 strerrordesc_np F
+GLIBC_2.32 strerrorname_np F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/ia64/libc.abilist b/sysdeps/unix/sysv/linux/ia64/libc.abilist
index a1966cac5a..70dc72391e 100644
--- a/sysdeps/unix/sysv/linux/ia64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/ia64/libc.abilist
@@ -2092,6 +2092,8 @@ GLIBC_2.32 pthread_getattr_np F
 GLIBC_2.32 pthread_sigmask F
 GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
+GLIBC_2.32 strerrordesc_np F
+GLIBC_2.32 strerrorname_np F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
index 8f44bc9231..c96f6c98b0 100644
--- a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
+++ b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
@@ -142,6 +142,8 @@ GLIBC_2.32 pthread_getattr_np F
 GLIBC_2.32 pthread_sigmask F
 GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
+GLIBC_2.32 strerrordesc_np F
+GLIBC_2.32 strerrorname_np F
 GLIBC_2.4 _Exit F
 GLIBC_2.4 _IO_2_1_stderr_ D 0x98
 GLIBC_2.4 _IO_2_1_stdin_ D 0x98
diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
index 088f2fa0f2..e880fc83bf 100644
--- a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
+++ b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
@@ -2172,6 +2172,8 @@ GLIBC_2.32 pthread_getattr_np F
 GLIBC_2.32 pthread_sigmask F
 GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
+GLIBC_2.32 strerrordesc_np F
+GLIBC_2.32 strerrorname_np F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
index 34c1c4fdca..dce473c4b1 100644
--- a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
+++ b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
@@ -2152,3 +2152,5 @@ GLIBC_2.32 pthread_getattr_np F
 GLIBC_2.32 pthread_sigmask F
 GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
+GLIBC_2.32 strerrordesc_np F
+GLIBC_2.32 strerrorname_np F
diff --git a/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
index 099d51e893..b367f119cb 100644
--- a/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
+++ b/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
@@ -2149,3 +2149,5 @@ GLIBC_2.32 pthread_getattr_np F
 GLIBC_2.32 pthread_sigmask F
 GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
+GLIBC_2.32 strerrordesc_np F
+GLIBC_2.32 strerrorname_np F
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
index ea86646c3b..9480b7ebf9 100644
--- a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
@@ -2143,6 +2143,8 @@ GLIBC_2.32 pthread_getattr_np F
 GLIBC_2.32 pthread_sigmask F
 GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
+GLIBC_2.32 strerrordesc_np F
+GLIBC_2.32 strerrorname_np F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
index 9adac43e36..c007d170de 100644
--- a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
@@ -2141,6 +2141,8 @@ GLIBC_2.32 pthread_getattr_np F
 GLIBC_2.32 pthread_sigmask F
 GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
+GLIBC_2.32 strerrordesc_np F
+GLIBC_2.32 strerrorname_np F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
index c42c093cfb..ee7655936d 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
@@ -2149,6 +2149,8 @@ GLIBC_2.32 pthread_getattr_np F
 GLIBC_2.32 pthread_sigmask F
 GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
+GLIBC_2.32 strerrordesc_np F
+GLIBC_2.32 strerrorname_np F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
index 605e60a35e..b50be3f570 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
@@ -2143,6 +2143,8 @@ GLIBC_2.32 pthread_getattr_np F
 GLIBC_2.32 pthread_sigmask F
 GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
+GLIBC_2.32 strerrordesc_np F
+GLIBC_2.32 strerrorname_np F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/nios2/libc.abilist b/sysdeps/unix/sysv/linux/nios2/libc.abilist
index 7a57babca5..7c4127baee 100644
--- a/sysdeps/unix/sysv/linux/nios2/libc.abilist
+++ b/sysdeps/unix/sysv/linux/nios2/libc.abilist
@@ -2190,3 +2190,5 @@ GLIBC_2.32 pthread_getattr_np F
 GLIBC_2.32 pthread_sigmask F
 GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
+GLIBC_2.32 strerrordesc_np F
+GLIBC_2.32 strerrorname_np F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
index c3745c3733..ac528d2611 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
@@ -2199,6 +2199,8 @@ GLIBC_2.32 pthread_getattr_np F
 GLIBC_2.32 pthread_sigmask F
 GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
+GLIBC_2.32 strerrordesc_np F
+GLIBC_2.32 strerrorname_np F
 GLIBC_2.4 _IO_fprintf F
 GLIBC_2.4 _IO_printf F
 GLIBC_2.4 _IO_sprintf F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
index 719512e999..d5279024c8 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
@@ -2232,6 +2232,8 @@ GLIBC_2.32 pthread_getattr_np F
 GLIBC_2.32 pthread_sigmask F
 GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
+GLIBC_2.32 strerrordesc_np F
+GLIBC_2.32 strerrorname_np F
 GLIBC_2.4 _IO_fprintf F
 GLIBC_2.4 _IO_printf F
 GLIBC_2.4 _IO_sprintf F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
index 3f79daa39c..ee312901f6 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
@@ -2062,6 +2062,8 @@ GLIBC_2.32 pthread_getattr_np F
 GLIBC_2.32 pthread_sigmask F
 GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
+GLIBC_2.32 strerrordesc_np F
+GLIBC_2.32 strerrorname_np F
 GLIBC_2.4 _IO_fprintf F
 GLIBC_2.4 _IO_printf F
 GLIBC_2.4 _IO_sprintf F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
index af1a2ae8a6..400b8f4e8b 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
@@ -2352,3 +2352,5 @@ GLIBC_2.32 pthread_getattr_np F
 GLIBC_2.32 pthread_sigmask F
 GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
+GLIBC_2.32 strerrordesc_np F
+GLIBC_2.32 strerrorname_np F
diff --git a/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist b/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
index ff5b64c1dd..03e477bc75 100644
--- a/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
@@ -2119,3 +2119,5 @@ GLIBC_2.32 pthread_getattr_np F
 GLIBC_2.32 pthread_sigmask F
 GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
+GLIBC_2.32 strerrordesc_np F
+GLIBC_2.32 strerrorname_np F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
index 576caca63c..a82ce6bfea 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
@@ -2197,6 +2197,8 @@ GLIBC_2.32 pthread_getattr_np F
 GLIBC_2.32 pthread_sigmask F
 GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
+GLIBC_2.32 strerrordesc_np F
+GLIBC_2.32 strerrorname_np F
 GLIBC_2.4 _IO_fprintf F
 GLIBC_2.4 _IO_printf F
 GLIBC_2.4 _IO_sprintf F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
index 7201b10288..1b4c4a79b9 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
@@ -2098,6 +2098,8 @@ GLIBC_2.32 pthread_getattr_np F
 GLIBC_2.32 pthread_sigmask F
 GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
+GLIBC_2.32 strerrordesc_np F
+GLIBC_2.32 strerrorname_np F
 GLIBC_2.4 _IO_fprintf F
 GLIBC_2.4 _IO_printf F
 GLIBC_2.4 _IO_sprintf F
diff --git a/sysdeps/unix/sysv/linux/sh/be/libc.abilist b/sysdeps/unix/sysv/linux/sh/be/libc.abilist
index 4f954ac7ee..8e5cd9f9b8 100644
--- a/sysdeps/unix/sysv/linux/sh/be/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sh/be/libc.abilist
@@ -2067,6 +2067,8 @@ GLIBC_2.32 pthread_getattr_np F
 GLIBC_2.32 pthread_sigmask F
 GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
+GLIBC_2.32 strerrordesc_np F
+GLIBC_2.32 strerrorname_np F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/sh/le/libc.abilist b/sysdeps/unix/sysv/linux/sh/le/libc.abilist
index 9db9ba5cc0..ccff98f7ff 100644
--- a/sysdeps/unix/sysv/linux/sh/le/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sh/le/libc.abilist
@@ -2064,6 +2064,8 @@ GLIBC_2.32 pthread_getattr_np F
 GLIBC_2.32 pthread_sigmask F
 GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
+GLIBC_2.32 strerrordesc_np F
+GLIBC_2.32 strerrorname_np F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
index ecb54db317..9e4b84970b 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
@@ -2188,6 +2188,8 @@ GLIBC_2.32 pthread_getattr_np F
 GLIBC_2.32 pthread_sigmask F
 GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
+GLIBC_2.32 strerrordesc_np F
+GLIBC_2.32 strerrorname_np F
 GLIBC_2.4 _IO_fprintf F
 GLIBC_2.4 _IO_printf F
 GLIBC_2.4 _IO_sprintf F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
index 74bd6efed8..99b0e1b48b 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
@@ -2115,6 +2115,8 @@ GLIBC_2.32 pthread_getattr_np F
 GLIBC_2.32 pthread_sigmask F
 GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
+GLIBC_2.32 strerrordesc_np F
+GLIBC_2.32 strerrorname_np F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
index 50e45a43e8..1fc276173f 100644
--- a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
@@ -2073,6 +2073,8 @@ GLIBC_2.32 pthread_getattr_np F
 GLIBC_2.32 pthread_sigmask F
 GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
+GLIBC_2.32 strerrordesc_np F
+GLIBC_2.32 strerrorname_np F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
index 59b26b097d..f81123e6b4 100644
--- a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
@@ -2170,3 +2170,5 @@ GLIBC_2.32 pthread_getattr_np F
 GLIBC_2.32 pthread_sigmask F
 GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
+GLIBC_2.32 strerrordesc_np F
+GLIBC_2.32 strerrorname_np F
--
2.25.1

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH v6] string: Add strerrorname_np and strerrordesc_np

Andreas Schwab-2
On Jul 06 2020, Adhemerval Zanella via Libc-alpha wrote:

> diff --git a/sysdeps/mach/hurd/i386/libc.abilist b/sysdeps/mach/hurd/i386/libc.abilist
> index 6e52e9b74a..de41e535ef 100644
> --- a/sysdeps/mach/hurd/i386/libc.abilist
> +++ b/sysdeps/mach/hurd/i386/libc.abilist
> @@ -2181,6 +2181,8 @@ GLIBC_2.3.4 setsourcefilter F
>  GLIBC_2.3.4 xdr_quad_t F
>  GLIBC_2.3.4 xdr_u_quad_t F
>  GLIBC_2.30 twalk_r F
> +GLIBC_2.32 errdescr_np F
> +GLIBC_2.32 errname_np F

No such functions.

Andreas.

--
Andreas Schwab, [hidden email]
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."
123