[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 v6] string: Add strerrorname_np and strerrordesc_np

Sourceware - libc-alpha mailing list


On 06/07/2020 11:04, Andreas Schwab wrote:

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

Sigh, I just run the update scrip on linux folders... I fixed it
locally, thanks.
Reply | Threaded
Open this post in threaded view
|

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

Sourceware - libc-alpha mailing list
In reply to this post by Sourceware - libc-alpha mailing list
On 7/6/20 9:57 AM, Adhemerval Zanella wrote:

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

OK for master if you fix the hurd symbol names in the abi list.

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

> 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

As Andreas noted this is wrong.

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


--
Cheers,
Carlos.

Reply | Threaded
Open this post in threaded view
|

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

Tamar Christina-2
In reply to this post by Sourceware - libc-alpha mailing list
Sorry, also forwarding to mailing list.

For some reason client drops it from CC when I do reply-all..

> -----Original Message-----
> From: Tamar Christina
> Sent: Wednesday, July 8, 2020 12:16 PM
> To: Adhemerval Zanella <[hidden email]>; Carlos O'Donell
> <[hidden email]>
> Subject: RE: [PATCH v5 12/13] string: Add sigabbrev_np and sigdescr_np
>
> Hi,
>
> This commit seems to have broken the aarch64 build:
>
>   sigdescr_np.c:24:1: error: conflicting types for ‘__sigdescr_np’
>    __sigdescr_np (int signum)
>    ^~~~~~~~~~~~~
>
>   In file included from <command-line>:0:0:
>   ../include/string.h:57:20: note: previous declaration of ‘__sigdescr_np’ was
> here
>    libc_hidden_proto (__sigdescr_np)
>                       ^
>   ./../include/libc-symbols.h:605:33: note: in definition of macro
> ‘__hidden_proto’
>      extern thread __typeof (name) name __hidden_proto_hiddenattr (attrs);
>                                    ^~~~
>
>   ./../include/libc-symbols.h:624:44: note: in expansion of macro
> ‘hidden_proto’
>    # define libc_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
>                                               ^~~~~~~~~~~~
>   ../include/string.h:57:1: note: in expansion of macro ‘libc_hidden_proto’
>    libc_hidden_proto (__sigdescr_np)
>    ^~~~~~~~~~~~~~~~~
>
>   In file included from <command-line>:0:0:
>   ../o-iterator.mk:9: recipe for target '/home/teamcity-
> agent/work/fcc7c27539f88edf/build/string/sigdescr_np.o' failed
>   sigdescr_np.c:34:28: error: conflicting types for ‘sigdescr_np’
>    weak_alias (__sigdescr_np, sigdescr_np)
>                               ^
>   ./../include/libc-symbols.h:152:26: note: in definition of macro ‘_weak_alias’
>      extern __typeof (name) aliasname __attribute__ ((weak, alias (#name)))
> \
>                             ^~~~~~~~~
>   sigdescr_np.c:34:1: note: in expansion of macro ‘weak_alias’
>    weak_alias (__sigdescr_np, sigdescr_np)
>    ^~~~~~~~~~
>   In file included from ../include/string.h:63:0,
>                    from sigdescr_np.c:19:
>   ../string/string.h:469:20: note: previous declaration of ‘sigdescr_np’ was
> here
>    extern const char *sigdescr_np (int __sig) __THROW;
>                       ^~~~~~~~~~~
>   make[2]: *** [/home/teamcity-
> agent/work/fcc7c27539f88edf/build/string/sigdescr_np.o] Error 1
>   make[2]: *** Waiting for unfinished jobs....
>   sigabbrev_np.c:24:1: error: conflicting types for ‘sigabbrev_np’
>    sigabbrev_np (int signum)
>    ^~~~~~~~~~~~
>   In file included from ../include/string.h:63:0,
>                    from sigabbrev_np.c:19:
>   ../string/string.h:466:20: note: previous declaration of ‘sigabbrev_np’ was
> here
>    extern const char *sigabbrev_np (int __sig) __THROW;
>                       ^~~~~~~~~~~~
>
> I'm afraid I don't know glibc internals well enough to know what the right fix
> is here...
>
> Thanks,
> Tamar
>
> > -----Original Message-----
> > From: Libc-alpha <[hidden email]> On Behalf Of
> > Adhemerval Zanella via Libc-alpha
> > Sent: Friday, July 3, 2020 9:24 PM
> > To: Carlos O'Donell <[hidden email]>; [hidden email]
> > Subject: Re: [PATCH v5 12/13] string: Add sigabbrev_np and sigdescr_np
> >
> >
> >
> > 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 12/13] string: Add sigabbrev_np and sigdescr_np

Sourceware - libc-alpha mailing list
* Tamar Christina:

> This commit seems to have broken the aarch64 build:
>
>   sigdescr_np.c:24:1: error: conflicting types for ‘__sigdescr_np’
>    __sigdescr_np (int signum)
>    ^~~~~~~~~~~~~
>
>   In file included from <command-line>:0:0:
>   ../include/string.h:57:20: note: previous declaration of ‘__sigdescr_np’ was
> here
>    libc_hidden_proto (__sigdescr_np)
>                       ^
>   ./../include/libc-symbols.h:605:33: note: in definition of macro
> ‘__hidden_proto’
>      extern thread __typeof (name) name __hidden_proto_hiddenattr (attrs);
>                                    ^~~~
>
>   ./../include/libc-symbols.h:624:44: note: in expansion of macro
> ‘hidden_proto’
>    # define libc_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
>                                               ^~~~~~~~~~~~
>   ../include/string.h:57:1: note: in expansion of macro ‘libc_hidden_proto’
>    libc_hidden_proto (__sigdescr_np)
>    ^~~~~~~~~~~~~~~~~
>
>   In file included from <command-line>:0:0:
>   ../o-iterator.mk:9: recipe for target '/home/teamcity-
> agent/work/fcc7c27539f88edf/build/string/sigdescr_np.o' failed
>   sigdescr_np.c:34:28: error: conflicting types for ‘sigdescr_np’
>    weak_alias (__sigdescr_np, sigdescr_np)
>                               ^
>   ./../include/libc-symbols.h:152:26: note: in definition of macro ‘_weak_alias’
>      extern __typeof (name) aliasname __attribute__ ((weak, alias (#name)))
> \
>                             ^~~~~~~~~
>   sigdescr_np.c:34:1: note: in expansion of macro ‘weak_alias’
>    weak_alias (__sigdescr_np, sigdescr_np)
>    ^~~~~~~~~~
>   In file included from ../include/string.h:63:0,
>                    from sigdescr_np.c:19:
>   ../string/string.h:469:20: note: previous declaration of ‘sigdescr_np’ was
> here
>    extern const char *sigdescr_np (int __sig) __THROW;
>                       ^~~~~~~~~~~
>   make[2]: *** [/home/teamcity-
> agent/work/fcc7c27539f88edf/build/string/sigdescr_np.o] Error 1
>   make[2]: *** Waiting for unfinished jobs....
>   sigabbrev_np.c:24:1: error: conflicting types for ‘sigabbrev_np’
>    sigabbrev_np (int signum)
>    ^~~~~~~~~~~~
>   In file included from ../include/string.h:63:0,
>                    from sigabbrev_np.c:19:
>   ../string/string.h:466:20: note: previous declaration of ‘sigabbrev_np’ was
> here
>    extern const char *sigabbrev_np (int __sig) __THROW;
>                       ^~~~~~~~~~~~
>
> I'm afraid I don't know glibc internals well enough to know what the
> right fix is here...

What's your GCC version?  I don't see this when building with a GCC 10
cross-compiler.

Thanks,
Florian

Reply | Threaded
Open this post in threaded view
|

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

Tamar Christina-2
Hi Florian,

> -----Original Message-----
> From: Florian Weimer <[hidden email]>
> Sent: Wednesday, July 8, 2020 12:37 PM
>
> * Tamar Christina:
>
> > This commit seems to have broken the aarch64 build:
> >
> >   sigdescr_np.c:24:1: error: conflicting types for ‘__sigdescr_np’
> >    __sigdescr_np (int signum)
> >    ^~~~~~~~~~~~~
> >
> >   In file included from <command-line>:0:0:
> >   ../include/string.h:57:20: note: previous declaration of
> > ‘__sigdescr_np’ was here
> >    libc_hidden_proto (__sigdescr_np)
> >                       ^
> >   ./../include/libc-symbols.h:605:33: note: in definition of macro
> > ‘__hidden_proto’
> >      extern thread __typeof (name) name __hidden_proto_hiddenattr
> (attrs);
> >                                    ^~~~
> >
> >   ./../include/libc-symbols.h:624:44: note: in expansion of macro
> > ‘hidden_proto’
> >    # define libc_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
> >                                               ^~~~~~~~~~~~
> >   ../include/string.h:57:1: note: in expansion of macro ‘libc_hidden_proto’
> >    libc_hidden_proto (__sigdescr_np)
> >    ^~~~~~~~~~~~~~~~~
> >
> >   In file included from <command-line>:0:0:
> >   ../o-iterator.mk:9: recipe for target '/home/teamcity-
> > agent/work/fcc7c27539f88edf/build/string/sigdescr_np.o' failed
> >   sigdescr_np.c:34:28: error: conflicting types for ‘sigdescr_np’
> >    weak_alias (__sigdescr_np, sigdescr_np)
> >                               ^
> >   ./../include/libc-symbols.h:152:26: note: in definition of macro
> ‘_weak_alias’
> >      extern __typeof (name) aliasname __attribute__ ((weak, alias
> > (#name))) \
> >                             ^~~~~~~~~
> >   sigdescr_np.c:34:1: note: in expansion of macro ‘weak_alias’
> >    weak_alias (__sigdescr_np, sigdescr_np)
> >    ^~~~~~~~~~
> >   In file included from ../include/string.h:63:0,
> >                    from sigdescr_np.c:19:
> >   ../string/string.h:469:20: note: previous declaration of
> > ‘sigdescr_np’ was here
> >    extern const char *sigdescr_np (int __sig) __THROW;
> >                       ^~~~~~~~~~~
> >   make[2]: *** [/home/teamcity-
> > agent/work/fcc7c27539f88edf/build/string/sigdescr_np.o] Error 1
> >   make[2]: *** Waiting for unfinished jobs....
> >   sigabbrev_np.c:24:1: error: conflicting types for ‘sigabbrev_np’
> >    sigabbrev_np (int signum)
> >    ^~~~~~~~~~~~
> >   In file included from ../include/string.h:63:0,
> >                    from sigabbrev_np.c:19:
> >   ../string/string.h:466:20: note: previous declaration of
> > ‘sigabbrev_np’ was here
> >    extern const char *sigabbrev_np (int __sig) __THROW;
> >                       ^~~~~~~~~~~~
> >
> > I'm afraid I don't know glibc internals well enough to know what the
> > right fix is here...
>
> What's your GCC version?  I don't see this when building with a GCC 10 cross-
> compiler.

It seems to be GCC 6.3 from a native Debian docker image

0e188cdeda88 ~# gcc --version
...
gcc version 6.3.0 20170516 (Debian 6.3.0-18+deb9u1)
...

0e188cdeda88 ~# lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 9.12 (stretch)
Release:        9.12
Codename:       stretch

Cheers,
Tamar

>
> Thanks,
> Florian

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
* Tamar Christina:

>> What's your GCC version?  I don't see this when building with a GCC
>> 10 cross- compiler.
>
> It seems to be GCC 6.3 from a native Debian docker image
>
> 0e188cdeda88 ~# gcc --version
> ...
> gcc version 6.3.0 20170516 (Debian 6.3.0-18+deb9u1)
> ...
>
> 0e188cdeda88 ~# lsb_release -a
> No LSB modules are available.
> Distributor ID: Debian
> Description:    Debian GNU/Linux 9.12 (stretch)
> Release:        9.12
> Codename:       stretch

I see.  Looks like GCC 6 does not discard the const on the return type,
although it has no effect in C:

const char *const
sigabbrev_np (int signum)
{


Does this patch fixes things for you?

diff --git a/string/sigabbrev_np.c b/string/sigabbrev_np.c
index 3cbe14e769..a5ac6da053 100644
--- a/string/sigabbrev_np.c
+++ b/string/sigabbrev_np.c
@@ -20,7 +20,7 @@
 #include <signal.h>
 #include <array_length.h>
 
-const char *const
+const char *
 sigabbrev_np (int signum)
 {
   const char *abbrev = NULL;
diff --git a/string/sigdescr_np.c b/string/sigdescr_np.c
index 5bcf814c1d..bf2d462b9c 100644
--- a/string/sigdescr_np.c
+++ b/string/sigdescr_np.c
@@ -20,7 +20,7 @@
 #include <signal.h>
 #include <array_length.h>
 
-const char *const
+const char *
 __sigdescr_np (int signum)
 {
   const char *descr = NULL;


Thanks,
Florian

Reply | Threaded
Open this post in threaded view
|

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

Tamar Christina-2
Hi Florian,

Yup, that patch works.

Thanks!
Tamar

> -----Original Message-----
> From: Florian Weimer <[hidden email]>
> Sent: Wednesday, July 8, 2020 12:52 PM
> To: Tamar Christina <[hidden email]>
> Cc: Adhemerval Zanella <[hidden email]>; Carlos O'Donell
> <[hidden email]>; [hidden email]
> Subject: Re: [PATCH v5 12/13] string: Add sigabbrev_np and sigdescr_np
>
> * Tamar Christina:
>
> >> What's your GCC version?  I don't see this when building with a GCC
> >> 10 cross- compiler.
> >
> > It seems to be GCC 6.3 from a native Debian docker image
> >
> > 0e188cdeda88 ~# gcc --version
> > ...
> > gcc version 6.3.0 20170516 (Debian 6.3.0-18+deb9u1) ...
> >
> > 0e188cdeda88 ~# lsb_release -a
> > No LSB modules are available.
> > Distributor ID: Debian
> > Description:    Debian GNU/Linux 9.12 (stretch)
> > Release:        9.12
> > Codename:       stretch
>
> I see.  Looks like GCC 6 does not discard the const on the return type,
> although it has no effect in C:
>
> const char *const
> sigabbrev_np (int signum)
> {
> …
>
> Does this patch fixes things for you?
>
> diff --git a/string/sigabbrev_np.c b/string/sigabbrev_np.c index
> 3cbe14e769..a5ac6da053 100644
> --- a/string/sigabbrev_np.c
> +++ b/string/sigabbrev_np.c
> @@ -20,7 +20,7 @@
>  #include <signal.h>
>  #include <array_length.h>
>
> -const char *const
> +const char *
>  sigabbrev_np (int signum)
>  {
>    const char *abbrev = NULL;
> diff --git a/string/sigdescr_np.c b/string/sigdescr_np.c index
> 5bcf814c1d..bf2d462b9c 100644
> --- a/string/sigdescr_np.c
> +++ b/string/sigdescr_np.c
> @@ -20,7 +20,7 @@
>  #include <signal.h>
>  #include <array_length.h>
>
> -const char *const
> +const char *
>  __sigdescr_np (int signum)
>  {
>    const char *descr = NULL;
>
>
> Thanks,
> Florian

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
Thanks for catching it, the oldest gcc I tested it was 7.5.

On 08/07/2020 09:16, Tamar Christina wrote:

> Hi Florian,
>
> Yup, that patch works.
>
> Thanks!
> Tamar
>
>> -----Original Message-----
>> From: Florian Weimer <[hidden email]>
>> Sent: Wednesday, July 8, 2020 12:52 PM
>> To: Tamar Christina <[hidden email]>
>> Cc: Adhemerval Zanella <[hidden email]>; Carlos O'Donell
>> <[hidden email]>; [hidden email]
>> Subject: Re: [PATCH v5 12/13] string: Add sigabbrev_np and sigdescr_np
>>
>> * Tamar Christina:
>>
>>>> What's your GCC version?  I don't see this when building with a GCC
>>>> 10 cross- compiler.
>>>
>>> It seems to be GCC 6.3 from a native Debian docker image
>>>
>>> 0e188cdeda88 ~# gcc --version
>>> ...
>>> gcc version 6.3.0 20170516 (Debian 6.3.0-18+deb9u1) ...
>>>
>>> 0e188cdeda88 ~# lsb_release -a
>>> No LSB modules are available.
>>> Distributor ID: Debian
>>> Description:    Debian GNU/Linux 9.12 (stretch)
>>> Release:        9.12
>>> Codename:       stretch
>>
>> I see.  Looks like GCC 6 does not discard the const on the return type,
>> although it has no effect in C:
>>
>> const char *const
>> sigabbrev_np (int signum)
>> {
>> …
>>
>> Does this patch fixes things for you?
>>
>> diff --git a/string/sigabbrev_np.c b/string/sigabbrev_np.c index
>> 3cbe14e769..a5ac6da053 100644
>> --- a/string/sigabbrev_np.c
>> +++ b/string/sigabbrev_np.c
>> @@ -20,7 +20,7 @@
>>  #include <signal.h>
>>  #include <array_length.h>
>>
>> -const char *const
>> +const char *
>>  sigabbrev_np (int signum)
>>  {
>>    const char *abbrev = NULL;
>> diff --git a/string/sigdescr_np.c b/string/sigdescr_np.c index
>> 5bcf814c1d..bf2d462b9c 100644
>> --- a/string/sigdescr_np.c
>> +++ b/string/sigdescr_np.c
>> @@ -20,7 +20,7 @@
>>  #include <signal.h>
>>  #include <array_length.h>
>>
>> -const char *const
>> +const char *
>>  __sigdescr_np (int signum)
>>  {
>>    const char *descr = NULL;
>>
>>
>> Thanks,
>> Florian
>
123