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

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

Sourceware - libc-alpha mailing list
It refactor how signals are defined by each architecture.  Instead of
include a generic header (bits/signum-generic.h) and undef non-default
values in an arch specific header (bits/signum.h) the new scheme uses a
common definition (bits/signum-generic.h) and each architectures add
its specific definitions on a new header (bits/signum-arch.h).

For Linux it requires copy some system default definitions to alpha,
hppa, and sparc.  They are historical values and newer ports uses
the generic Linux signum-arch.h.

For Hurd the BSD signum is removed and moved to a new header (it is
used currently only on Hurd).

Checked on a build against all affected ABIs.
---
 bits/signum-arch.h                            | 59 +++++++++++++++
 bits/signum-generic.h                         | 27 +------
 bits/signum.h                                 | 32 --------
 signal/Makefile                               |  2 +-
 signal/signal.h                               |  2 +-
 sysdeps/mach/hurd/bits/signum-arch.h          | 65 ++++++++++++++++
 sysdeps/unix/bsd/bits/signum.h                | 35 ---------
 .../unix/sysv/linux/alpha/bits/signum-arch.h  | 67 +++++++++++++++++
 sysdeps/unix/sysv/linux/alpha/bits/signum.h   | 40 ----------
 sysdeps/unix/sysv/linux/bits/signum-arch.h    | 64 ++++++++++++++++
 sysdeps/unix/sysv/linux/bits/signum.h         | 58 --------------
 .../unix/sysv/linux/hppa/bits/signum-arch.h   | 69 +++++++++++++++++
 sysdeps/unix/sysv/linux/hppa/bits/signum.h    | 75 -------------------
 sysdeps/unix/sysv/linux/ia64/vfork.S          |  2 +-
 .../unix/sysv/linux/mips/bits/signum-arch.h   | 65 ++++++++++++++++
 sysdeps/unix/sysv/linux/mips/bits/signum.h    | 68 -----------------
 .../unix/sysv/linux/sparc/bits/signum-arch.h  | 66 ++++++++++++++++
 sysdeps/unix/sysv/linux/sparc/bits/signum.h   | 39 ----------
 18 files changed, 461 insertions(+), 374 deletions(-)
 create mode 100644 bits/signum-arch.h
 delete mode 100644 bits/signum.h
 create mode 100644 sysdeps/mach/hurd/bits/signum-arch.h
 delete mode 100644 sysdeps/unix/bsd/bits/signum.h
 create mode 100644 sysdeps/unix/sysv/linux/alpha/bits/signum-arch.h
 delete mode 100644 sysdeps/unix/sysv/linux/alpha/bits/signum.h
 create mode 100644 sysdeps/unix/sysv/linux/bits/signum-arch.h
 delete mode 100644 sysdeps/unix/sysv/linux/bits/signum.h
 create mode 100644 sysdeps/unix/sysv/linux/hppa/bits/signum-arch.h
 delete mode 100644 sysdeps/unix/sysv/linux/hppa/bits/signum.h
 create mode 100644 sysdeps/unix/sysv/linux/mips/bits/signum-arch.h
 delete mode 100644 sysdeps/unix/sysv/linux/mips/bits/signum.h
 create mode 100644 sysdeps/unix/sysv/linux/sparc/bits/signum-arch.h
 delete mode 100644 sysdeps/unix/sysv/linux/sparc/bits/signum.h

diff --git a/bits/signum-arch.h b/bits/signum-arch.h
new file mode 100644
index 0000000000..abecff2345
--- /dev/null
+++ b/bits/signum-arch.h
@@ -0,0 +1,59 @@
+/* Signal number constants.  Specific architecture definitions.
+   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/>.  */
+
+#ifndef _BITS_SIGNUM_ARCH_H
+#define _BITS_SIGNUM_ARCH_H 1
+
+#ifndef _SIGNAL_H
+#error "Never include <bits/signum-generic.h> directly; use <signal.h> instead."
+#endif
+
+/* Historical signals specified by POSIX. */
+#define SIGBUS 10 /* Bus error.  */
+#define SIGSYS 12 /* Bad system call.  */
+
+/* New(er) POSIX signals (1003.1-2008, 1003.1-2013).  */
+#define SIGURG 16 /* Urgent data is available at a socket.  */
+#define SIGSTOP 17 /* Stop, unblockable.  */
+#define SIGTSTP 18 /* Keyboard stop.  */
+#define SIGCONT 19 /* Continue.  */
+#define SIGCHLD 20 /* Child terminated or stopped.  */
+#define SIGTTIN 21 /* Background read from control terminal.  */
+#define SIGTTOU 22 /* Background write to control terminal.  */
+#define SIGPOLL 23 /* Pollable event occurred (System V).  */
+#define SIGXCPU 24 /* CPU time limit exceeded.  */
+#define SIGVTALRM 26 /* Virtual timer expired.  */
+#define SIGPROF 27 /* Profiling timer expired.  */
+#define SIGXFSZ 25 /* File size limit exceeded.  */
+#define SIGUSR1 30 /* User-defined signal 1.  */
+#define SIGUSR2 31 /* User-defined signal 2.  */
+
+/* Nonstandard signals found in all modern POSIX systems
+   (including both BSD and Linux).  */
+#define SIGWINCH 28 /* Window size change (4.3 BSD, Sun).  */
+
+/* Archaic names for compatibility.  */
+#define SIGIO SIGPOLL /* I/O now possible (4.2 BSD).  */
+#define SIGIOT SIGABRT /* IOT instruction, abort() on a PDP-11.  */
+#define SIGCLD SIGCHLD /* Old System V name */
+
+/* By default no real-time signals are supported.  */
+#define __SIGRTMIN 32
+#define __SIGRTMAX __SIGRTMIN
+
+#endif
diff --git a/bits/signum-generic.h b/bits/signum-generic.h
index 504e5fb8c8..67131853c2 100644
--- a/bits/signum-generic.h
+++ b/bits/signum-generic.h
@@ -57,31 +57,9 @@
 #define SIGQUIT 3 /* Quit.  */
 #define SIGTRAP 5 /* Trace/breakpoint trap.  */
 #define SIGKILL 9 /* Killed.  */
-#define SIGBUS 10 /* Bus error.  */
-#define SIGSYS 12 /* Bad system call.  */
 #define SIGPIPE 13 /* Broken pipe.  */
 #define SIGALRM 14 /* Alarm clock.  */
 
-/* New(er) POSIX signals (1003.1-2008, 1003.1-2013).  */
-#define SIGURG 16 /* Urgent data is available at a socket.  */
-#define SIGSTOP 17 /* Stop, unblockable.  */
-#define SIGTSTP 18 /* Keyboard stop.  */
-#define SIGCONT 19 /* Continue.  */
-#define SIGCHLD 20 /* Child terminated or stopped.  */
-#define SIGTTIN 21 /* Background read from control terminal.  */
-#define SIGTTOU 22 /* Background write to control terminal.  */
-#define SIGPOLL 23 /* Pollable event occurred (System V).  */
-#define SIGXCPU 24 /* CPU time limit exceeded.  */
-#define SIGXFSZ 25 /* File size limit exceeded.  */
-#define SIGVTALRM 26 /* Virtual timer expired.  */
-#define SIGPROF 27 /* Profiling timer expired.  */
-#define SIGUSR1 30 /* User-defined signal 1.  */
-#define SIGUSR2 31 /* User-defined signal 2.  */
-
-/* Nonstandard signals found in all modern POSIX systems
-   (including both BSD and Linux).  */
-#define SIGWINCH 28 /* Window size change (4.3 BSD, Sun).  */
-
 /* Archaic names for compatibility.  */
 #define SIGIO SIGPOLL /* I/O now possible (4.2 BSD).  */
 #define SIGIOT SIGABRT /* IOT instruction, abort() on a PDP-11.  */
@@ -93,8 +71,9 @@
    but some real-time signals may be used internally by glibc.  Do not
    use these constants in application code; use SIGRTMIN and SIGRTMAX
    (defined in signal.h) instead.  */
-#define __SIGRTMIN 32
-#define __SIGRTMAX __SIGRTMIN
+
+/* Include system specific bits.  */
+#include <bits/signum-arch.h>
 
 /* Biggest signal number + 1 (including real-time signals).  */
 #define _NSIG (__SIGRTMAX + 1)
diff --git a/bits/signum.h b/bits/signum.h
deleted file mode 100644
index 183e3c0545..0000000000
--- a/bits/signum.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Signal number constants.  Generic version.
-   Copyright (C) 2017-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/>.  */
-
-#ifndef _BITS_SIGNUM_H
-#define _BITS_SIGNUM_H 1
-
-#ifndef _SIGNAL_H
-#error "Never include <bits/signum.h> directly; use <signal.h> instead."
-#endif
-
-#include <bits/signum-generic.h>
-
-/* This operating system does not need to override any of the generic
-   signal number assignments in bits/signum-generic.h, nor to add any
-   additional signal constants.  */
-
-#endif /* bits/signum.h.  */
diff --git a/signal/Makefile b/signal/Makefile
index f3c19e2992..2ec3ddd74f 100644
--- a/signal/Makefile
+++ b/signal/Makefile
@@ -23,7 +23,7 @@ subdir := signal
 include ../Makeconfig
 
 headers := signal.h sys/signal.h \
-   bits/signum.h bits/signum-generic.h \
+   bits/signum-generic.h bits/signum-arch.h \
    bits/sigcontext.h bits/sigaction.h \
    bits/sigevent-consts.h bits/siginfo-consts.h \
    bits/sigstack.h bits/sigthread.h bits/ss_flags.h \
diff --git a/signal/signal.h b/signal/signal.h
index 2c57f90e20..db325bde16 100644
--- a/signal/signal.h
+++ b/signal/signal.h
@@ -27,7 +27,7 @@
 __BEGIN_DECLS
 
 #include <bits/types.h>
-#include <bits/signum.h>
+#include <bits/signum-generic.h>
 
 #include <bits/types/sig_atomic_t.h>
 
diff --git a/sysdeps/mach/hurd/bits/signum-arch.h b/sysdeps/mach/hurd/bits/signum-arch.h
new file mode 100644
index 0000000000..bfcb37a47c
--- /dev/null
+++ b/sysdeps/mach/hurd/bits/signum-arch.h
@@ -0,0 +1,65 @@
+/* Signal number constants.  Specific architecture definitions.
+   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/>.  */
+
+#ifndef _BITS_SIGNUM_ARCH_H
+#define _BITS_SIGNUM_ARCH_H 1
+
+#ifndef _SIGNAL_H
+#error "Never include <bits/signum-arch.h> directly; use <signal.h> instead."
+#endif
+
+/* Historical signals specified by POSIX. */
+#define SIGBUS 10 /* Bus error.  */
+#define SIGSYS 12 /* Bad system call.  */
+
+/* Adjustments and additions to the signal number constants for
+   4.2 or 4.3 BSD-derived Unix systems.  */
+#define SIGEMT 7 /* Emulator trap (4.2 BSD).  */
+#define SIGINFO 29 /* Information request (4.4 BSD).  */
+#define SIGLOST 32 /* Resource lost (Sun); server died (GNU).  */
+
+/* New(er) POSIX signals (1003.1-2008, 1003.1-2013).  */
+#define SIGURG 16 /* Urgent data is available at a socket.  */
+#define SIGSTOP 17 /* Stop, unblockable.  */
+#define SIGTSTP 18 /* Keyboard stop.  */
+#define SIGCONT 19 /* Continue.  */
+#define SIGCHLD 20 /* Child terminated or stopped.  */
+#define SIGTTIN 21 /* Background read from control terminal.  */
+#define SIGTTOU 22 /* Background write to control terminal.  */
+#define SIGPOLL 23 /* Pollable event occurred (System V).  */
+#define SIGXCPU 24 /* CPU time limit exceeded.  */
+#define SIGVTALRM 26 /* Virtual timer expired.  */
+#define SIGPROF 27 /* Profiling timer expired.  */
+#define SIGXFSZ 25 /* File size limit exceeded.  */
+#define SIGUSR1 30 /* User-defined signal 1.  */
+#define SIGUSR2 31 /* User-defined signal 2.  */
+
+/* Nonstandard signals found in all modern POSIX systems
+   (including both BSD and Linux).  */
+#define SIGWINCH 28 /* Window size change (4.3 BSD, Sun).  */
+
+/* Archaic names for compatibility.  */
+#define SIGIO SIGPOLL /* I/O now possible (4.2 BSD).  */
+#define SIGIOT SIGABRT /* IOT instruction, abort() on a PDP-11.  */
+#define SIGCLD SIGCHLD /* Old System V name */
+
+/* No real-time signals are supported.  */
+#define __SIGRTMIN 32
+#define __SIGRTMAX __SIGRTMIN
+
+#endif
diff --git a/sysdeps/unix/bsd/bits/signum.h b/sysdeps/unix/bsd/bits/signum.h
deleted file mode 100644
index a8d47af038..0000000000
--- a/sysdeps/unix/bsd/bits/signum.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Signal number definitions.  BSD version.
-   Copyright (C) 1991-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/>.  */
-
-#ifndef _BITS_SIGNUM_H
-#define _BITS_SIGNUM_H 1
-
-#ifndef _SIGNAL_H
-#error "Never include <bits/signum.h> directly; use <signal.h> instead."
-#endif
-
-#include <bits/signum-generic.h>
-
-/* Adjustments and additions to the signal number constants for
-   4.2 or 4.3 BSD-derived Unix systems.  */
-
-#define SIGEMT 7 /* Emulator trap (4.2 BSD).  */
-#define SIGINFO 29 /* Information request (4.4 BSD).  */
-#define SIGLOST 32 /* Resource lost (Sun); server died (GNU).  */
-
-#endif /* bits/signum.h.  */
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/signum-arch.h b/sysdeps/unix/sysv/linux/alpha/bits/signum-arch.h
new file mode 100644
index 0000000000..47200d7337
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/alpha/bits/signum-arch.h
@@ -0,0 +1,67 @@
+/* Signal number definitions.  Linux/Alpha version.
+   Copyright (C) 1996-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/>.  */
+
+#ifndef _BITS_SIGNUM_ARCH_H
+#define _BITS_SIGNUM_ARCH_H 1
+
+#ifndef _SIGNAL_H
+#error "Never include <bits/signum-arch.h> directly; use <signal.h> instead."
+#endif
+
+/* Adjustments and additions to the signal number constants for
+   Linux/Alpha.  Signal values on this platform were chosen for OSF/1
+   binary compatibility, and are therefore almost identical to the
+   BSD-derived defaults.  */
+
+#define SIGEMT 7 /* Emulator trap (4.2 BSD).  */
+#define SIGINFO 29 /* Information request (BSD).  */
+#define SIGPWR SIGINFO /* Power failure imminent (System V).  */
+
+/* Historical signals specified by POSIX. */
+#define SIGBUS 10 /* Bus error.  */
+#define SIGSYS 12 /* Bad system call.  */
+
+/* New(er) POSIX signals (1003.1-2008, 1003.1-2013).  */
+#define SIGURG 16 /* Urgent data is available at a socket.  */
+#define SIGSTOP 17 /* Stop, unblockable.  */
+#define SIGTSTP 18 /* Keyboard stop.  */
+#define SIGCONT 19 /* Continue.  */
+#define SIGCHLD 20 /* Child terminated or stopped.  */
+#define SIGTTIN 21 /* Background read from control terminal.  */
+#define SIGTTOU 22 /* Background write to control terminal.  */
+#define SIGPOLL 23 /* Pollable event occurred (System V).  */
+#define SIGXCPU 24 /* CPU time limit exceeded.  */
+#define SIGVTALRM 26 /* Virtual timer expired.  */
+#define SIGPROF 27 /* Profiling timer expired.  */
+#define SIGXFSZ 25 /* File size limit exceeded.  */
+#define SIGUSR1 30 /* User-defined signal 1.  */
+#define SIGUSR2 31 /* User-defined signal 2.  */
+
+/* Nonstandard signals found in all modern POSIX systems
+   (including both BSD and Linux).  */
+#define SIGWINCH 28
+
+/* Archaic names for compatibility.  */
+#define SIGIO SIGPOLL /* I/O now possible (4.2 BSD).  */
+#define SIGIOT SIGABRT /* IOT instruction, abort() on a PDP-11.  */
+#define SIGCLD SIGCHLD /* Old System V name */
+
+#define __SIGRTMIN 32
+#define __SIGRTMAX 64
+
+#endif /* <signal.h> included.  */
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/signum.h b/sysdeps/unix/sysv/linux/alpha/bits/signum.h
deleted file mode 100644
index 63add0e3db..0000000000
--- a/sysdeps/unix/sysv/linux/alpha/bits/signum.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Signal number definitions.  Linux/Alpha version.
-   Copyright (C) 1996-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/>.  */
-
-#ifndef _BITS_SIGNUM_H
-#define _BITS_SIGNUM_H 1
-
-#ifndef _SIGNAL_H
-#error "Never include <bits/signum.h> directly; use <signal.h> instead."
-#endif
-
-#include <bits/signum-generic.h>
-
-/* Adjustments and additions to the signal number constants for
-   Linux/Alpha.  Signal values on this platform were chosen for OSF/1
-   binary compatibility, and are therefore almost identical to the
-   BSD-derived defaults.  */
-
-#define SIGEMT 7 /* Emulator trap (4.2 BSD).  */
-#define SIGINFO 29 /* Information request (BSD).  */
-#define SIGPWR SIGINFO /* Power failure imminent (System V).  */
-
-#undef __SIGRTMAX
-#define __SIGRTMAX 64
-
-#endif /* <signal.h> included.  */
diff --git a/sysdeps/unix/sysv/linux/bits/signum-arch.h b/sysdeps/unix/sysv/linux/bits/signum-arch.h
new file mode 100644
index 0000000000..de5ee4af14
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/bits/signum-arch.h
@@ -0,0 +1,64 @@
+/* Signal number definitions.  Linux version.
+   Copyright (C) 1995-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/>.  */
+
+#ifndef _BITS_SIGNUM_ARCH_H
+#define _BITS_SIGNUM_ARCH_H 1
+
+#ifndef _SIGNAL_H
+#error "Never include <bits/signum-arch.h> directly; use <signal.h> instead."
+#endif
+
+/* Adjustments and additions to the signal number constants for
+   most Linux systems.  */
+
+#define SIGSTKFLT 16 /* Stack fault (obsolete).  */
+#define SIGPWR 30 /* Power failure imminent.  */
+
+/* Historical signals specified by POSIX. */
+#define SIGBUS 7 /* Bus error.  */
+#define SIGSYS 31 /* Bad system call.  */
+
+/* New(er) POSIX signals (1003.1-2008, 1003.1-2013).  */
+#define SIGURG 23 /* Urgent data is available at a socket.  */
+#define SIGSTOP 19 /* Stop, unblockable.  */
+#define SIGTSTP 20 /* Keyboard stop.  */
+#define SIGCONT 18 /* Continue.  */
+#define SIGCHLD 17 /* Child terminated or stopped.  */
+#define SIGTTIN 21 /* Background read from control terminal.  */
+#define SIGTTOU 22 /* Background write to control terminal.  */
+#define SIGPOLL 29 /* Pollable event occurred (System V).  */
+#define SIGXFSZ 25 /* File size limit exceeded.  */
+#define SIGXCPU 24 /* CPU time limit exceeded.  */
+#define SIGVTALRM 26 /* Virtual timer expired.  */
+#define SIGPROF 27 /* Profiling timer expired.  */
+#define SIGUSR1 10 /* User-defined signal 1.  */
+#define SIGUSR2 12 /* User-defined signal 2.  */
+
+/* Nonstandard signals found in all modern POSIX systems
+   (including both BSD and Linux).  */
+#define SIGWINCH 28 /* Window size change (4.3 BSD, Sun).  */
+
+/* Archaic names for compatibility.  */
+#define SIGIO SIGPOLL /* I/O now possible (4.2 BSD).  */
+#define SIGIOT SIGABRT /* IOT instruction, abort() on a PDP-11.  */
+#define SIGCLD SIGCHLD /* Old System V name */
+
+#define __SIGRTMIN 32
+#define __SIGRTMAX 64
+
+#endif /* <signal.h> included.  */
diff --git a/sysdeps/unix/sysv/linux/bits/signum.h b/sysdeps/unix/sysv/linux/bits/signum.h
deleted file mode 100644
index 423fd8be70..0000000000
--- a/sysdeps/unix/sysv/linux/bits/signum.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* Signal number definitions.  Linux version.
-   Copyright (C) 1995-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/>.  */
-
-#ifndef _BITS_SIGNUM_H
-#define _BITS_SIGNUM_H 1
-
-#ifndef _SIGNAL_H
-#error "Never include <bits/signum.h> directly; use <signal.h> instead."
-#endif
-
-#include <bits/signum-generic.h>
-
-/* Adjustments and additions to the signal number constants for
-   most Linux systems.  */
-
-#define SIGSTKFLT 16 /* Stack fault (obsolete).  */
-#define SIGPWR 30 /* Power failure imminent.  */
-
-#undef SIGBUS
-#define SIGBUS 7
-#undef SIGUSR1
-#define SIGUSR1 10
-#undef SIGUSR2
-#define SIGUSR2 12
-#undef SIGCHLD
-#define SIGCHLD 17
-#undef SIGCONT
-#define SIGCONT 18
-#undef SIGSTOP
-#define SIGSTOP 19
-#undef SIGTSTP
-#define SIGTSTP 20
-#undef SIGURG
-#define SIGURG 23
-#undef SIGPOLL
-#define SIGPOLL 29
-#undef SIGSYS
-#define SIGSYS 31
-
-#undef __SIGRTMAX
-#define __SIGRTMAX 64
-
-#endif /* <signal.h> included.  */
diff --git a/sysdeps/unix/sysv/linux/hppa/bits/signum-arch.h b/sysdeps/unix/sysv/linux/hppa/bits/signum-arch.h
new file mode 100644
index 0000000000..364e57ec4a
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/hppa/bits/signum-arch.h
@@ -0,0 +1,69 @@
+/* Signal number definitions.  Linux/HPPA version.
+   Copyright (C) 1995-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/>.  */
+
+#ifndef _BITS_SIGNUM_ARCH_H
+#define _BITS_SIGNUM_ARCH_H 1
+
+#ifndef _SIGNAL_H
+#error "Never include <bits/signum-arch.h> directly; use <signal.h> instead."
+#endif
+
+/* Adjustments and additions to the signal number constants for
+   Linux/HPPA.  These values were originally chosen for HP/UX
+   compatibility, but were renumbered as of kernel 3.17 and glibc 2.21
+   to accommodate software (notably systemd) that assumed at least 29
+   real-time signal numbers would be available.  SIGEMT and SIGLOST
+   were removed, and the values of SIGSTKFLT, SIGXCPU, XIGXFSZ, and
+   SIGSYS were changed, enabling __SIGRTMIN to be 32.  */
+
+#define SIGSTKFLT 7 /* Stack fault (obsolete).  */
+#define SIGPWR 19 /* Power failure imminent.  */
+
+/* Historical signals specified by POSIX. */
+#define SIGBUS 10 /* Bus error.  */
+#define SIGSYS 31 /* Bad system call.  */
+
+/* New(er) POSIX signals (1003.1-2008, 1003.1-2013).  */
+#define SIGURG 29 /* Urgent data is available at a socket.  */
+#define SIGSTOP 24 /* Stop, unblockable.  */
+#define SIGTSTP 25 /* Keyboard stop.  */
+#define SIGCONT 26 /* Continue.  */
+#define SIGCHLD 18 /* Child terminated or stopped.  */
+#define SIGTTIN 27 /* Background read from control terminal.  */
+#define SIGTTOU 28 /* Background write to control terminal.  */
+#define SIGPOLL 22 /* Pollable event occurred (System V).  */
+#define SIGXCPU 12 /* CPU time limit exceeded.  */
+#define SIGVTALRM 20 /* Virtual timer expired.  */
+#define SIGPROF 21 /* Profiling timer expired.  */
+#define SIGXFSZ 30 /* File size limit exceeded.  */
+#define SIGUSR1 16 /* User-defined signal 1.  */
+#define SIGUSR2 17 /* User-defined signal 2.  */
+
+/* Nonstandard signals found in all modern POSIX systems
+   (including both BSD and Linux).  */
+#define SIGWINCH 23 /* Window size change (4.3 BSD, Sun).  */
+
+/* Archaic names for compatibility.  */
+#define SIGIO SIGPOLL /* I/O now possible (4.2 BSD).  */
+#define SIGIOT SIGABRT /* IOT instruction, abort() on a PDP-11.  */
+#define SIGCLD SIGCHLD /* Old System V name */
+
+#define __SIGRTMIN 32
+#define __SIGRTMAX 64
+
+#endif /* <signal.h> included.  */
diff --git a/sysdeps/unix/sysv/linux/hppa/bits/signum.h b/sysdeps/unix/sysv/linux/hppa/bits/signum.h
deleted file mode 100644
index 2210304e37..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/bits/signum.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/* Signal number definitions.  Linux/HPPA version.
-   Copyright (C) 1995-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/>.  */
-
-#ifndef _BITS_SIGNUM_H
-#define _BITS_SIGNUM_H 1
-
-#ifndef _SIGNAL_H
-#error "Never include <bits/signum.h> directly; use <signal.h> instead."
-#endif
-
-#include <bits/signum-generic.h>
-
-/* Adjustments and additions to the signal number constants for
-   Linux/HPPA.  These values were originally chosen for HP/UX
-   compatibility, but were renumbered as of kernel 3.17 and glibc 2.21
-   to accommodate software (notably systemd) that assumed at least 29
-   real-time signal numbers would be available.  SIGEMT and SIGLOST
-   were removed, and the values of SIGSTKFLT, SIGXCPU, XIGXFSZ, and
-   SIGSYS were changed, enabling __SIGRTMIN to be 32.  */
-
-#define SIGSTKFLT 7 /* Stack fault (obsolete).  */
-#define SIGPWR 19 /* Power failure imminent.  */
-
-#undef SIGXCPU
-#define SIGXCPU 12
-#undef SIGUSR1
-#define SIGUSR1 16
-#undef SIGUSR2
-#define SIGUSR2 17
-#undef SIGCHLD
-#define SIGCHLD 18
-#undef SIGVTALRM
-#define SIGVTALRM 20
-#undef SIGPROF
-#define SIGPROF 21
-#undef SIGPOLL
-#define SIGPOLL 22
-#undef SIGWINCH
-#define SIGWINCH 23
-#undef SIGSTOP
-#define SIGSTOP 24
-#undef SIGTSTP
-#define SIGTSTP 25
-#undef SIGCONT
-#define SIGCONT 26
-#undef SIGTTIN
-#define SIGTTIN 27
-#undef SIGTTOU
-#define SIGTTOU 28
-#undef SIGURG
-#define SIGURG 29
-#undef SIGXFSZ
-#define SIGXFSZ 30
-#undef SIGSYS
-#define SIGSYS 31
-
-#undef __SIGRTMAX
-#define __SIGRTMAX 64
-
-#endif /* <signal.h> included.  */
diff --git a/sysdeps/unix/sysv/linux/ia64/vfork.S b/sysdeps/unix/sysv/linux/ia64/vfork.S
index a8ceea8ea7..843bf7683c 100644
--- a/sysdeps/unix/sysv/linux/ia64/vfork.S
+++ b/sysdeps/unix/sysv/linux/ia64/vfork.S
@@ -18,7 +18,7 @@
 
 #include <sysdep.h>
 #define _SIGNAL_H
-#include <bits/signum.h>
+#include <bits/signum-arch.h>
 #include <tcb-offsets.h>
 
 /* The following are defined in linux/sched.h, which unfortunately */
diff --git a/sysdeps/unix/sysv/linux/mips/bits/signum-arch.h b/sysdeps/unix/sysv/linux/mips/bits/signum-arch.h
new file mode 100644
index 0000000000..c500d38322
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/mips/bits/signum-arch.h
@@ -0,0 +1,65 @@
+/* Signal number definitions.  Linux/MIPS version.
+   Copyright (C) 1995-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/>.  */
+
+#ifndef _BITS_SIGNUM_H
+#define _BITS_SIGNUM_H 1
+
+#ifndef _SIGNAL_H
+#error "Never include <bits/signum.h> directly; use <signal.h> instead."
+#endif
+
+/* Adjustments and additions to the signal number constants for
+   Linux/MIPS.  */
+
+#define SIGEMT 7 /* Emulator trap.  */
+#define SIGPWR 19 /* Power failure imminent.  */
+
+/* Historical signals specified by POSIX. */
+#define SIGBUS 10 /* Bus error.  */
+#define SIGSYS 12 /* Bad system call.  */
+
+/* New(er) POSIX signals (1003.1-2008, 1003.1-2013).  */
+#define SIGURG 21 /* Urgent data is available at a socket.  */
+#define SIGSTOP 23 /* Stop, unblockable.  */
+#define SIGTSTP 24 /* Keyboard stop.  */
+#define SIGCONT 25 /* Continue.  */
+#define SIGCHLD 18 /* Child terminated or stopped.  */
+#define SIGTTIN 26 /* Background read from control terminal.  */
+#define SIGTTOU 27 /* Background write to control terminal.  */
+#define SIGPOLL 22 /* Pollable event occurred (System V).  */
+#define SIGXCPU 30 /* CPU time limit exceeded.  */
+#define SIGVTALRM 28 /* Virtual timer expired.  */
+#define SIGPROF 29 /* Profiling timer expired.  */
+#define SIGXFSZ 31 /* File size limit exceeded.  */
+#define SIGUSR1 16 /* User-defined signal 1.  */
+#define SIGUSR2 17 /* User-defined signal 2.  */
+
+/* Nonstandard signals found in all modern POSIX systems
+   (including both BSD and Linux).  */
+#define SIGWINCH 20 /* Window size change (4.3 BSD, Sun).  */
+
+/* Archaic names for compatibility.  */
+#define SIGIO SIGPOLL /* I/O now possible (4.2 BSD).  */
+#define SIGIOT SIGABRT /* IOT instruction, abort() on a PDP-11.  */
+#define SIGCLD SIGCHLD /* Old System V name */
+
+/* By default no real-time signals are supported.  */
+#define __SIGRTMIN 32
+#define __SIGRTMAX 127
+
+#endif /* <signal.h> included.  */
diff --git a/sysdeps/unix/sysv/linux/mips/bits/signum.h b/sysdeps/unix/sysv/linux/mips/bits/signum.h
deleted file mode 100644
index f5a5e7b4cd..0000000000
--- a/sysdeps/unix/sysv/linux/mips/bits/signum.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/* Signal number definitions.  Linux/MIPS version.
-   Copyright (C) 1995-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/>.  */
-
-#ifndef _BITS_SIGNUM_H
-#define _BITS_SIGNUM_H 1
-
-#ifndef _SIGNAL_H
-#error "Never include <bits/signum.h> directly; use <signal.h> instead."
-#endif
-
-#include <bits/signum-generic.h>
-
-/* Adjustments and additions to the signal number constants for
-   Linux/MIPS.  */
-
-#define SIGEMT 7 /* Emulator trap.  */
-#define SIGPWR 19 /* Power failure imminent.  */
-
-#undef SIGUSR1
-#define SIGUSR1 16
-#undef SIGUSR2
-#define SIGUSR2 17
-#undef SIGCHLD
-#define SIGCHLD 18
-#undef SIGWINCH
-#define SIGWINCH 20
-#undef SIGURG
-#define SIGURG 21
-#undef SIGPOLL
-#define SIGPOLL 22
-#undef SIGSTOP
-#define SIGSTOP 23
-#undef SIGTSTP
-#define SIGTSTP 24
-#undef SIGCONT
-#define SIGCONT 25
-#undef SIGTTIN
-#define SIGTTIN 26
-#undef SIGTTOU
-#define SIGTTOU 27
-#undef SIGVTALRM
-#define SIGVTALRM 28
-#undef SIGPROF
-#define SIGPROF 29
-#undef SIGXCPU
-#define SIGXCPU 30
-#undef SIGXFSZ
-#define SIGXFSZ 31
-
-#undef __SIGRTMAX
-#define __SIGRTMAX 127
-
-#endif /* <signal.h> included.  */
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/signum-arch.h b/sysdeps/unix/sysv/linux/sparc/bits/signum-arch.h
new file mode 100644
index 0000000000..0cece9a6c4
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/bits/signum-arch.h
@@ -0,0 +1,66 @@
+/* Signal number definitions.  Linux/SPARC version.
+   Copyright (C) 1996-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/>.  */
+
+#ifndef _BITS_SIGNUM_ARCH_H
+#define _BITS_SIGNUM_ARCH_H 1
+
+#ifndef _SIGNAL_H
+#error "Never include <bits/signum-arch.h> directly; use <signal.h> instead."
+#endif
+
+/* Adjustments and additions to the signal number constants for
+   Linux/SPARC systems.  Signal values on this platform were chosen
+   for SunOS binary compatibility.  */
+
+#define SIGEMT 7 /* Emulator trap.  */
+#define SIGLOST 29 /* Resource lost (Sun); server died (GNU).  */
+#define SIGPWR SIGLOST /* Power failure imminent (SysV).  */
+
+/* Historical signals specified by POSIX. */
+#define SIGBUS 10 /* Bus error.  */
+#define SIGSYS 12 /* Bad system call.  */
+
+/* New(er) POSIX signals (1003.1-2008, 1003.1-2013).  */
+#define SIGURG 16 /* Urgent data is available at a socket.  */
+#define SIGSTOP 17 /* Stop, unblockable.  */
+#define SIGTSTP 18 /* Keyboard stop.  */
+#define SIGCONT 19 /* Continue.  */
+#define SIGCHLD 20 /* Child terminated or stopped.  */
+#define SIGTTIN 21 /* Background read from control terminal.  */
+#define SIGTTOU 22 /* Background write to control terminal.  */
+#define SIGPOLL 23 /* Pollable event occurred (System V).  */
+#define SIGXCPU 24 /* CPU time limit exceeded.  */
+#define SIGVTALRM 26 /* Virtual timer expired.  */
+#define SIGPROF 27 /* Profiling timer expired.  */
+#define SIGXFSZ 25 /* File size limit exceeded.  */
+#define SIGUSR1 30 /* User-defined signal 1.  */
+#define SIGUSR2 31 /* User-defined signal 2.  */
+
+/* Nonstandard signals found in all modern POSIX systems
+   (including both BSD and Linux).  */
+#define SIGWINCH 28 /* Window size change (4.3 BSD, Sun).  */
+
+/* Archaic names for compatibility.  */
+#define SIGIO SIGPOLL /* I/O now possible (4.2 BSD).  */
+#define SIGIOT SIGABRT /* IOT instruction, abort() on a PDP-11.  */
+#define SIGCLD SIGCHLD /* Old System V name */
+
+#define __SIGRTMIN 32
+#define __SIGRTMAX 64
+
+#endif /* <signal.h> included.  */
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/signum.h b/sysdeps/unix/sysv/linux/sparc/bits/signum.h
deleted file mode 100644
index 40fb39a435..0000000000
--- a/sysdeps/unix/sysv/linux/sparc/bits/signum.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/* Signal number definitions.  Linux/SPARC version.
-   Copyright (C) 1996-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/>.  */
-
-#ifndef _BITS_SIGNUM_H
-#define _BITS_SIGNUM_H 1
-
-#ifndef _SIGNAL_H
-#error "Never include <bits/signum.h> directly; use <signal.h> instead."
-#endif
-
-#include <bits/signum-generic.h>
-
-/* Adjustments and additions to the signal number constants for
-   Linux/SPARC systems.  Signal values on this platform were chosen
-   for SunOS binary compatibility.  */
-
-#define SIGEMT 7 /* Emulator trap.  */
-#define SIGLOST 29 /* Resource lost (Sun); server died (GNU).  */
-#define SIGPWR SIGLOST /* Power failure imminent (SysV).  */
-
-#undef __SIGRTMAX
-#define __SIGRTMAX 64
-
-#endif /* <signal.h> included.  */
--
2.25.1

Reply | Threaded
Open this post in threaded view
|

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

Sourceware - libc-alpha mailing list
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.
---
 NEWS                                          |  6 ++
 debug/segfault.c                              | 18 ++---
 include/signal.h                              |  4 +-
 manual/signal.texi                            |  5 --
 signal/signal.h                               |  6 --
 stdio-common/psiginfo.c                       |  2 +-
 stdio-common/psignal.c                        |  2 +-
 stdio-common/siglist.c                        |  8 +-
 string/strsignal.c                            |  2 +-
 sysdeps/generic/siglist-compat.c              |  1 +
 sysdeps/generic/siglist-compat.h              | 47 +++++++++++
 sysdeps/gnu/siglist.c                         | 78 -------------------
 .../mach/hurd/{siglist.h => siglist-compat.c} | 13 +++-
 .../linux/{siglist.h => siglist-compat.c}     | 17 ++--
 14 files changed, 93 insertions(+), 116 deletions(-)
 create mode 100644 sysdeps/generic/siglist-compat.c
 create mode 100644 sysdeps/generic/siglist-compat.h
 delete mode 100644 sysdeps/gnu/siglist.c
 rename sysdeps/mach/hurd/{siglist.h => siglist-compat.c} (68%)
 rename sysdeps/unix/sysv/linux/{siglist.h => siglist-compat.c} (62%)

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.
+
 Changes to build and runtime requirements:
 
 * powerpc64le requires GCC 7.4 or newer.  This is required for supporting
diff --git a/debug/segfault.c b/debug/segfault.c
index 14c64cd0bd..8b59783c9e 100644
--- a/debug/segfault.c
+++ b/debug/segfault.c
@@ -49,20 +49,16 @@
 static const char *fname;
 
 
-/* We better should not use `strerror' since it can call far too many
-   other functions which might fail.  Do it here ourselves.  */
+/* Print the signal number SIGNAL.  Either strerror or strsignal might
+   call local internal functions and these in turn call far too many
+   other functions and might even allocate memory which might fail.  */
 static void
 write_strsignal (int fd, int signal)
 {
-  if (signal < 0 || signal >= _NSIG || _sys_siglist[signal] == NULL)
-    {
-      char buf[30];
-      char *ptr = _itoa_word (signal, &buf[sizeof (buf)], 10, 0);
-      WRITE_STRING ("signal ");
-      write (fd, buf, &buf[sizeof (buf)] - ptr);
-    }
-  else
-    WRITE_STRING (_sys_siglist[signal]);
+  char buf[30];
+  char *ptr = _itoa_word (signal, &buf[sizeof (buf)], 10, 0);
+  WRITE_STRING ("signal ");
+  write (fd, buf, &buf[sizeof (buf)] - ptr);
 }
 
 
diff --git a/include/signal.h b/include/signal.h
index 293258ad65..aa68f45886 100644
--- a/include/signal.h
+++ b/include/signal.h
@@ -12,7 +12,9 @@ libc_hidden_proto (__sigpause)
 libc_hidden_proto (raise)
 libc_hidden_proto (__libc_current_sigrtmin)
 libc_hidden_proto (__libc_current_sigrtmax)
-libc_hidden_proto (_sys_siglist)
+extern const char * const __sys_siglist[_NSIG];
+libc_hidden_proto (__sys_siglist)
+
 
 /* Now define the internal interfaces.  */
 extern __sighandler_t __bsd_signal (int __sig, __sighandler_t __handler);
diff --git a/manual/signal.texi b/manual/signal.texi
index 911b422a18..34def1c06c 100644
--- a/manual/signal.texi
+++ b/manual/signal.texi
@@ -880,11 +880,6 @@ to @var{signum}.
 This function is a BSD feature, declared in the header file @file{signal.h}.
 @end deftypefun
 
-@vindex sys_siglist
-There is also an array @code{sys_siglist} which contains the messages
-for the various signal codes.  This array exists on BSD systems, unlike
-@code{strsignal}.
-
 @node Signal Actions
 @section Specifying Signal Actions
 @cindex signal actions
diff --git a/signal/signal.h b/signal/signal.h
index db325bde16..effe3d698f 100644
--- a/signal/signal.h
+++ b/signal/signal.h
@@ -284,12 +284,6 @@ extern int sigqueue (__pid_t __pid, int __sig, const union sigval __val)
 
 #ifdef __USE_MISC
 
-/* Names of the signals.  This variable exists only for compatibility.
-   Use `strsignal' instead (see <string.h>).  */
-extern const char *const _sys_siglist[_NSIG];
-extern const char *const sys_siglist[_NSIG];
-
-
 /* Get machine-dependent `struct sigcontext' and signal subcodes.  */
 # include <bits/sigcontext.h>
 
diff --git a/stdio-common/psiginfo.c b/stdio-common/psiginfo.c
index 4d498d00aa..362de9e565 100644
--- a/stdio-common/psiginfo.c
+++ b/stdio-common/psiginfo.c
@@ -80,7 +80,7 @@ psiginfo (const siginfo_t *pinfo, const char *s)
 
   const char *desc;
   if (pinfo->si_signo >= 0 && pinfo->si_signo < NSIG
-      && ((desc = _sys_siglist[pinfo->si_signo]) != NULL
+      && ((desc = __sys_siglist[pinfo->si_signo]) != NULL
 #ifdef SIGRTMIN
   || (pinfo->si_signo >= SIGRTMIN && pinfo->si_signo < SIGRTMAX)
 #endif
diff --git a/stdio-common/psignal.c b/stdio-common/psignal.c
index de45e52734..1f217a3332 100644
--- a/stdio-common/psignal.c
+++ b/stdio-common/psignal.c
@@ -34,7 +34,7 @@ psignal (int sig, const char *s)
   else
     colon = ": ";
 
-  if (sig >= 0 && sig < NSIG && (desc = _sys_siglist[sig]) != NULL)
+  if (sig >= 0 && sig < NSIG && (desc = __sys_siglist[sig]) != NULL)
     (void) __fxprintf (NULL, "%s%s%s\n", s, colon, _(desc));
   else
     {
diff --git a/stdio-common/siglist.c b/stdio-common/siglist.c
index 04082594a0..3e29aa8227 100644
--- a/stdio-common/siglist.c
+++ b/stdio-common/siglist.c
@@ -20,17 +20,19 @@
 #include <signal.h>
 #include <libintl.h>
 
-const char *const _sys_siglist[NSIG] =
+const char *const __sys_siglist[NSIG] =
 {
 #define init_sig(sig, abbrev, desc)   [sig] = desc,
 #include <siglist.h>
 #undef init_sig
 };
+libc_hidden_def (__sys_siglist)
 
-
-const char *const _sys_sigabbrev[NSIG] =
+const char *const __sys_sigabbrev[NSIG] =
 {
 #define init_sig(sig, abbrev, desc)   [sig] = abbrev,
 #include <siglist.h>
 #undef init_sig
 };
+
+#include <siglist-compat.c>
diff --git a/string/strsignal.c b/string/strsignal.c
index 2843ffe39b..7e3b262c55 100644
--- a/string/strsignal.c
+++ b/string/strsignal.c
@@ -51,7 +51,7 @@ strsignal (int signum)
       (signum >= SIGRTMIN && signum <= SIGRTMAX) ||
 #endif
       signum < 0 || signum >= NSIG
-      || (desc = _sys_siglist[signum]) == NULL)
+      || (desc = __sys_siglist[signum]) == NULL)
     {
       char *buffer = getbuffer ();
       int len;
diff --git a/sysdeps/generic/siglist-compat.c b/sysdeps/generic/siglist-compat.c
new file mode 100644
index 0000000000..6e25b021ab
--- /dev/null
+++ b/sysdeps/generic/siglist-compat.c
@@ -0,0 +1 @@
+/* Empty.  */
diff --git a/sysdeps/generic/siglist-compat.h b/sysdeps/generic/siglist-compat.h
new file mode 100644
index 0000000000..13e5f253dc
--- /dev/null
+++ b/sysdeps/generic/siglist-compat.h
@@ -0,0 +1,47 @@
+/* Generic siglist compatibility macro definitions.
+   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/>.  */
+
+#ifndef _SIGLIST_COMPAT_H
+#define _SIGLIST_COMPAT_H
+
+#include <shlib-compat.h>
+#include <limits.h>
+
+/* Define new compat symbols for sys_siglist, _sys_siglist, and sys_sigabbrev
+   for version VERSION with NUMBERSIG times the number of bytes per long int.
+   Both _sys_siglist and sys_siglist alias to __sys_siglist while
+   sys_sigabbrev alias to __sys_sigabbrev.  Both target alias are
+   define in siglist.c.  */
+#define DEFINE_COMPAT_SIGLIST(NUMBERSIG, VERSION)     \
+  declare_symbol_alias (__ ## VERSION ## _sys_siglist,     \
+ __sys_siglist,     \
+ object, NUMBERSIG * (ULONG_WIDTH / UCHAR_WIDTH));    \
+  declare_symbol_alias (__ ## VERSION ## sys_siglist,     \
+ __sys_siglist,     \
+ object, NUMBERSIG * (ULONG_WIDTH / UCHAR_WIDTH));    \
+  declare_symbol_alias (__ ## VERSION ## _sys_sigabbrev,     \
+ __sys_sigabbrev,     \
+ object, NUMBERSIG * (ULONG_WIDTH / UCHAR_WIDTH));    \
+  compat_symbol (libc, __## VERSION ## _sys_siglist,   _sys_siglist,     \
+ VERSION);     \
+  compat_symbol (libc, __## VERSION ## sys_siglist,    sys_siglist,     \
+ VERSION);     \
+  compat_symbol (libc, __## VERSION ## _sys_sigabbrev, sys_sigabbrev,     \
+ VERSION);     \
+
+#endif
diff --git a/sysdeps/gnu/siglist.c b/sysdeps/gnu/siglist.c
deleted file mode 100644
index c24f356f21..0000000000
--- a/sysdeps/gnu/siglist.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/* Define list of all signal numbers and their names.
-   Copyright (C) 1997-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 <stddef.h>
-#include <signal.h>
-#include <libintl.h>
-#include <shlib-compat.h>
-#include <bits/wordsize.h>
-
-const char *const __new_sys_siglist[NSIG] =
-{
-#define init_sig(sig, abbrev, desc)   [sig] = desc,
-#include <siglist.h>
-#undef init_sig
-};
-libc_hidden_ver (__new_sys_siglist, _sys_siglist)
-
-const char *const __new_sys_sigabbrev[NSIG] =
-{
-#define init_sig(sig, abbrev, desc)   [sig] = abbrev,
-#include <siglist.h>
-#undef init_sig
-};
-
-#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
-declare_symbol_alias (__old_sys_siglist, __new_sys_siglist, object,
-      OLD_SIGLIST_SIZE * __WORDSIZE / 8)
-
-declare_symbol_alias (__old_sys_sigabbrev, __new_sys_sigabbrev, object,
-      OLD_SIGLIST_SIZE * __WORDSIZE / 8)
-
-declare_symbol_alias (_old_sys_siglist, __new_sys_siglist, object,
-      OLD_SIGLIST_SIZE * __WORDSIZE / 8)
-
-compat_symbol (libc, __old_sys_siglist, _sys_siglist, GLIBC_2_0);
-compat_symbol (libc, _old_sys_siglist, sys_siglist, GLIBC_2_0);
-compat_symbol (libc, __old_sys_sigabbrev, sys_sigabbrev, GLIBC_2_0);
-#endif
-
-#if SHLIB_COMPAT (libc, GLIBC_2_1, GLIBC_2_3_3) && defined OLD2_SIGLIST_SIZE
-declare_symbol_alias (__old2_sys_siglist, __new_sys_siglist, object,
-      OLD2_SIGLIST_SIZE * __WORDSIZE / 8)
-
-declare_symbol_alias (__old2_sys_sigabbrev, __new_sys_sigabbrev, object,
-      OLD2_SIGLIST_SIZE * __WORDSIZE / 8)
-
-declare_symbol_alias (_old2_sys_siglist, __new_sys_siglist, object,
-      OLD2_SIGLIST_SIZE * __WORDSIZE / 8)
-
-compat_symbol (libc, __old2_sys_siglist, _sys_siglist, GLIBC_2_1);
-compat_symbol (libc, _old2_sys_siglist, sys_siglist, GLIBC_2_1);
-compat_symbol (libc, __old2_sys_sigabbrev, sys_sigabbrev, GLIBC_2_1);
-
-strong_alias (__new_sys_siglist, _new_sys_siglist)
-versioned_symbol (libc, __new_sys_siglist, _sys_siglist, GLIBC_2_3_3);
-versioned_symbol (libc, _new_sys_siglist, sys_siglist, GLIBC_2_3_3);
-versioned_symbol (libc, __new_sys_sigabbrev, sys_sigabbrev, GLIBC_2_3_3);
-#else
-strong_alias (__new_sys_siglist, _new_sys_siglist)
-versioned_symbol (libc, __new_sys_siglist, _sys_siglist, GLIBC_2_1);
-versioned_symbol (libc, _new_sys_siglist, sys_siglist, GLIBC_2_1);
-versioned_symbol (libc, __new_sys_sigabbrev, sys_sigabbrev, GLIBC_2_1);
-#endif
diff --git a/sysdeps/mach/hurd/siglist.h b/sysdeps/mach/hurd/siglist-compat.c
similarity index 68%
rename from sysdeps/mach/hurd/siglist.h
rename to sysdeps/mach/hurd/siglist-compat.c
index 2eee091610..c93f12366b 100644
--- a/sysdeps/mach/hurd/siglist.h
+++ b/sysdeps/mach/hurd/siglist-compat.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1999-2020 Free Software Foundation, Inc.
+/* Compatibility signal numbers and their names symbols.  Hurd version.
+   Copyright (C) 1997-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
@@ -15,8 +16,12 @@
    License along with the GNU C Library; if not, see
    <https://www.gnu.org/licenses/>.  */
 
-/* This file is included multiple times.  */
+#include <siglist-compat.h>
 
-#include_next <siglist.h> /* Get the canonical list.  */
+#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
+DEFINE_COMPAT_SIGLIST (33, GLIBC_2_0)
+#endif
 
-#define OLD_SIGLIST_SIZE 33 /* For GLIBC_2.0 binary compatibility.  */
+#if SHLIB_COMPAT (libc, GLIBC_2_1, GLIBC_2_32)
+DEFINE_COMPAT_SIGLIST (NSIG, GLIBC_2_1)
+#endif
diff --git a/sysdeps/unix/sysv/linux/siglist.h b/sysdeps/unix/sysv/linux/siglist-compat.c
similarity index 62%
rename from sysdeps/unix/sysv/linux/siglist.h
rename to sysdeps/unix/sysv/linux/siglist-compat.c
index 6ff2c613ad..c322326a99 100644
--- a/sysdeps/unix/sysv/linux/siglist.h
+++ b/sysdeps/unix/sysv/linux/siglist-compat.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1996-2020 Free Software Foundation, Inc.
+/* Compatibility signal numbers and their names symbols.  Linux version.
+   Copyright (C) 1997-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
@@ -15,10 +16,16 @@
    License along with the GNU C Library; if not, see
    <https://www.gnu.org/licenses/>.  */
 
-/* This file is included multiple times.  */
+#include <siglist-compat.h>
 
-#include_next <siglist.h> /* Get the canonical list.  */
+#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
+DEFINE_COMPAT_SIGLIST (32, GLIBC_2_0)
+#endif
 
-#define OLD_SIGLIST_SIZE 32 /* For GLIBC_2.0 binary compatibility.  */
+#if SHLIB_COMPAT (libc, GLIBC_2_1, GLIBC_2_3_3)
+DEFINE_COMPAT_SIGLIST (64, GLIBC_2_1)
+#endif
 
-#define OLD2_SIGLIST_SIZE 64 /* For GLIBC_2.1 binary compatibility.  */
+#if SHLIB_COMPAT (libc, GLIBC_2_3_3, GLIBC_2_32)
+DEFINE_COMPAT_SIGLIST (NSIG, GLIBC_2_3_3)
+#endif
--
2.25.1

Reply | Threaded
Open this post in threaded view
|

[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
The symbol is deprecated by strerror since its usage imposes some issues
such as copy relocations.

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.
---
 NEWS                                          |    6 +
 include/stdio.h                               |    2 +-
 libio/Makefile                                |    2 +-
 libio/stdio.h                                 |    6 -
 scripts/build-many-glibcs.py                  |    3 +-
 stdio-common/Makefile                         |   11 +
 stdio-common/errlist-compat.c                 |    1 +
 stdio-common/errlist.c                        |   30 +-
 stdio-common/tst-errno-manual.py              |   73 +
 string/_strerror.c                            |    6 +-
 string/strerror_l.c                           |    8 +-
 string/xpg-strerror.c                         |    9 +-
 sysdeps/gnu/Makefile                          |   43 -
 sysdeps/gnu/errlist-compat.awk                |  133 --
 sysdeps/gnu/errlist.awk                       |  110 --
 sysdeps/gnu/errlist.c                         | 1495 -----------------
 sysdeps/gnu/errlist.h                         |  448 +++++
 sysdeps/mach/hurd/err_hurd.sub                |    5 +-
 sysdeps/mach/hurd/errlist.c                   |   11 +-
 sysdeps/unix/sysv/linux/Versions              |   10 -
 sysdeps/unix/sysv/linux/alpha/Versions        |   12 -
 .../unix/sysv/linux/alpha/errlist-compat.c    |   43 +
 .../{bits/sys_errlist.h => errlist-compat.c}  |   29 +-
 sysdeps/unix/sysv/linux/errlist-compat.h      |   43 +
 sysdeps/unix/sysv/linux/hppa/Versions         |   10 -
 sysdeps/unix/sysv/linux/hppa/errlist-compat.c |   39 +
 sysdeps/unix/sysv/linux/mips/Versions         |    7 -
 .../unix/sysv/linux/mips/errlist-compat.c     |   14 +-
 sysdeps/unix/sysv/linux/sparc/Versions        |   10 -
 .../unix/sysv/linux/sparc/errlist-compat.c    |   43 +
 30 files changed, 764 insertions(+), 1898 deletions(-)
 create mode 100644 stdio-common/errlist-compat.c
 create mode 100755 stdio-common/tst-errno-manual.py
 delete mode 100644 sysdeps/gnu/errlist-compat.awk
 delete mode 100644 sysdeps/gnu/errlist.awk
 delete mode 100644 sysdeps/gnu/errlist.c
 create mode 100644 sysdeps/gnu/errlist.h
 create mode 100644 sysdeps/unix/sysv/linux/alpha/errlist-compat.c
 rename sysdeps/unix/sysv/linux/{bits/sys_errlist.h => errlist-compat.c} (56%)
 create mode 100644 sysdeps/unix/sysv/linux/errlist-compat.h
 create mode 100644 sysdeps/unix/sysv/linux/hppa/errlist-compat.c
 rename bits/sys_errlist.h => sysdeps/unix/sysv/linux/mips/errlist-compat.c (69%)
 create mode 100644 sysdeps/unix/sysv/linux/sparc/errlist-compat.c

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.
+
 Changes to build and runtime requirements:
 
 * powerpc64le requires GCC 7.4 or newer.  This is required for supporting
diff --git a/include/stdio.h b/include/stdio.h
index 9df98b2833..9e3bf6fe42 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -186,7 +186,7 @@ ssize_t __libc_readline_unlocked (FILE *fp, char *buffer, size_t length);
 libc_hidden_proto (__libc_readline_unlocked);
 
 extern const char *const _sys_errlist_internal[] attribute_hidden;
-extern int _sys_nerr_internal attribute_hidden;
+extern const char *__get_errlist (int) attribute_hidden;
 
 libc_hidden_ldbl_proto (__asprintf)
 
diff --git a/libio/Makefile b/libio/Makefile
index 59e1f68e9c..926df1870b 100644
--- a/libio/Makefile
+++ b/libio/Makefile
@@ -23,7 +23,7 @@ subdir := libio
 include ../Makeconfig
 
 headers := stdio.h \
-   bits/stdio.h bits/stdio2.h bits/sys_errlist.h bits/stdio-ldbl.h \
+   bits/stdio.h bits/stdio2.h bits/stdio-ldbl.h \
    bits/types/FILE.h bits/types/__FILE.h bits/types/struct_FILE.h \
    bits/types/__fpos_t.h bits/types/__fpos64_t.h \
    bits/types/cookie_io_functions_t.h
diff --git a/libio/stdio.h b/libio/stdio.h
index 07f2d9afb5..998470943e 100644
--- a/libio/stdio.h
+++ b/libio/stdio.h
@@ -779,12 +779,6 @@ extern int ferror_unlocked (FILE *__stream) __THROW __wur;
    marked with __THROW.  */
 extern void perror (const char *__s);
 
-/* Provide the declarations for `sys_errlist' and `sys_nerr' if they
-   are available on this system.  Even if available, these variables
-   should not be used directly.  The `strerror' function provides
-   all the necessary functionality.  */
-#include <bits/sys_errlist.h>
-
 
 #ifdef __USE_POSIX
 /* Return the system file descriptor for STREAM.  */
diff --git a/scripts/build-many-glibcs.py b/scripts/build-many-glibcs.py
index 8c72b9e571..07e9b457da 100755
--- a/scripts/build-many-glibcs.py
+++ b/scripts/build-many-glibcs.py
@@ -892,8 +892,7 @@ class Context(object):
         # Some other files have such dependencies but do not need to
         # be touched because nothing in a build depends on the files
         # in question.
-        for f in ('sysdeps/gnu/errlist.c',
-                  'sysdeps/mach/hurd/bits/errno.h'):
+        for f in ('sysdeps/mach/hurd/bits/errno.h',):
             to_touch = os.path.join(srcdir, f)
             subprocess.run(['touch', '-c', to_touch], check=True)
         for dirpath, dirnames, filenames in os.walk(srcdir):
diff --git a/stdio-common/Makefile b/stdio-common/Makefile
index 0a8d66b846..8f15eb7e56 100644
--- a/stdio-common/Makefile
+++ b/stdio-common/Makefile
@@ -84,6 +84,8 @@ generated += tst-printf-bz18872.c tst-printf-bz18872.mtrace \
      tst-printf-bz25691.mtrace tst-printf-bz25691-mem.out
 endif
 
+tests-special += $(objpfx)tst-errno-manual.out
+
 include ../Rules
 
 ifeq ($(run-built-tests),yes)
@@ -128,6 +130,15 @@ $(objpfx)tst-%-mem.out: $(objpfx)tst-%.out
  $(common-objpfx)malloc/mtrace $(objpfx)tst-$*.mtrace > $@; \
  $(evaluate-test)
 
+errlist-h = $(firstword $(wildcard $(addsuffix /errlist.h,$(sysdirs) .)))
+
+$(objpfx)tst-errno-manual.out: tst-errno-manual.py \
+       $(errlist-h) \
+       $(..)manual/errno.texi
+ $(PYTHON) tst-errno-manual.py -m $(..)manual/errno.texi \
+      -e $(errlist-h) > $@; \
+ $(evaluate-test)
+
 CFLAGS-vfprintf.c += -Wno-uninitialized
 CFLAGS-vfwprintf.c += -Wno-uninitialized
 
diff --git a/stdio-common/errlist-compat.c b/stdio-common/errlist-compat.c
new file mode 100644
index 0000000000..6e25b021ab
--- /dev/null
+++ b/stdio-common/errlist-compat.c
@@ -0,0 +1 @@
+/* Empty.  */
diff --git a/stdio-common/errlist.c b/stdio-common/errlist.c
index 91fa789be0..df52356066 100644
--- a/stdio-common/errlist.c
+++ b/stdio-common/errlist.c
@@ -15,22 +15,24 @@
    License along with the GNU C Library; if not, see
    <https://www.gnu.org/licenses/>.  */
 
+#include <stdio.h>
+#include <errno.h>
+#include <libintl.h>
 #include <array_length.h>
-#include <stddef.h>
 
-const char *const _sys_errlist[] =
+const char *const _sys_errlist_internal[] =
   {
-    "Error 0", /* 0 */
-    "Argument out of function's domain", /* 1 = EDOM */
-    "Result out of range", /* 2 = ERANGE */
-    "Operation not implemented", /* 3 = ENOSYS */
-    "Invalid argument", /* 4 = EINVAL */
-    "Illegal seek", /* 5 = ESPIPE */
-    "Bad file descriptor", /* 6 = EBADF */
-    "Cannot allocate memory", /* 7 = ENOMEM */
-    "Permission denied", /* 8 = EACCES */
-    "Too many open files in system", /* 9 = ENFILE */
-    "Too many open files", /* 10 = EMFILE */
+#define _S(n, str)         [n] = str,
+#include <errlist.h>
+#undef _S
   };
 
-const int _sys_nerr = array_length (_sys_errlist);
+const char *
+__get_errlist (int errnum)
+{
+  if (errnum >= 0 && errnum < array_length (_sys_errlist_internal))
+    return _sys_errlist_internal[errnum];
+  return NULL;
+}
+
+#include <errlist-compat.c>
diff --git a/stdio-common/tst-errno-manual.py b/stdio-common/tst-errno-manual.py
new file mode 100755
index 0000000000..618120f4f0
--- /dev/null
+++ b/stdio-common/tst-errno-manual.py
@@ -0,0 +1,73 @@
+#!/usr/bin/python3
+# Check is all errno definitions at errlist.h documented in the manual.
+# 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/>.
+
+import argparse
+import sys
+import re
+
+RE_MANUAL = re.compile(
+    r'(?:^@errno){(\w+)')
+
+RE_ERRLIST = re.compile(
+    r'\(E[a-zA-Z0-9]+\)')
+
+PASS=0
+FAIL=1
+
+# Each manual entry is in the form:
+#
+#  errno{EAGAIN, 35, Resource temporarily unavailable}
+def parse_manual(f):
+    errlist = [RE_MANUAL.findall(s) for s in f]
+    return map(lambda x : x[0], filter(None, errlist))
+
+# Each errlist entry is in the form:
+#
+#  _S(ERR_MAP(EAGAIN), N_("Resource temporarily unavailable"))
+def parse_errlist(f):
+    errlist = [RE_ERRLIST.findall(s) for s in f]
+    # Each element is '[]' or '['(EAGAIN)']'
+    return map(lambda s : s[0][s[0].find('(')+1:s[0].find(')')],
+               filter(None, errlist))
+
+def check_errno_definitions(manual_fname, errlist_fname):
+    with open(manual_fname, 'r') as mfile, open(errlist_fname, 'r') as efile:
+        merr = parse_manual(mfile)
+        eerr = parse_errlist(efile)
+        diff = set(eerr).difference(merr)
+        if not diff:
+            sys.exit(PASS)
+        else:
+            print("Failure: the following value(s) are not in manual:",
+                  ", ".join(str(e) for e in diff))
+            sys.exit(FAIL)
+
+def main():
+    parser = argparse.ArgumentParser(description='Generate errlist.h')
+    parser.add_argument('-m', dest='manual', metavar='FILE',
+                        help='manual errno texi file')
+    parser.add_argument('-e', dest='errlist', metavar='FILE',
+                        help='errlist with errno definitions')
+    args = parser.parse_args()
+
+    check_errno_definitions(args.manual, args.errlist)
+
+
+if __name__ == '__main__':
+    main()
diff --git a/string/_strerror.c b/string/_strerror.c
index af6be56fdc..01226e3d4b 100644
--- a/string/_strerror.c
+++ b/string/_strerror.c
@@ -36,8 +36,8 @@
 char *
 __strerror_r (int errnum, char *buf, size_t buflen)
 {
-  if (__builtin_expect (errnum < 0 || errnum >= _sys_nerr_internal
- || _sys_errlist_internal[errnum] == NULL, 0))
+  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.  */
@@ -68,7 +68,7 @@ __strerror_r (int errnum, char *buf, size_t buflen)
       return buf;
     }
 
-  return (char *) _(_sys_errlist_internal[errnum]);
+  return _(err);
 }
 weak_alias (__strerror_r, strerror_r)
 libc_hidden_def (__strerror_r)
diff --git a/string/strerror_l.c b/string/strerror_l.c
index c8c3d4a6ef..309f42e66b 100644
--- a/string/strerror_l.c
+++ b/string/strerror_l.c
@@ -40,10 +40,8 @@ translate (const char *str, locale_t loc)
 char *
 strerror_l (int errnum, locale_t loc)
 {
-
-
-  if (__builtin_expect (errnum < 0 || errnum >= _sys_nerr_internal
- || _sys_errlist_internal[errnum] == NULL, 0))
+  char *err = (char *) __get_errlist (errnum);
+  if (__glibc_unlikely (err == NULL))
     {
       free (last_value);
       if (__asprintf (&last_value, "%s%d",
@@ -53,7 +51,7 @@ strerror_l (int errnum, locale_t loc)
       return last_value;
     }
 
-  return (char *) translate (_sys_errlist_internal[errnum], loc);
+  return (char *) translate (err, loc);
 }
 
 void
diff --git a/string/xpg-strerror.c b/string/xpg-strerror.c
index 5290b63f18..95311b75e9 100644
--- a/string/xpg-strerror.c
+++ b/string/xpg-strerror.c
@@ -32,16 +32,9 @@ __xpg_strerror_r (int errnum, char *buf, size_t buflen)
      string) if errnum is invalid, otherwise it returns a string whose
      storage has indefinite extent.  */
   if (estr == buf)
-    {
-      assert (errnum < 0 || errnum >= _sys_nerr_internal
-      || _sys_errlist_internal[errnum] == NULL);
-      return EINVAL;
-    }
+    return EINVAL;
   else
     {
-      assert (errnum >= 0 && errnum < _sys_nerr_internal
-      && _sys_errlist_internal[errnum] != NULL);
-
       size_t estrlen = strlen (estr);
 
       /* Terminate the string in any case.  */
diff --git a/sysdeps/gnu/Makefile b/sysdeps/gnu/Makefile
index 97fcb6fb90..9cf34c8ac6 100644
--- a/sysdeps/gnu/Makefile
+++ b/sysdeps/gnu/Makefile
@@ -15,49 +15,6 @@
 # License along with the GNU C Library; if not, see
 # <https://www.gnu.org/licenses/>.
 
-# Generate the list of strings for errno codes from the section of the
-# manual which documents the codes.
-
-$(..)sysdeps/gnu/errlist.c: $(..)sysdeps/gnu/errlist.awk \
-    $(..)manual/errno.texi
- $(AWK) -f $^ > $@-tmp
-# Make it unwritable so noone will edit it by mistake.
- -chmod a-w $@-tmp
- mv -f $@-tmp $@
-
-ifeq ($(subdir),stdio-common)
-
-errlist-c = $(firstword $(wildcard $(addsuffix /errlist.c,$(sysdirs) .)))
-
-libof-errlist-compat = extramodules
-
-ifeq ($(build-shared),yes)
-$(objpfx)errlist-compat.c: $(errlist-c) $(..)sysdeps/gnu/errlist-compat.awk \
-   $(common-objpfx)Versions.v.i $(before-compile)
-else
-$(objpfx)errlist-compat.c: $(errlist-c) $(..)sysdeps/gnu/errlist-compat.awk \
-   $(before-compile)
-endif
- $(make-target-directory)
- $(AWK) -v maxerr=`\
-  $(CC) -S $(CPPFLAGS) $(CFLAGS) -DEMIT_ERR_MAX $< -o - \
-  | sed -n 's/^.*@@@[^0-9]*\([0-9]*\)[^0-9]*@@@.*$$/\1/p'` \
-       -f $(..)sysdeps/gnu/errlist-compat.awk \
-       $(wildcard $(sysdirs:=/Versions)) > $@T
-# Make it unwritable so noone will edit it by mistake.
- -chmod a-w $@T
- mv -f $@T $@
-$(objpfx)errlist-compat.h: $(objpfx)errlist-compat.c
- sed -n '1p;/ERR_MAX/p' $< > $@T
- -chmod a-w $@T
- mv -f $@T $@
-generated += errlist-compat.c errlist-compat.h
-
-# This will force the generation above to happy if need be.
-$(foreach o,$(object-suffixes) $(object-suffixes:=.d),\
-  $(objpfx)errlist$o): $(objpfx)errlist-compat.h
-endif
-
 ifeq ($(subdir),login)
 sysdep_routines += setutxent getutxent endutxent getutxid getutxline \
    pututxline utmpxname updwtmpx getutmpx getutmp
diff --git a/sysdeps/gnu/errlist-compat.awk b/sysdeps/gnu/errlist-compat.awk
deleted file mode 100644
index 07334c63d8..0000000000
--- a/sysdeps/gnu/errlist-compat.awk
+++ /dev/null
@@ -1,133 +0,0 @@
-# awk script to generate errlist-compat.c
-# Copyright (C) 2002-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/>.
-
-#
-# This script takes the Versions file as input and looks for #errlist-compat
-# magic comments, which have the form:
-# #errlist-compat NNN
-# where NNN is the number of elements in the sys_errlist for that version set.
-# We need the awk variable `maxerr' defined to the current size of sys_errlist.
-#
-# If there is no magic comment matching the current size, we barf.
-# Otherwise we generate code (errlist-compat.c) to define all the
-# necessary compatibility symbols for older, smaller versions of sys_errlist.
-#
-
-# These two rules catch the Versions file contents.
-NF == 2 && $2 == "{" { last_version = $1; next }
-$1 == "#errlist-compat" {
-  # Don't process any further Versions files
-  ARGC = ARGIND + 1;
-  cnt = $2 + 0;
-  if (cnt < 80) {
-    print "*** this line seems bogus:", $0 > "/dev/stderr";
-    exit 1;
-  }
-  version[pos + 0] = cnt SUBSEP last_version;
-  pos++;
-  if (cnt < highest) {
-    printf "*** %s #errlist-compat counts are not sorted\n", ARGV[ARGIND];
-    exit 1;
-  }
-  if (cnt > highest)
-    highest = cnt;
-  highest_version = last_version;
-  next;
-}
-
-END {
-  if (! highest_version) {
-    print "/* No sys_errlist/sys_nerr symbols defined on this platform.  */";
-    exit 0;
-  }
-
-  count = maxerr + 1;
-
-  if (highest < count) {
-    printf "*** errlist.c count %d vs Versions sys_errlist@%s count %d\n", \
-      count, highest_version, highest > "/dev/stderr";
-    exit 1;
-  }
-
-  lastv = "";
-  for (n = 0; n < pos; ++n) {
-    split(version[n], t, SUBSEP)
-    v = t[2];
-    gsub(/[^A-Z0-9_]/, "_", v);
-    if (lastv != "")
-      compat[lastv] = v;
-    lastv = v;
-    vcount[v] = t[1];
-  }
-
-  print "/* This file was generated by errlist-compat.awk; DO NOT EDIT!  */\n";
-  print "#include <shlib-compat.h>\n";
-
-  if (highest > count) {
-    printf "*** errlist.c count %d inflated to %s count %d (old errno.h?)\n", \
-      count, highest_version, highest > "/dev/stderr";
-    printf "#define ERR_MAX %d\n\n", highest - 1;
-  }
-
-  # same regardless of awk's ordering of the associative array.
-  num_compat_elems = asorti(compat, compat_indices)
-  for (i = 1; i <= num_compat_elems; i++) {
-    old = compat_indices[i]
-    new = compat[old];
-    n = vcount[old];
-    printf "#if SHLIB_COMPAT (libc, %s, %s)\n", old, new;
-    printf "# include <bits/wordsize.h>\n";
-    printf "extern const char *const __sys_errlist_%s[NERR];\n", old;
-    printf "const int __sys_nerr_%s = %d;\n", old, n;
-    printf "declare_symbol_alias (__sys_errlist_%s, _sys_errlist_internal,", \
-      old;
-    printf " object, __WORDSIZE/8*%d)\n", n;
-    printf "compat_symbol (libc, __sys_errlist_%s, sys_errlist, %s);\n", \
-      old, old;
-    printf "compat_symbol (libc, __sys_nerr_%s, sys_nerr, %s);\n", old, old;
-
-    printf "extern const char *const ___sys_errlist_%s[NERR];\n", old;
-    printf "extern const int __sys_nerr_%s;\n", old;
-    printf "declare_symbol_alias (___sys_errlist_%s, _sys_errlist_internal,", \
-      old;
-    printf " object, __WORDSIZE/8*%d)\n", n;
-    printf "strong_alias (__sys_nerr_%s, ___sys_nerr_%s)\n", old, old;
-    printf "compat_symbol (libc, ___sys_errlist_%s, _sys_errlist, %s);\n", \
-      old, old;
-    printf "compat_symbol (libc, ___sys_nerr_%s, _sys_nerr, %s);\n", old, old;
-    printf "#endif\n\n";
-  }
-
-  printf "\
-extern const char *const __sys_errlist_internal[NERR];\n\
-extern const int __sys_nerr_internal;\n\
-strong_alias (_sys_errlist_internal, __sys_errlist_internal)\n\
-strong_alias (_sys_nerr_internal, __sys_nerr_internal)\n\
-extern const char *const sys_errlist[NERR];\n\
-versioned_symbol (libc, _sys_errlist_internal, sys_errlist, %s);\n\
-versioned_symbol (libc, __sys_errlist_internal, _sys_errlist, %s);\n\
-versioned_symbol (libc, _sys_nerr_internal, sys_nerr, %s);\n\
-versioned_symbol (libc, __sys_nerr_internal, _sys_nerr, %s);\n", \
-    lastv, lastv, lastv, lastv;
-
-  print "\n\
-link_warning (sys_errlist, \"\
-`sys_errlist' is deprecated; use `strerror' or `strerror_r' instead\")\n\
-link_warning (sys_nerr, \"\
-`sys_nerr' is deprecated; use `strerror' or `strerror_r' instead\")";
-}
diff --git a/sysdeps/gnu/errlist.awk b/sysdeps/gnu/errlist.awk
deleted file mode 100644
index 09f80f5b44..0000000000
--- a/sysdeps/gnu/errlist.awk
+++ /dev/null
@@ -1,110 +0,0 @@
-# Copyright (C) 1991-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/>.
-
-# errno.texi contains lines like:
-# @deftypevr Macro int ENOSYS
-# @errno{ENOSYS, 78, Function not implemented}
-# Descriptive paragraph...
-# @end deftypevr
-
-BEGIN {
-
-    # Here we list the E* names that might be duplicate names for the
-    # same integer value on some systems.  This causes the code below
-    # to generate ``#if defined (ALIAS) && ALIAS != ORIGINAL'' in the code,
-    # so the output does not presume that these are in fact aliases.
-    # We list here all the known potential cases on any system,
-    # so that the C source we produce will do the right thing based
-    # on the actual #define'd values it's compiled with.
-    alias["EWOULDBLOCK"]= "EAGAIN";
-    alias["EDEADLOCK"] = "EDEADLK";
-    alias["ENOTSUP"] = "EOPNOTSUPP";
-
-    print "/* This file is generated from errno.texi by errlist.awk.  */"
-    print "";
-    print "#include <errno.h>";
-    print "#include <libintl.h>";
-    print "";
-    print "#ifndef ERR_REMAP";
-    print "# define ERR_REMAP(n) n";
-    print "#endif";
-    print "";
-
-    print "#if !defined EMIT_ERR_MAX && !defined ERRLIST_NO_COMPAT";
-    print "# include <errlist-compat.h>";
-    print "#endif";
-    print "#ifdef ERR_MAX";
-    print "# define ERRLIST_SIZE ERR_MAX + 1";
-    print "#else"
-    print "# define ERR_MAX 0";
-    print "# define ERRLIST_SIZE";
-    print "#endif";
-
-    print "const char *const _sys_errlist_internal[ERRLIST_SIZE] =";
-    print "  {";
-    print "    [0] = N_(\"Success\"),"
-  }
-
-/^@errno\{/ \
-  {
-    etext = $3;
-    for (i = 4; i <= NF; ++i)
-      etext = etext " " $i;
-    etext = substr(etext, 1, length(etext)-1)
-    e = substr($1, 8, length($1)-8)
-    errno = substr($2, 1, length($2)-1) + 0
-    if (alias[e])
-      printf "#if defined (%s) && %s != %s\n", e, e, alias[e];
-    else
-      printf "#ifdef %s\n", e;
-    errnoh = 4;
-    desc="";
-    next;
-  }
-errnoh == 4 && $1 == "@end" && $2 == "deftypevr" \
-  {
-    printf "/*%s */\n", desc;
-    printf "    [ERR_REMAP (%s)] = N_(\"%s\"),\n", e, etext;
-    printf "# if %s > ERR_MAX\n", e;
-    print  "# undef ERR_MAX";
-    printf "# define ERR_MAX %s\n", e;
-    print  "# endif";
-    print "#endif";
-    errnoh = 0;
-    next;
-  }
-errnoh == 4 \
-  {
-    # This magic tag in C comments gets them copied into libc.pot.
-    desc = desc "\nTRANS" ($0 != "" ? " " : "") $0; next
-  }
-END {
-  print "  };";
-  print "";
-  print "#define NERR \\";
-  print "  (sizeof _sys_errlist_internal / sizeof _sys_errlist_internal [0])";
-  print "const int _sys_nerr_internal = NERR;"
-  print "";
-  print "#if IS_IN (libc) && !defined ERRLIST_NO_COMPAT";
-  print "# include <errlist-compat.c>";
-  print "#endif";
-  print "";
-  print "#ifdef EMIT_ERR_MAX";
-  print "void dummy (void)"
-  print "{ asm volatile (\" @@@ %0 @@@ \" : : \"i\" (ERR_REMAP (ERR_MAX))); }"
-  print "#endif";
-}
diff --git a/sysdeps/gnu/errlist.c b/sysdeps/gnu/errlist.c
deleted file mode 100644
index 77577bf3e1..0000000000
--- a/sysdeps/gnu/errlist.c
+++ /dev/null
@@ -1,1495 +0,0 @@
-/* This file is generated from errno.texi by errlist.awk.  */
-
-#include <errno.h>
-#include <libintl.h>
-
-#ifndef ERR_REMAP
-# define ERR_REMAP(n) n
-#endif
-
-#if !defined EMIT_ERR_MAX && !defined ERRLIST_NO_COMPAT
-# include <errlist-compat.h>
-#endif
-#ifdef ERR_MAX
-# define ERRLIST_SIZE ERR_MAX + 1
-#else
-# define ERR_MAX 0
-# define ERRLIST_SIZE
-#endif
-const char *const _sys_errlist_internal[ERRLIST_SIZE] =
-  {
-    [0] = N_("Success"),
-#ifdef EPERM
-/*
-TRANS Only the owner of the file (or other resource)
-TRANS or processes with special privileges can perform the operation. */
-    [ERR_REMAP (EPERM)] = N_("Operation not permitted"),
-# if EPERM > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EPERM
-# endif
-#endif
-#ifdef ENOENT
-/*
-TRANS This is a ``file doesn't exist'' error
-TRANS for ordinary files that are referenced in contexts where they are
-TRANS expected to already exist. */
-    [ERR_REMAP (ENOENT)] = N_("No such file or directory"),
-# if ENOENT > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX ENOENT
-# endif
-#endif
-#ifdef ESRCH
-/*
-TRANS No process matches the specified process ID. */
-    [ERR_REMAP (ESRCH)] = N_("No such process"),
-# if ESRCH > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX ESRCH
-# endif
-#endif
-#ifdef EINTR
-/*
-TRANS An asynchronous signal occurred and prevented
-TRANS completion of the call.  When this happens, you should try the call
-TRANS again.
-TRANS
-TRANS You can choose to have functions resume after a signal that is handled,
-TRANS rather than failing with @code{EINTR}; see @ref{Interrupted
-TRANS Primitives}. */
-    [ERR_REMAP (EINTR)] = N_("Interrupted system call"),
-# if EINTR > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EINTR
-# endif
-#endif
-#ifdef EIO
-/*
-TRANS Usually used for physical read or write errors. */
-    [ERR_REMAP (EIO)] = N_("Input/output error"),
-# if EIO > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EIO
-# endif
-#endif
-#ifdef ENXIO
-/*
-TRANS The system tried to use the device
-TRANS represented by a file you specified, and it couldn't find the device.
-TRANS This can mean that the device file was installed incorrectly, or that
-TRANS the physical device is missing or not correctly attached to the
-TRANS computer. */
-    [ERR_REMAP (ENXIO)] = N_("No such device or address"),
-# if ENXIO > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX ENXIO
-# endif
-#endif
-#ifdef E2BIG
-/*
-TRANS Used when the arguments passed to a new program
-TRANS being executed with one of the @code{exec} functions (@pxref{Executing a
-TRANS File}) occupy too much memory space.  This condition never arises on
-TRANS @gnuhurdsystems{}. */
-    [ERR_REMAP (E2BIG)] = N_("Argument list too long"),
-# if E2BIG > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX E2BIG
-# endif
-#endif
-#ifdef ENOEXEC
-/*
-TRANS Invalid executable file format.  This condition is detected by the
-TRANS @code{exec} functions; see @ref{Executing a File}. */
-    [ERR_REMAP (ENOEXEC)] = N_("Exec format error"),
-# if ENOEXEC > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX ENOEXEC
-# endif
-#endif
-#ifdef EBADF
-/*
-TRANS For example, I/O on a descriptor that has been
-TRANS closed or reading from a descriptor open only for writing (or vice
-TRANS versa). */
-    [ERR_REMAP (EBADF)] = N_("Bad file descriptor"),
-# if EBADF > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EBADF
-# endif
-#endif
-#ifdef ECHILD
-/*
-TRANS This error happens on operations that are
-TRANS supposed to manipulate child processes, when there aren't any processes
-TRANS to manipulate. */
-    [ERR_REMAP (ECHILD)] = N_("No child processes"),
-# if ECHILD > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX ECHILD
-# endif
-#endif
-#ifdef EDEADLK
-/*
-TRANS Allocating a system resource would have resulted in a
-TRANS deadlock situation.  The system does not guarantee that it will notice
-TRANS all such situations.  This error means you got lucky and the system
-TRANS noticed; it might just hang.  @xref{File Locks}, for an example. */
-    [ERR_REMAP (EDEADLK)] = N_("Resource deadlock avoided"),
-# if EDEADLK > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EDEADLK
-# endif
-#endif
-#ifdef ENOMEM
-/*
-TRANS The system cannot allocate more virtual memory
-TRANS because its capacity is full. */
-    [ERR_REMAP (ENOMEM)] = N_("Cannot allocate memory"),
-# if ENOMEM > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX ENOMEM
-# endif
-#endif
-#ifdef EACCES
-/*
-TRANS The file permissions do not allow the attempted operation. */
-    [ERR_REMAP (EACCES)] = N_("Permission denied"),
-# if EACCES > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EACCES
-# endif
-#endif
-#ifdef EFAULT
-/*
-TRANS An invalid pointer was detected.
-TRANS On @gnuhurdsystems{}, this error never happens; you get a signal instead. */
-    [ERR_REMAP (EFAULT)] = N_("Bad address"),
-# if EFAULT > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EFAULT
-# endif
-#endif
-#ifdef ENOTBLK
-/*
-TRANS A file that isn't a block special file was given in a situation that
-TRANS requires one.  For example, trying to mount an ordinary file as a file
-TRANS system in Unix gives this error. */
-    [ERR_REMAP (ENOTBLK)] = N_("Block device required"),
-# if ENOTBLK > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX ENOTBLK
-# endif
-#endif
-#ifdef EBUSY
-/*
-TRANS A system resource that can't be shared is already in use.
-TRANS For example, if you try to delete a file that is the root of a currently
-TRANS mounted filesystem, you get this error. */
-    [ERR_REMAP (EBUSY)] = N_("Device or resource busy"),
-# if EBUSY > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EBUSY
-# endif
-#endif
-#ifdef EEXIST
-/*
-TRANS An existing file was specified in a context where it only
-TRANS makes sense to specify a new file. */
-    [ERR_REMAP (EEXIST)] = N_("File exists"),
-# if EEXIST > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EEXIST
-# endif
-#endif
-#ifdef EXDEV
-/*
-TRANS An attempt to make an improper link across file systems was detected.
-TRANS This happens not only when you use @code{link} (@pxref{Hard Links}) but
-TRANS also when you rename a file with @code{rename} (@pxref{Renaming Files}). */
-    [ERR_REMAP (EXDEV)] = N_("Invalid cross-device link"),
-# if EXDEV > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EXDEV
-# endif
-#endif
-#ifdef ENODEV
-/*
-TRANS The wrong type of device was given to a function that expects a
-TRANS particular sort of device. */
-    [ERR_REMAP (ENODEV)] = N_("No such device"),
-# if ENODEV > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX ENODEV
-# endif
-#endif
-#ifdef ENOTDIR
-/*
-TRANS A file that isn't a directory was specified when a directory is required. */
-    [ERR_REMAP (ENOTDIR)] = N_("Not a directory"),
-# if ENOTDIR > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX ENOTDIR
-# endif
-#endif
-#ifdef EISDIR
-/*
-TRANS You cannot open a directory for writing,
-TRANS or create or remove hard links to it. */
-    [ERR_REMAP (EISDIR)] = N_("Is a directory"),
-# if EISDIR > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EISDIR
-# endif
-#endif
-#ifdef EINVAL
-/*
-TRANS This is used to indicate various kinds of problems
-TRANS with passing the wrong argument to a library function. */
-    [ERR_REMAP (EINVAL)] = N_("Invalid argument"),
-# if EINVAL > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EINVAL
-# endif
-#endif
-#ifdef EMFILE
-/*
-TRANS The current process has too many files open and can't open any more.
-TRANS Duplicate descriptors do count toward this limit.
-TRANS
-TRANS In BSD and GNU, the number of open files is controlled by a resource
-TRANS limit that can usually be increased.  If you get this error, you might
-TRANS want to increase the @code{RLIMIT_NOFILE} limit or make it unlimited;
-TRANS @pxref{Limits on Resources}. */
-    [ERR_REMAP (EMFILE)] = N_("Too many open files"),
-# if EMFILE > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EMFILE
-# endif
-#endif
-#ifdef ENFILE
-/*
-TRANS There are too many distinct file openings in the entire system.  Note
-TRANS that any number of linked channels count as just one file opening; see
-TRANS @ref{Linked Channels}.  This error never occurs on @gnuhurdsystems{}. */
-    [ERR_REMAP (ENFILE)] = N_("Too many open files in system"),
-# if ENFILE > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX ENFILE
-# endif
-#endif
-#ifdef ENOTTY
-/*
-TRANS Inappropriate I/O control operation, such as trying to set terminal
-TRANS modes on an ordinary file. */
-    [ERR_REMAP (ENOTTY)] = N_("Inappropriate ioctl for device"),
-# if ENOTTY > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX ENOTTY
-# endif
-#endif
-#ifdef ETXTBSY
-/*
-TRANS An attempt to execute a file that is currently open for writing, or
-TRANS write to a file that is currently being executed.  Often using a
-TRANS debugger to run a program is considered having it open for writing and
-TRANS will cause this error.  (The name stands for ``text file busy''.)  This
-TRANS is not an error on @gnuhurdsystems{}; the text is copied as necessary. */
-    [ERR_REMAP (ETXTBSY)] = N_("Text file busy"),
-# if ETXTBSY > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX ETXTBSY
-# endif
-#endif
-#ifdef EFBIG
-/*
-TRANS The size of a file would be larger than allowed by the system. */
-    [ERR_REMAP (EFBIG)] = N_("File too large"),
-# if EFBIG > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EFBIG
-# endif
-#endif
-#ifdef ENOSPC
-/*
-TRANS Write operation on a file failed because the
-TRANS disk is full. */
-    [ERR_REMAP (ENOSPC)] = N_("No space left on device"),
-# if ENOSPC > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX ENOSPC
-# endif
-#endif
-#ifdef ESPIPE
-/*
-TRANS Invalid seek operation (such as on a pipe). */
-    [ERR_REMAP (ESPIPE)] = N_("Illegal seek"),
-# if ESPIPE > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX ESPIPE
-# endif
-#endif
-#ifdef EROFS
-/*
-TRANS An attempt was made to modify something on a read-only file system. */
-    [ERR_REMAP (EROFS)] = N_("Read-only file system"),
-# if EROFS > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EROFS
-# endif
-#endif
-#ifdef EMLINK
-/*
-TRANS The link count of a single file would become too large.
-TRANS @code{rename} can cause this error if the file being renamed already has
-TRANS as many links as it can take (@pxref{Renaming Files}). */
-    [ERR_REMAP (EMLINK)] = N_("Too many links"),
-# if EMLINK > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EMLINK
-# endif
-#endif
-#ifdef EPIPE
-/*
-TRANS There is no process reading from the other end of a pipe.
-TRANS Every library function that returns this error code also generates a
-TRANS @code{SIGPIPE} signal; this signal terminates the program if not handled
-TRANS or blocked.  Thus, your program will never actually see @code{EPIPE}
-TRANS unless it has handled or blocked @code{SIGPIPE}. */
-    [ERR_REMAP (EPIPE)] = N_("Broken pipe"),
-# if EPIPE > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EPIPE
-# endif
-#endif
-#ifdef EDOM
-/*
-TRANS Used by mathematical functions when an argument value does
-TRANS not fall into the domain over which the function is defined. */
-    [ERR_REMAP (EDOM)] = N_("Numerical argument out of domain"),
-# if EDOM > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EDOM
-# endif
-#endif
-#ifdef ERANGE
-/*
-TRANS Used by mathematical functions when the result value is
-TRANS not representable because of overflow or underflow. */
-    [ERR_REMAP (ERANGE)] = N_("Numerical result out of range"),
-# if ERANGE > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX ERANGE
-# endif
-#endif
-#ifdef EAGAIN
-/*
-TRANS The call might work if you try again
-TRANS later.  The macro @code{EWOULDBLOCK} is another name for @code{EAGAIN};
-TRANS they are always the same in @theglibc{}.
-TRANS
-TRANS This error can happen in a few different situations:
-TRANS
-TRANS @itemize @bullet
-TRANS @item
-TRANS An operation that would block was attempted on an object that has
-TRANS non-blocking mode selected.  Trying the same operation again will block
-TRANS until some external condition makes it possible to read, write, or
-TRANS connect (whatever the operation).  You can use @code{select} to find out
-TRANS when the operation will be possible; @pxref{Waiting for I/O}.
-TRANS
-TRANS @strong{Portability Note:} In many older Unix systems, this condition
-TRANS was indicated by @code{EWOULDBLOCK}, which was a distinct error code
-TRANS different from @code{EAGAIN}.  To make your program portable, you should
-TRANS check for both codes and treat them the same.
-TRANS
-TRANS @item
-TRANS A temporary resource shortage made an operation impossible.  @code{fork}
-TRANS can return this error.  It indicates that the shortage is expected to
-TRANS pass, so your program can try the call again later and it may succeed.
-TRANS It is probably a good idea to delay for a few seconds before trying it
-TRANS again, to allow time for other processes to release scarce resources.
-TRANS Such shortages are usually fairly serious and affect the whole system,
-TRANS so usually an interactive program should report the error to the user
-TRANS and return to its command loop.
-TRANS @end itemize */
-    [ERR_REMAP (EAGAIN)] = N_("Resource temporarily unavailable"),
-# if EAGAIN > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EAGAIN
-# endif
-#endif
-#if defined (EWOULDBLOCK) && EWOULDBLOCK != EAGAIN
-/*
-TRANS In @theglibc{}, this is another name for @code{EAGAIN} (above).
-TRANS The values are always the same, on every operating system.
-TRANS
-TRANS C libraries in many older Unix systems have @code{EWOULDBLOCK} as a
-TRANS separate error code. */
-    [ERR_REMAP (EWOULDBLOCK)] = N_("Operation would block"),
-# if EWOULDBLOCK > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EWOULDBLOCK
-# endif
-#endif
-#ifdef EINPROGRESS
-/*
-TRANS An operation that cannot complete immediately was initiated on an object
-TRANS that has non-blocking mode selected.  Some functions that must always
-TRANS block (such as @code{connect}; @pxref{Connecting}) never return
-TRANS @code{EAGAIN}.  Instead, they return @code{EINPROGRESS} to indicate that
-TRANS the operation has begun and will take some time.  Attempts to manipulate
-TRANS the object before the call completes return @code{EALREADY}.  You can
-TRANS use the @code{select} function to find out when the pending operation
-TRANS has completed; @pxref{Waiting for I/O}. */
-    [ERR_REMAP (EINPROGRESS)] = N_("Operation now in progress"),
-# if EINPROGRESS > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EINPROGRESS
-# endif
-#endif
-#ifdef EALREADY
-/*
-TRANS An operation is already in progress on an object that has non-blocking
-TRANS mode selected. */
-    [ERR_REMAP (EALREADY)] = N_("Operation already in progress"),
-# if EALREADY > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EALREADY
-# endif
-#endif
-#ifdef ENOTSOCK
-/*
-TRANS A file that isn't a socket was specified when a socket is required. */
-    [ERR_REMAP (ENOTSOCK)] = N_("Socket operation on non-socket"),
-# if ENOTSOCK > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX ENOTSOCK
-# endif
-#endif
-#ifdef EMSGSIZE
-/*
-TRANS The size of a message sent on a socket was larger than the supported
-TRANS maximum size. */
-    [ERR_REMAP (EMSGSIZE)] = N_("Message too long"),
-# if EMSGSIZE > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EMSGSIZE
-# endif
-#endif
-#ifdef EPROTOTYPE
-/*
-TRANS The socket type does not support the requested communications protocol. */
-    [ERR_REMAP (EPROTOTYPE)] = N_("Protocol wrong type for socket"),
-# if EPROTOTYPE > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EPROTOTYPE
-# endif
-#endif
-#ifdef ENOPROTOOPT
-/*
-TRANS You specified a socket option that doesn't make sense for the
-TRANS particular protocol being used by the socket.  @xref{Socket Options}. */
-    [ERR_REMAP (ENOPROTOOPT)] = N_("Protocol not available"),
-# if ENOPROTOOPT > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX ENOPROTOOPT
-# endif
-#endif
-#ifdef EPROTONOSUPPORT
-/*
-TRANS The socket domain does not support the requested communications protocol
-TRANS (perhaps because the requested protocol is completely invalid).
-TRANS @xref{Creating a Socket}. */
-    [ERR_REMAP (EPROTONOSUPPORT)] = N_("Protocol not supported"),
-# if EPROTONOSUPPORT > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EPROTONOSUPPORT
-# endif
-#endif
-#ifdef ESOCKTNOSUPPORT
-/*
-TRANS The socket type is not supported. */
-    [ERR_REMAP (ESOCKTNOSUPPORT)] = N_("Socket type not supported"),
-# if ESOCKTNOSUPPORT > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX ESOCKTNOSUPPORT
-# endif
-#endif
-#ifdef EOPNOTSUPP
-/*
-TRANS The operation you requested is not supported.  Some socket functions
-TRANS don't make sense for all types of sockets, and others may not be
-TRANS implemented for all communications protocols.  On @gnuhurdsystems{}, this
-TRANS error can happen for many calls when the object does not support the
-TRANS particular operation; it is a generic indication that the server knows
-TRANS nothing to do for that call. */
-    [ERR_REMAP (EOPNOTSUPP)] = N_("Operation not supported"),
-# if EOPNOTSUPP > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EOPNOTSUPP
-# endif
-#endif
-#ifdef EPFNOSUPPORT
-/*
-TRANS The socket communications protocol family you requested is not supported. */
-    [ERR_REMAP (EPFNOSUPPORT)] = N_("Protocol family not supported"),
-# if EPFNOSUPPORT > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EPFNOSUPPORT
-# endif
-#endif
-#ifdef EAFNOSUPPORT
-/*
-TRANS The address family specified for a socket is not supported; it is
-TRANS inconsistent with the protocol being used on the socket.  @xref{Sockets}. */
-    [ERR_REMAP (EAFNOSUPPORT)] = N_("Address family not supported by protocol"),
-# if EAFNOSUPPORT > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EAFNOSUPPORT
-# endif
-#endif
-#ifdef EADDRINUSE
-/*
-TRANS The requested socket address is already in use.  @xref{Socket Addresses}. */
-    [ERR_REMAP (EADDRINUSE)] = N_("Address already in use"),
-# if EADDRINUSE > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EADDRINUSE
-# endif
-#endif
-#ifdef EADDRNOTAVAIL
-/*
-TRANS The requested socket address is not available; for example, you tried
-TRANS to give a socket a name that doesn't match the local host name.
-TRANS @xref{Socket Addresses}. */
-    [ERR_REMAP (EADDRNOTAVAIL)] = N_("Cannot assign requested address"),
-# if EADDRNOTAVAIL > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EADDRNOTAVAIL
-# endif
-#endif
-#ifdef ENETDOWN
-/*
-TRANS A socket operation failed because the network was down. */
-    [ERR_REMAP (ENETDOWN)] = N_("Network is down"),
-# if ENETDOWN > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX ENETDOWN
-# endif
-#endif
-#ifdef ENETUNREACH
-/*
-TRANS A socket operation failed because the subnet containing the remote host
-TRANS was unreachable. */
-    [ERR_REMAP (ENETUNREACH)] = N_("Network is unreachable"),
-# if ENETUNREACH > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX ENETUNREACH
-# endif
-#endif
-#ifdef ENETRESET
-/*
-TRANS A network connection was reset because the remote host crashed. */
-    [ERR_REMAP (ENETRESET)] = N_("Network dropped connection on reset"),
-# if ENETRESET > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX ENETRESET
-# endif
-#endif
-#ifdef ECONNABORTED
-/*
-TRANS A network connection was aborted locally. */
-    [ERR_REMAP (ECONNABORTED)] = N_("Software caused connection abort"),
-# if ECONNABORTED > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX ECONNABORTED
-# endif
-#endif
-#ifdef ECONNRESET
-/*
-TRANS A network connection was closed for reasons outside the control of the
-TRANS local host, such as by the remote machine rebooting or an unrecoverable
-TRANS protocol violation. */
-    [ERR_REMAP (ECONNRESET)] = N_("Connection reset by peer"),
-# if ECONNRESET > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX ECONNRESET
-# endif
-#endif
-#ifdef ENOBUFS
-/*
-TRANS The kernel's buffers for I/O operations are all in use.  In GNU, this
-TRANS error is always synonymous with @code{ENOMEM}; you may get one or the
-TRANS other from network operations. */
-    [ERR_REMAP (ENOBUFS)] = N_("No buffer space available"),
-# if ENOBUFS > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX ENOBUFS
-# endif
-#endif
-#ifdef EISCONN
-/*
-TRANS You tried to connect a socket that is already connected.
-TRANS @xref{Connecting}. */
-    [ERR_REMAP (EISCONN)] = N_("Transport endpoint is already connected"),
-# if EISCONN > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EISCONN
-# endif
-#endif
-#ifdef ENOTCONN
-/*
-TRANS The socket is not connected to anything.  You get this error when you
-TRANS try to transmit data over a socket, without first specifying a
-TRANS destination for the data.  For a connectionless socket (for datagram
-TRANS protocols, such as UDP), you get @code{EDESTADDRREQ} instead. */
-    [ERR_REMAP (ENOTCONN)] = N_("Transport endpoint is not connected"),
-# if ENOTCONN > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX ENOTCONN
-# endif
-#endif
-#ifdef EDESTADDRREQ
-/*
-TRANS No default destination address was set for the socket.  You get this
-TRANS error when you try to transmit data over a connectionless socket,
-TRANS without first specifying a destination for the data with @code{connect}. */
-    [ERR_REMAP (EDESTADDRREQ)] = N_("Destination address required"),
-# if EDESTADDRREQ > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EDESTADDRREQ
-# endif
-#endif
-#ifdef ESHUTDOWN
-/*
-TRANS The socket has already been shut down. */
-    [ERR_REMAP (ESHUTDOWN)] = N_("Cannot send after transport endpoint shutdown"),
-# if ESHUTDOWN > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX ESHUTDOWN
-# endif
-#endif
-#ifdef ETOOMANYREFS
-/* */
-    [ERR_REMAP (ETOOMANYREFS)] = N_("Too many references: cannot splice"),
-# if ETOOMANYREFS > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX ETOOMANYREFS
-# endif
-#endif
-#ifdef ETIMEDOUT
-/*
-TRANS A socket operation with a specified timeout received no response during
-TRANS the timeout period. */
-    [ERR_REMAP (ETIMEDOUT)] = N_("Connection timed out"),
-# if ETIMEDOUT > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX ETIMEDOUT
-# endif
-#endif
-#ifdef ECONNREFUSED
-/*
-TRANS A remote host refused to allow the network connection (typically because
-TRANS it is not running the requested service). */
-    [ERR_REMAP (ECONNREFUSED)] = N_("Connection refused"),
-# if ECONNREFUSED > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX ECONNREFUSED
-# endif
-#endif
-#ifdef ELOOP
-/*
-TRANS Too many levels of symbolic links were encountered in looking up a file name.
-TRANS This often indicates a cycle of symbolic links. */
-    [ERR_REMAP (ELOOP)] = N_("Too many levels of symbolic links"),
-# if ELOOP > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX ELOOP
-# endif
-#endif
-#ifdef ENAMETOOLONG
-/*
-TRANS Filename too long (longer than @code{PATH_MAX}; @pxref{Limits for
-TRANS Files}) or host name too long (in @code{gethostname} or
-TRANS @code{sethostname}; @pxref{Host Identification}). */
-    [ERR_REMAP (ENAMETOOLONG)] = N_("File name too long"),
-# if ENAMETOOLONG > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX ENAMETOOLONG
-# endif
-#endif
-#ifdef EHOSTDOWN
-/*
-TRANS The remote host for a requested network connection is down. */
-    [ERR_REMAP (EHOSTDOWN)] = N_("Host is down"),
-# if EHOSTDOWN > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EHOSTDOWN
-# endif
-#endif
-#ifdef EHOSTUNREACH
-/*
-TRANS The remote host for a requested network connection is not reachable. */
-    [ERR_REMAP (EHOSTUNREACH)] = N_("No route to host"),
-# if EHOSTUNREACH > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EHOSTUNREACH
-# endif
-#endif
-#ifdef ENOTEMPTY
-/*
-TRANS Directory not empty, where an empty directory was expected.  Typically,
-TRANS this error occurs when you are trying to delete a directory. */
-    [ERR_REMAP (ENOTEMPTY)] = N_("Directory not empty"),
-# if ENOTEMPTY > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX ENOTEMPTY
-# endif
-#endif
-#ifdef EPROCLIM
-/*
-TRANS This means that the per-user limit on new process would be exceeded by
-TRANS an attempted @code{fork}.  @xref{Limits on Resources}, for details on
-TRANS the @code{RLIMIT_NPROC} limit. */
-    [ERR_REMAP (EPROCLIM)] = N_("Too many processes"),
-# if EPROCLIM > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EPROCLIM
-# endif
-#endif
-#ifdef EUSERS
-/*
-TRANS The file quota system is confused because there are too many users.
-TRANS @c This can probably happen in a GNU system when using NFS. */
-    [ERR_REMAP (EUSERS)] = N_("Too many users"),
-# if EUSERS > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EUSERS
-# endif
-#endif
-#ifdef EDQUOT
-/*
-TRANS The user's disk quota was exceeded. */
-    [ERR_REMAP (EDQUOT)] = N_("Disk quota exceeded"),
-# if EDQUOT > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EDQUOT
-# endif
-#endif
-#ifdef ESTALE
-/*
-TRANS This indicates an internal confusion in the
-TRANS file system which is due to file system rearrangements on the server host
-TRANS for NFS file systems or corruption in other file systems.
-TRANS Repairing this condition usually requires unmounting, possibly repairing
-TRANS and remounting the file system. */
-    [ERR_REMAP (ESTALE)] = N_("Stale file handle"),
-# if ESTALE > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX ESTALE
-# endif
-#endif
-#ifdef EREMOTE
-/*
-TRANS An attempt was made to NFS-mount a remote file system with a file name that
-TRANS already specifies an NFS-mounted file.
-TRANS (This is an error on some operating systems, but we expect it to work
-TRANS properly on @gnuhurdsystems{}, making this error code impossible.) */
-    [ERR_REMAP (EREMOTE)] = N_("Object is remote"),
-# if EREMOTE > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EREMOTE
-# endif
-#endif
-#ifdef EBADRPC
-/* */
-    [ERR_REMAP (EBADRPC)] = N_("RPC struct is bad"),
-# if EBADRPC > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EBADRPC
-# endif
-#endif
-#ifdef ERPCMISMATCH
-/* */
-    [ERR_REMAP (ERPCMISMATCH)] = N_("RPC version wrong"),
-# if ERPCMISMATCH > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX ERPCMISMATCH
-# endif
-#endif
-#ifdef EPROGUNAVAIL
-/* */
-    [ERR_REMAP (EPROGUNAVAIL)] = N_("RPC program not available"),
-# if EPROGUNAVAIL > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EPROGUNAVAIL
-# endif
-#endif
-#ifdef EPROGMISMATCH
-/* */
-    [ERR_REMAP (EPROGMISMATCH)] = N_("RPC program version wrong"),
-# if EPROGMISMATCH > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EPROGMISMATCH
-# endif
-#endif
-#ifdef EPROCUNAVAIL
-/* */
-    [ERR_REMAP (EPROCUNAVAIL)] = N_("RPC bad procedure for program"),
-# if EPROCUNAVAIL > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EPROCUNAVAIL
-# endif
-#endif
-#ifdef ENOLCK
-/*
-TRANS This is used by the file locking facilities; see
-TRANS @ref{File Locks}.  This error is never generated by @gnuhurdsystems{}, but
-TRANS it can result from an operation to an NFS server running another
-TRANS operating system. */
-    [ERR_REMAP (ENOLCK)] = N_("No locks available"),
-# if ENOLCK > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX ENOLCK
-# endif
-#endif
-#ifdef EFTYPE
-/*
-TRANS The file was the wrong type for the
-TRANS operation, or a data file had the wrong format.
-TRANS
-TRANS On some systems @code{chmod} returns this error if you try to set the
-TRANS sticky bit on a non-directory file; @pxref{Setting Permissions}. */
-    [ERR_REMAP (EFTYPE)] = N_("Inappropriate file type or format"),
-# if EFTYPE > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EFTYPE
-# endif
-#endif
-#ifdef EAUTH
-/* */
-    [ERR_REMAP (EAUTH)] = N_("Authentication error"),
-# if EAUTH > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EAUTH
-# endif
-#endif
-#ifdef ENEEDAUTH
-/* */
-    [ERR_REMAP (ENEEDAUTH)] = N_("Need authenticator"),
-# if ENEEDAUTH > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX ENEEDAUTH
-# endif
-#endif
-#ifdef ENOSYS
-/*
-TRANS This indicates that the function called is
-TRANS not implemented at all, either in the C library itself or in the
-TRANS operating system.  When you get this error, you can be sure that this
-TRANS particular function will always fail with @code{ENOSYS} unless you
-TRANS install a new version of the C library or the operating system. */
-    [ERR_REMAP (ENOSYS)] = N_("Function not implemented"),
-# if ENOSYS > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX ENOSYS
-# endif
-#endif
-#if defined (ENOTSUP) && ENOTSUP != EOPNOTSUPP
-/*
-TRANS A function returns this error when certain parameter
-TRANS values are valid, but the functionality they request is not available.
-TRANS This can mean that the function does not implement a particular command
-TRANS or option value or flag bit at all.  For functions that operate on some
-TRANS object given in a parameter, such as a file descriptor or a port, it
-TRANS might instead mean that only @emph{that specific object} (file
-TRANS descriptor, port, etc.) is unable to support the other parameters given;
-TRANS different file descriptors might support different ranges of parameter
-TRANS values.
-TRANS
-TRANS If the entire function is not available at all in the implementation,
-TRANS it returns @code{ENOSYS} instead. */
-    [ERR_REMAP (ENOTSUP)] = N_("Not supported"),
-# if ENOTSUP > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX ENOTSUP
-# endif
-#endif
-#ifdef EILSEQ
-/*
-TRANS While decoding a multibyte character the function came along an invalid
-TRANS or an incomplete sequence of bytes or the given wide character is invalid. */
-    [ERR_REMAP (EILSEQ)] = N_("Invalid or incomplete multibyte or wide character"),
-# if EILSEQ > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EILSEQ
-# endif
-#endif
-#ifdef EBACKGROUND
-/*
-TRANS On @gnuhurdsystems{}, servers supporting the @code{term} protocol return
-TRANS this error for certain operations when the caller is not in the
-TRANS foreground process group of the terminal.  Users do not usually see this
-TRANS error because functions such as @code{read} and @code{write} translate
-TRANS it into a @code{SIGTTIN} or @code{SIGTTOU} signal.  @xref{Job Control},
-TRANS for information on process groups and these signals. */
-    [ERR_REMAP (EBACKGROUND)] = N_("Inappropriate operation for background process"),
-# if EBACKGROUND > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EBACKGROUND
-# endif
-#endif
-#ifdef EDIED
-/*
-TRANS On @gnuhurdsystems{}, opening a file returns this error when the file is
-TRANS translated by a program and the translator program dies while starting
-TRANS up, before it has connected to the file. */
-    [ERR_REMAP (EDIED)] = N_("Translator died"),
-# if EDIED > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EDIED
-# endif
-#endif
-#ifdef ED
-/*
-TRANS The experienced user will know what is wrong.
-TRANS @c This error code is a joke.  Its perror text is part of the joke.
-TRANS @c Don't change it. */
-    [ERR_REMAP (ED)] = N_("?"),
-# if ED > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX ED
-# endif
-#endif
-#ifdef EGREGIOUS
-/*
-TRANS You did @strong{what}? */
-    [ERR_REMAP (EGREGIOUS)] = N_("You really blew it this time"),
-# if EGREGIOUS > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EGREGIOUS
-# endif
-#endif
-#ifdef EIEIO
-/*
-TRANS Go home and have a glass of warm, dairy-fresh milk.
-TRANS @c Okay.  Since you are dying to know, I'll tell you.
-TRANS @c This is a joke, obviously.  There is a children's song which begins,
-TRANS @c "Old McDonald had a farm, e-i-e-i-o."  Every time I see the (real)
-TRANS @c errno macro EIO, I think about that song.  Probably most of my
-TRANS @c compatriots who program on Unix do, too.  One of them must have stayed
-TRANS @c up a little too late one night and decided to add it to Hurd or Glibc.
-TRANS @c Whoever did it should be castigated, but it made me laugh.
-TRANS @c  --[hidden email]
-TRANS @c
-TRANS @c "bought the farm" means "died".  -jtobey
-TRANS @c
-TRANS @c Translators, please do not translate this litteraly, translate it into
-TRANS @c an idiomatic funny way of saying that the computer died. */
-    [ERR_REMAP (EIEIO)] = N_("Computer bought the farm"),
-# if EIEIO > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EIEIO
-# endif
-#endif
-#ifdef EGRATUITOUS
-/*
-TRANS This error code has no purpose. */
-    [ERR_REMAP (EGRATUITOUS)] = N_("Gratuitous error"),
-# if EGRATUITOUS > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EGRATUITOUS
-# endif
-#endif
-#ifdef EBADMSG
-/* */
-    [ERR_REMAP (EBADMSG)] = N_("Bad message"),
-# if EBADMSG > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EBADMSG
-# endif
-#endif
-#ifdef EIDRM
-/* */
-    [ERR_REMAP (EIDRM)] = N_("Identifier removed"),
-# if EIDRM > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EIDRM
-# endif
-#endif
-#ifdef EMULTIHOP
-/* */
-    [ERR_REMAP (EMULTIHOP)] = N_("Multihop attempted"),
-# if EMULTIHOP > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EMULTIHOP
-# endif
-#endif
-#ifdef ENODATA
-/* */
-    [ERR_REMAP (ENODATA)] = N_("No data available"),
-# if ENODATA > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX ENODATA
-# endif
-#endif
-#ifdef ENOLINK
-/* */
-    [ERR_REMAP (ENOLINK)] = N_("Link has been severed"),
-# if ENOLINK > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX ENOLINK
-# endif
-#endif
-#ifdef ENOMSG
-/* */
-    [ERR_REMAP (ENOMSG)] = N_("No message of desired type"),
-# if ENOMSG > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX ENOMSG
-# endif
-#endif
-#ifdef ENOSR
-/* */
-    [ERR_REMAP (ENOSR)] = N_("Out of streams resources"),
-# if ENOSR > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX ENOSR
-# endif
-#endif
-#ifdef ENOSTR
-/* */
-    [ERR_REMAP (ENOSTR)] = N_("Device not a stream"),
-# if ENOSTR > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX ENOSTR
-# endif
-#endif
-#ifdef EOVERFLOW
-/* */
-    [ERR_REMAP (EOVERFLOW)] = N_("Value too large for defined data type"),
-# if EOVERFLOW > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EOVERFLOW
-# endif
-#endif
-#ifdef EPROTO
-/* */
-    [ERR_REMAP (EPROTO)] = N_("Protocol error"),
-# if EPROTO > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EPROTO
-# endif
-#endif
-#ifdef ETIME
-/* */
-    [ERR_REMAP (ETIME)] = N_("Timer expired"),
-# if ETIME > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX ETIME
-# endif
-#endif
-#ifdef ECANCELED
-/*
-TRANS An asynchronous operation was canceled before it
-TRANS completed.  @xref{Asynchronous I/O}.  When you call @code{aio_cancel},
-TRANS the normal result is for the operations affected to complete with this
-TRANS error; @pxref{Cancel AIO Operations}. */
-    [ERR_REMAP (ECANCELED)] = N_("Operation canceled"),
-# if ECANCELED > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX ECANCELED
-# endif
-#endif
-#ifdef EOWNERDEAD
-/* */
-    [ERR_REMAP (EOWNERDEAD)] = N_("Owner died"),
-# if EOWNERDEAD > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EOWNERDEAD
-# endif
-#endif
-#ifdef ENOTRECOVERABLE
-/* */
-    [ERR_REMAP (ENOTRECOVERABLE)] = N_("State not recoverable"),
-# if ENOTRECOVERABLE > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX ENOTRECOVERABLE
-# endif
-#endif
-#ifdef ERESTART
-/* */
-    [ERR_REMAP (ERESTART)] = N_("Interrupted system call should be restarted"),
-# if ERESTART > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX ERESTART
-# endif
-#endif
-#ifdef ECHRNG
-/* */
-    [ERR_REMAP (ECHRNG)] = N_("Channel number out of range"),
-# if ECHRNG > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX ECHRNG
-# endif
-#endif
-#ifdef EL2NSYNC
-/* */
-    [ERR_REMAP (EL2NSYNC)] = N_("Level 2 not synchronized"),
-# if EL2NSYNC > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EL2NSYNC
-# endif
-#endif
-#ifdef EL3HLT
-/* */
-    [ERR_REMAP (EL3HLT)] = N_("Level 3 halted"),
-# if EL3HLT > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EL3HLT
-# endif
-#endif
-#ifdef EL3RST
-/* */
-    [ERR_REMAP (EL3RST)] = N_("Level 3 reset"),
-# if EL3RST > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EL3RST
-# endif
-#endif
-#ifdef ELNRNG
-/* */
-    [ERR_REMAP (ELNRNG)] = N_("Link number out of range"),
-# if ELNRNG > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX ELNRNG
-# endif
-#endif
-#ifdef EUNATCH
-/* */
-    [ERR_REMAP (EUNATCH)] = N_("Protocol driver not attached"),
-# if EUNATCH > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EUNATCH
-# endif
-#endif
-#ifdef ENOCSI
-/* */
-    [ERR_REMAP (ENOCSI)] = N_("No CSI structure available"),
-# if ENOCSI > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX ENOCSI
-# endif
-#endif
-#ifdef EL2HLT
-/* */
-    [ERR_REMAP (EL2HLT)] = N_("Level 2 halted"),
-# if EL2HLT > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EL2HLT
-# endif
-#endif
-#ifdef EBADE
-/* */
-    [ERR_REMAP (EBADE)] = N_("Invalid exchange"),
-# if EBADE > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EBADE
-# endif
-#endif
-#ifdef EBADR
-/* */
-    [ERR_REMAP (EBADR)] = N_("Invalid request descriptor"),
-# if EBADR > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EBADR
-# endif
-#endif
-#ifdef EXFULL
-/* */
-    [ERR_REMAP (EXFULL)] = N_("Exchange full"),
-# if EXFULL > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EXFULL
-# endif
-#endif
-#ifdef ENOANO
-/* */
-    [ERR_REMAP (ENOANO)] = N_("No anode"),
-# if ENOANO > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX ENOANO
-# endif
-#endif
-#ifdef EBADRQC
-/* */
-    [ERR_REMAP (EBADRQC)] = N_("Invalid request code"),
-# if EBADRQC > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EBADRQC
-# endif
-#endif
-#ifdef EBADSLT
-/* */
-    [ERR_REMAP (EBADSLT)] = N_("Invalid slot"),
-# if EBADSLT > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EBADSLT
-# endif
-#endif
-#if defined (EDEADLOCK) && EDEADLOCK != EDEADLK
-/* */
-    [ERR_REMAP (EDEADLOCK)] = N_("File locking deadlock error"),
-# if EDEADLOCK > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EDEADLOCK
-# endif
-#endif
-#ifdef EBFONT
-/* */
-    [ERR_REMAP (EBFONT)] = N_("Bad font file format"),
-# if EBFONT > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EBFONT
-# endif
-#endif
-#ifdef ENONET
-/* */
-    [ERR_REMAP (ENONET)] = N_("Machine is not on the network"),
-# if ENONET > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX ENONET
-# endif
-#endif
-#ifdef ENOPKG
-/* */
-    [ERR_REMAP (ENOPKG)] = N_("Package not installed"),
-# if ENOPKG > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX ENOPKG
-# endif
-#endif
-#ifdef EADV
-/* */
-    [ERR_REMAP (EADV)] = N_("Advertise error"),
-# if EADV > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EADV
-# endif
-#endif
-#ifdef ESRMNT
-/* */
-    [ERR_REMAP (ESRMNT)] = N_("Srmount error"),
-# if ESRMNT > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX ESRMNT
-# endif
-#endif
-#ifdef ECOMM
-/* */
-    [ERR_REMAP (ECOMM)] = N_("Communication error on send"),
-# if ECOMM > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX ECOMM
-# endif
-#endif
-#ifdef EDOTDOT
-/* */
-    [ERR_REMAP (EDOTDOT)] = N_("RFS specific error"),
-# if EDOTDOT > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EDOTDOT
-# endif
-#endif
-#ifdef ENOTUNIQ
-/* */
-    [ERR_REMAP (ENOTUNIQ)] = N_("Name not unique on network"),
-# if ENOTUNIQ > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX ENOTUNIQ
-# endif
-#endif
-#ifdef EBADFD
-/* */
-    [ERR_REMAP (EBADFD)] = N_("File descriptor in bad state"),
-# if EBADFD > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EBADFD
-# endif
-#endif
-#ifdef EREMCHG
-/* */
-    [ERR_REMAP (EREMCHG)] = N_("Remote address changed"),
-# if EREMCHG > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EREMCHG
-# endif
-#endif
-#ifdef ELIBACC
-/* */
-    [ERR_REMAP (ELIBACC)] = N_("Can not access a needed shared library"),
-# if ELIBACC > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX ELIBACC
-# endif
-#endif
-#ifdef ELIBBAD
-/* */
-    [ERR_REMAP (ELIBBAD)] = N_("Accessing a corrupted shared library"),
-# if ELIBBAD > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX ELIBBAD
-# endif
-#endif
-#ifdef ELIBSCN
-/* */
-    [ERR_REMAP (ELIBSCN)] = N_(".lib section in a.out corrupted"),
-# if ELIBSCN > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX ELIBSCN
-# endif
-#endif
-#ifdef ELIBMAX
-/* */
-    [ERR_REMAP (ELIBMAX)] = N_("Attempting to link in too many shared libraries"),
-# if ELIBMAX > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX ELIBMAX
-# endif
-#endif
-#ifdef ELIBEXEC
-/* */
-    [ERR_REMAP (ELIBEXEC)] = N_("Cannot exec a shared library directly"),
-# if ELIBEXEC > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX ELIBEXEC
-# endif
-#endif
-#ifdef ESTRPIPE
-/* */
-    [ERR_REMAP (ESTRPIPE)] = N_("Streams pipe error"),
-# if ESTRPIPE > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX ESTRPIPE
-# endif
-#endif
-#ifdef EUCLEAN
-/* */
-    [ERR_REMAP (EUCLEAN)] = N_("Structure needs cleaning"),
-# if EUCLEAN > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EUCLEAN
-# endif
-#endif
-#ifdef ENOTNAM
-/* */
-    [ERR_REMAP (ENOTNAM)] = N_("Not a XENIX named type file"),
-# if ENOTNAM > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX ENOTNAM
-# endif
-#endif
-#ifdef ENAVAIL
-/* */
-    [ERR_REMAP (ENAVAIL)] = N_("No XENIX semaphores available"),
-# if ENAVAIL > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX ENAVAIL
-# endif
-#endif
-#ifdef EISNAM
-/* */
-    [ERR_REMAP (EISNAM)] = N_("Is a named type file"),
-# if EISNAM > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EISNAM
-# endif
-#endif
-#ifdef EREMOTEIO
-/* */
-    [ERR_REMAP (EREMOTEIO)] = N_("Remote I/O error"),
-# if EREMOTEIO > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EREMOTEIO
-# endif
-#endif
-#ifdef ENOMEDIUM
-/* */
-    [ERR_REMAP (ENOMEDIUM)] = N_("No medium found"),
-# if ENOMEDIUM > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX ENOMEDIUM
-# endif
-#endif
-#ifdef EMEDIUMTYPE
-/* */
-    [ERR_REMAP (EMEDIUMTYPE)] = N_("Wrong medium type"),
-# if EMEDIUMTYPE > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EMEDIUMTYPE
-# endif
-#endif
-#ifdef ENOKEY
-/* */
-    [ERR_REMAP (ENOKEY)] = N_("Required key not available"),
-# if ENOKEY > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX ENOKEY
-# endif
-#endif
-#ifdef EKEYEXPIRED
-/* */
-    [ERR_REMAP (EKEYEXPIRED)] = N_("Key has expired"),
-# if EKEYEXPIRED > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EKEYEXPIRED
-# endif
-#endif
-#ifdef EKEYREVOKED
-/* */
-    [ERR_REMAP (EKEYREVOKED)] = N_("Key has been revoked"),
-# if EKEYREVOKED > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EKEYREVOKED
-# endif
-#endif
-#ifdef EKEYREJECTED
-/* */
-    [ERR_REMAP (EKEYREJECTED)] = N_("Key was rejected by service"),
-# if EKEYREJECTED > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EKEYREJECTED
-# endif
-#endif
-#ifdef ERFKILL
-/* */
-    [ERR_REMAP (ERFKILL)] = N_("Operation not possible due to RF-kill"),
-# if ERFKILL > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX ERFKILL
-# endif
-#endif
-#ifdef EHWPOISON
-/* */
-    [ERR_REMAP (EHWPOISON)] = N_("Memory page has hardware error"),
-# if EHWPOISON > ERR_MAX
-# undef ERR_MAX
-# define ERR_MAX EHWPOISON
-# endif
-#endif
-  };
-
-#define NERR \
-  (sizeof _sys_errlist_internal / sizeof _sys_errlist_internal [0])
-const int _sys_nerr_internal = NERR;
-
-#if IS_IN (libc) && !defined ERRLIST_NO_COMPAT
-# include <errlist-compat.c>
-#endif
-
-#ifdef EMIT_ERR_MAX
-void dummy (void)
-{ asm volatile (" @@@ %0 @@@ " : : "i" (ERR_REMAP (ERR_MAX))); }
-#endif
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
+#endif
+_S(ERR_MAP(0), N_("Success"))
+#ifdef EPERM
+_S(ERR_MAP(EPERM), N_("Operation not permitted"))
+#endif
+#ifdef ENOENT
+_S(ERR_MAP(ENOENT), N_("No such file or directory"))
+#endif
+#ifdef ESRCH
+_S(ERR_MAP(ESRCH), N_("No such process"))
+#endif
+#ifdef EINTR
+_S(ERR_MAP(EINTR), N_("Interrupted system call"))
+#endif
+#ifdef EIO
+_S(ERR_MAP(EIO), N_("Input/output error"))
+#endif
+#ifdef ENXIO
+_S(ERR_MAP(ENXIO), N_("No such device or address"))
+#endif
+#ifdef E2BIG
+_S(ERR_MAP(E2BIG), N_("Argument list too long"))
+#endif
+#ifdef ENOEXEC
+_S(ERR_MAP(ENOEXEC), N_("Exec format error"))
+#endif
+#ifdef EBADF
+_S(ERR_MAP(EBADF), N_("Bad file descriptor"))
+#endif
+#ifdef ECHILD
+_S(ERR_MAP(ECHILD), N_("No child processes"))
+#endif
+#ifdef EDEADLK
+_S(ERR_MAP(EDEADLK), N_("Resource deadlock avoided"))
+#endif
+#ifdef ENOMEM
+_S(ERR_MAP(ENOMEM), N_("Cannot allocate memory"))
+#endif
+#ifdef EACCES
+_S(ERR_MAP(EACCES), N_("Permission denied"))
+#endif
+#ifdef EFAULT
+_S(ERR_MAP(EFAULT), N_("Bad address"))
+#endif
+#ifdef ENOTBLK
+_S(ERR_MAP(ENOTBLK), N_("Block device required"))
+#endif
+#ifdef EBUSY
+_S(ERR_MAP(EBUSY), N_("Device or resource busy"))
+#endif
+#ifdef EEXIST
+_S(ERR_MAP(EEXIST), N_("File exists"))
+#endif
+#ifdef EXDEV
+_S(ERR_MAP(EXDEV), N_("Invalid cross-device link"))
+#endif
+#ifdef ENODEV
+_S(ERR_MAP(ENODEV), N_("No such device"))
+#endif
+#ifdef ENOTDIR
+_S(ERR_MAP(ENOTDIR), N_("Not a directory"))
+#endif
+#ifdef EISDIR
+_S(ERR_MAP(EISDIR), N_("Is a directory"))
+#endif
+#ifdef EINVAL
+_S(ERR_MAP(EINVAL), N_("Invalid argument"))
+#endif
+#ifdef EMFILE
+_S(ERR_MAP(EMFILE), N_("Too many open files"))
+#endif
+#ifdef ENFILE
+_S(ERR_MAP(ENFILE), N_("Too many open files in system"))
+#endif
+#ifdef ENOTTY
+_S(ERR_MAP(ENOTTY), N_("Inappropriate ioctl for device"))
+#endif
+#ifdef ETXTBSY
+_S(ERR_MAP(ETXTBSY), N_("Text file busy"))
+#endif
+#ifdef EFBIG
+_S(ERR_MAP(EFBIG), N_("File too large"))
+#endif
+#ifdef ENOSPC
+_S(ERR_MAP(ENOSPC), N_("No space left on device"))
+#endif
+#ifdef ESPIPE
+_S(ERR_MAP(ESPIPE), N_("Illegal seek"))
+#endif
+#ifdef EROFS
+_S(ERR_MAP(EROFS), N_("Read-only file system"))
+#endif
+#ifdef EMLINK
+_S(ERR_MAP(EMLINK), N_("Too many links"))
+#endif
+#ifdef EPIPE
+_S(ERR_MAP(EPIPE), N_("Broken pipe"))
+#endif
+#ifdef EDOM
+_S(ERR_MAP(EDOM), N_("Numerical argument out of domain"))
+#endif
+#ifdef ERANGE
+_S(ERR_MAP(ERANGE), N_("Numerical result out of range"))
+#endif
+#ifdef EAGAIN
+_S(ERR_MAP(EAGAIN), N_("Resource temporarily unavailable"))
+#endif
+#ifdef EINPROGRESS
+_S(ERR_MAP(EINPROGRESS), N_("Operation now in progress"))
+#endif
+#ifdef EALREADY
+_S(ERR_MAP(EALREADY), N_("Operation already in progress"))
+#endif
+#ifdef ENOTSOCK
+_S(ERR_MAP(ENOTSOCK), N_("Socket operation on non-socket"))
+#endif
+#ifdef EMSGSIZE
+_S(ERR_MAP(EMSGSIZE), N_("Message too long"))
+#endif
+#ifdef EPROTOTYPE
+_S(ERR_MAP(EPROTOTYPE), N_("Protocol wrong type for socket"))
+#endif
+#ifdef ENOPROTOOPT
+_S(ERR_MAP(ENOPROTOOPT), N_("Protocol not available"))
+#endif
+#ifdef EPROTONOSUPPORT
+_S(ERR_MAP(EPROTONOSUPPORT), N_("Protocol not supported"))
+#endif
+#ifdef ESOCKTNOSUPPORT
+_S(ERR_MAP(ESOCKTNOSUPPORT), N_("Socket type not supported"))
+#endif
+#ifdef EOPNOTSUPP
+_S(ERR_MAP(EOPNOTSUPP), N_("Operation not supported"))
+#endif
+#ifdef EPFNOSUPPORT
+_S(ERR_MAP(EPFNOSUPPORT), N_("Protocol family not supported"))
+#endif
+#ifdef EAFNOSUPPORT
+_S(ERR_MAP(EAFNOSUPPORT), N_("Address family not supported by protocol"))
+#endif
+#ifdef EADDRINUSE
+_S(ERR_MAP(EADDRINUSE), N_("Address already in use"))
+#endif
+#ifdef EADDRNOTAVAIL
+_S(ERR_MAP(EADDRNOTAVAIL), N_("Cannot assign requested address"))
+#endif
+#ifdef ENETDOWN
+_S(ERR_MAP(ENETDOWN), N_("Network is down"))
+#endif
+#ifdef ENETUNREACH
+_S(ERR_MAP(ENETUNREACH), N_("Network is unreachable"))
+#endif
+#ifdef ENETRESET
+_S(ERR_MAP(ENETRESET), N_("Network dropped connection on reset"))
+#endif
+#ifdef ECONNABORTED
+_S(ERR_MAP(ECONNABORTED), N_("Software caused connection abort"))
+#endif
+#ifdef ECONNRESET
+_S(ERR_MAP(ECONNRESET), N_("Connection reset by peer"))
+#endif
+#ifdef ENOBUFS
+_S(ERR_MAP(ENOBUFS), N_("No buffer space available"))
+#endif
+#ifdef EISCONN
+_S(ERR_MAP(EISCONN), N_("Transport endpoint is already connected"))
+#endif
+#ifdef ENOTCONN
+_S(ERR_MAP(ENOTCONN), N_("Transport endpoint is not connected"))
+#endif
+#ifdef EDESTADDRREQ
+_S(ERR_MAP(EDESTADDRREQ), N_("Destination address required"))
+#endif
+#ifdef ESHUTDOWN
+_S(ERR_MAP(ESHUTDOWN), N_("Cannot send after transport endpoint shutdown"))
+#endif
+#ifdef ETOOMANYREFS
+_S(ERR_MAP(ETOOMANYREFS), N_("Too many references: cannot splice"))
+#endif
+#ifdef ETIMEDOUT
+_S(ERR_MAP(ETIMEDOUT), N_("Connection timed out"))
+#endif
+#ifdef ECONNREFUSED
+_S(ERR_MAP(ECONNREFUSED), N_("Connection refused"))
+#endif
+#ifdef ELOOP
+_S(ERR_MAP(ELOOP), N_("Too many levels of symbolic links"))
+#endif
+#ifdef ENAMETOOLONG
+_S(ERR_MAP(ENAMETOOLONG), N_("File name too long"))
+#endif
+#ifdef EHOSTDOWN
+_S(ERR_MAP(EHOSTDOWN), N_("Host is down"))
+#endif
+#ifdef EHOSTUNREACH
+_S(ERR_MAP(EHOSTUNREACH), N_("No route to host"))
+#endif
+#ifdef ENOTEMPTY
+_S(ERR_MAP(ENOTEMPTY), N_("Directory not empty"))
+#endif
+#ifdef EUSERS
+_S(ERR_MAP(EUSERS), N_("Too many users"))
+#endif
+#ifdef EDQUOT
+_S(ERR_MAP(EDQUOT), N_("Disk quota exceeded"))
+#endif
+#ifdef ESTALE
+_S(ERR_MAP(ESTALE), N_("Stale file handle"))
+#endif
+#ifdef EREMOTE
+_S(ERR_MAP(EREMOTE), N_("Object is remote"))
+#endif
+#ifdef ENOLCK
+_S(ERR_MAP(ENOLCK), N_("No locks available"))
+#endif
+#ifdef ENOSYS
+_S(ERR_MAP(ENOSYS), N_("Function not implemented"))
+#endif
+#ifdef EILSEQ
+_S(ERR_MAP(EILSEQ), N_("Invalid or incomplete multibyte or wide character"))
+#endif
+#ifdef EBADMSG
+_S(ERR_MAP(EBADMSG), N_("Bad message"))
+#endif
+#ifdef EIDRM
+_S(ERR_MAP(EIDRM), N_("Identifier removed"))
+#endif
+#ifdef EMULTIHOP
+_S(ERR_MAP(EMULTIHOP), N_("Multihop attempted"))
+#endif
+#ifdef ENODATA
+_S(ERR_MAP(ENODATA), N_("No data available"))
+#endif
+#ifdef ENOLINK
+_S(ERR_MAP(ENOLINK), N_("Link has been severed"))
+#endif
+#ifdef ENOMSG
+_S(ERR_MAP(ENOMSG), N_("No message of desired type"))
+#endif
+#ifdef ENOSR
+_S(ERR_MAP(ENOSR), N_("Out of streams resources"))
+#endif
+#ifdef ENOSTR
+_S(ERR_MAP(ENOSTR), N_("Device not a stream"))
+#endif
+#ifdef EOVERFLOW
+_S(ERR_MAP(EOVERFLOW), N_("Value too large for defined data type"))
+#endif
+#ifdef EPROTO
+_S(ERR_MAP(EPROTO), N_("Protocol error"))
+#endif
+#ifdef ETIME
+_S(ERR_MAP(ETIME), N_("Timer expired"))
+#endif
+#ifdef ECANCELED
+_S(ERR_MAP(ECANCELED), N_("Operation canceled"))
+#endif
+#ifdef EOWNERDEAD
+_S(ERR_MAP(EOWNERDEAD), N_("Owner died"))
+#endif
+#ifdef ENOTRECOVERABLE
+_S(ERR_MAP(ENOTRECOVERABLE), N_("State not recoverable"))
+#endif
+#ifdef ERESTART
+_S(ERR_MAP(ERESTART), N_("Interrupted system call should be restarted"))
+#endif
+#ifdef ECHRNG
+_S(ERR_MAP(ECHRNG), N_("Channel number out of range"))
+#endif
+#ifdef EL2NSYNC
+_S(ERR_MAP(EL2NSYNC), N_("Level 2 not synchronized"))
+#endif
+#ifdef EL3HLT
+_S(ERR_MAP(EL3HLT), N_("Level 3 halted"))
+#endif
+#ifdef EL3RST
+_S(ERR_MAP(EL3RST), N_("Level 3 reset"))
+#endif
+#ifdef ELNRNG
+_S(ERR_MAP(ELNRNG), N_("Link number out of range"))
+#endif
+#ifdef EUNATCH
+_S(ERR_MAP(EUNATCH), N_("Protocol driver not attached"))
+#endif
+#ifdef ENOCSI
+_S(ERR_MAP(ENOCSI), N_("No CSI structure available"))
+#endif
+#ifdef EL2HLT
+_S(ERR_MAP(EL2HLT), N_("Level 2 halted"))
+#endif
+#ifdef EBADE
+_S(ERR_MAP(EBADE), N_("Invalid exchange"))
+#endif
+#ifdef EBADR
+_S(ERR_MAP(EBADR), N_("Invalid request descriptor"))
+#endif
+#ifdef EXFULL
+_S(ERR_MAP(EXFULL), N_("Exchange full"))
+#endif
+#ifdef ENOANO
+_S(ERR_MAP(ENOANO), N_("No anode"))
+#endif
+#ifdef EBADRQC
+_S(ERR_MAP(EBADRQC), N_("Invalid request code"))
+#endif
+#ifdef EBADSLT
+_S(ERR_MAP(EBADSLT), N_("Invalid slot"))
+#endif
+#ifdef EBFONT
+_S(ERR_MAP(EBFONT), N_("Bad font file format"))
+#endif
+#ifdef ENONET
+_S(ERR_MAP(ENONET), N_("Machine is not on the network"))
+#endif
+#ifdef ENOPKG
+_S(ERR_MAP(ENOPKG), N_("Package not installed"))
+#endif
+#ifdef EADV
+_S(ERR_MAP(EADV), N_("Advertise error"))
+#endif
+#ifdef ESRMNT
+_S(ERR_MAP(ESRMNT), N_("Srmount error"))
+#endif
+#ifdef ECOMM
+_S(ERR_MAP(ECOMM), N_("Communication error on send"))
+#endif
+#ifdef EDOTDOT
+_S(ERR_MAP(EDOTDOT), N_("RFS specific error"))
+#endif
+#ifdef ENOTUNIQ
+_S(ERR_MAP(ENOTUNIQ), N_("Name not unique on network"))
+#endif
+#ifdef EBADFD
+_S(ERR_MAP(EBADFD), N_("File descriptor in bad state"))
+#endif
+#ifdef EREMCHG
+_S(ERR_MAP(EREMCHG), N_("Remote address changed"))
+#endif
+#ifdef ELIBACC
+_S(ERR_MAP(ELIBACC), N_("Can not access a needed shared library"))
+#endif
+#ifdef ELIBBAD
+_S(ERR_MAP(ELIBBAD), N_("Accessing a corrupted shared library"))
+#endif
+#ifdef ELIBSCN
+_S(ERR_MAP(ELIBSCN), N_(".lib section in a.out corrupted"))
+#endif
+#ifdef ELIBMAX
+_S(ERR_MAP(ELIBMAX), N_("Attempting to link in too many shared libraries"))
+#endif
+#ifdef ELIBEXEC
+_S(ERR_MAP(ELIBEXEC), N_("Cannot exec a shared library directly"))
+#endif
+#ifdef ESTRPIPE
+_S(ERR_MAP(ESTRPIPE), N_("Streams pipe error"))
+#endif
+#ifdef EUCLEAN
+_S(ERR_MAP(EUCLEAN), N_("Structure needs cleaning"))
+#endif
+#ifdef ENOTNAM
+_S(ERR_MAP(ENOTNAM), N_("Not a XENIX named type file"))
+#endif
+#ifdef ENAVAIL
+_S(ERR_MAP(ENAVAIL), N_("No XENIX semaphores available"))
+#endif
+#ifdef EISNAM
+_S(ERR_MAP(EISNAM), N_("Is a named type file"))
+#endif
+#ifdef EREMOTEIO
+_S(ERR_MAP(EREMOTEIO), N_("Remote I/O error"))
+#endif
+#ifdef ENOMEDIUM
+_S(ERR_MAP(ENOMEDIUM), N_("No medium found"))
+#endif
+#ifdef EMEDIUMTYPE
+_S(ERR_MAP(EMEDIUMTYPE), N_("Wrong medium type"))
+#endif
+#ifdef ENOKEY
+_S(ERR_MAP(ENOKEY), N_("Required key not available"))
+#endif
+#ifdef EKEYEXPIRED
+_S(ERR_MAP(EKEYEXPIRED), N_("Key has expired"))
+#endif
+#ifdef EKEYREVOKED
+_S(ERR_MAP(EKEYREVOKED), N_("Key has been revoked"))
+#endif
+#ifdef EKEYREJECTED
+_S(ERR_MAP(EKEYREJECTED), N_("Key was rejected by service"))
+#endif
+#ifdef ERFKILL
+_S(ERR_MAP(ERFKILL), N_("Operation not possible due to RF-kill"))
+#endif
+#ifdef EHWPOISON
+_S(ERR_MAP(EHWPOISON), N_("Memory page has hardware error"))
+#endif
+#ifdef EBADRPC
+_S(ERR_MAP(EBADRPC), N_("RPC struct is bad"))
+#endif
+#ifdef EFTYPE
+_S(ERR_MAP(EFTYPE), N_("Inappropriate file type or format"))
+#endif
+#ifdef EPROCUNAVAIL
+_S(ERR_MAP(EPROCUNAVAIL), N_("RPC bad procedure for program"))
+#endif
+#ifdef EAUTH
+_S(ERR_MAP(EAUTH), N_("Authentication error"))
+#endif
+#ifdef EDIED
+_S(ERR_MAP(EDIED), N_("Translator died"))
+#endif
+#ifdef ERPCMISMATCH
+_S(ERR_MAP(ERPCMISMATCH), N_("RPC version wrong"))
+#endif
+#ifdef EGREGIOUS
+_S(ERR_MAP(EGREGIOUS), N_("You really blew it this time"))
+#endif
+#ifdef EPROCLIM
+_S(ERR_MAP(EPROCLIM), N_("Too many processes"))
+#endif
+#ifdef EGRATUITOUS
+_S(ERR_MAP(EGRATUITOUS), N_("Gratuitous error"))
+#endif
+#if defined (ENOTSUP) && ENOTSUP != EOPNOTSUPP
+_S(ERR_MAP(ENOTSUP), N_("Not supported"))
+#endif
+#ifdef EPROGMISMATCH
+_S(ERR_MAP(EPROGMISMATCH), N_("RPC program version wrong"))
+#endif
+#ifdef EBACKGROUND
+_S(ERR_MAP(EBACKGROUND), N_("Inappropriate operation for background process"))
+#endif
+#ifdef EIEIO
+_S(ERR_MAP(EIEIO), N_("Computer bought the farm"))
+#endif
+#if defined (EWOULDBLOCK) && EWOULDBLOCK != EAGAIN
+_S(ERR_MAP(EWOULDBLOCK), N_("Operation would block"))
+#endif
+#ifdef ENEEDAUTH
+_S(ERR_MAP(ENEEDAUTH), N_("Need authenticator"))
+#endif
+#ifdef ED
+_S(ERR_MAP(ED), N_("?"))
+#endif
+#ifdef EPROGUNAVAIL
+_S(ERR_MAP(EPROGUNAVAIL), N_("RPC program not available"))
+#endif
diff --git a/sysdeps/mach/hurd/err_hurd.sub b/sysdeps/mach/hurd/err_hurd.sub
index 4a4dee3aa3..3e9b37e155 100644
--- a/sysdeps/mach/hurd/err_hurd.sub
+++ b/sysdeps/mach/hurd/err_hurd.sub
@@ -1,12 +1,11 @@
 /* This file defines the Mach error system for Hurd server errors.  */
 
 #include <errno.h>
-
-extern const char *const _hurd_errlist[];
+#include <stdio.h>  /* For _sys_errlist_internal  */
 
 /* Omit `const' because we are included with `static'
    defined to `static const'.  */
 static struct error_subsystem err_hurd_sub[] =
   {
-    { "(os/hurd)", _HURD_ERRNOS, (const char *const *) _hurd_errlist },
+    { "(os/hurd)", _HURD_ERRNOS, _sys_errlist_internal },
   };
diff --git a/sysdeps/mach/hurd/errlist.c b/sysdeps/mach/hurd/errlist.c
index 451e8fa1eb..be752f02b9 100644
--- a/sysdeps/mach/hurd/errlist.c
+++ b/sysdeps/mach/hurd/errlist.c
@@ -15,14 +15,7 @@
    License along with the GNU C Library; if not, see
    <https://www.gnu.org/licenses/>.  */
 
-/* sys_errlist cannot have Unix semantics on the Hurd, so it is easier just
-   to rename it.  We also need to remap error codes to array indices by
-   taking their subcode. */
-#define _sys_errlist_internal _hurd_errlist
-#define _sys_nerr_internal _hurd_nerr
-#define ERRLIST_NO_COMPAT 1
-
 #include <mach/error.h>
-#define ERR_REMAP(n) (err_get_code (n))
 
-#include <sysdeps/gnu/errlist.c>
+#define ERR_MAP(value) err_get_code (value)
+#include <stdio-common/errlist.c>
diff --git a/sysdeps/unix/sysv/linux/Versions b/sysdeps/unix/sysv/linux/Versions
index 9a58dda9f2..c35f783e2a 100644
--- a/sysdeps/unix/sysv/linux/Versions
+++ b/sysdeps/unix/sysv/linux/Versions
@@ -1,9 +1,4 @@
 libc {
-  # The comment lines with "#errlist-compat" are magic; see errlist-compat.awk.
-  # When you get an error from errlist-compat.awk, you need to add a new
-  # version here.  Don't do this blindly, since this means changing the ABI
-  # for all GNU/Linux configurations.
-
   GLIBC_2.0 {
     # functions used in inline functions or macros
     __cmsg_nxthdr;
@@ -56,7 +51,6 @@ libc {
     # u*
     umount; uselib;
 
-    #errlist-compat 123
     _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
   }
   GLIBC_2.1 {
@@ -84,7 +78,6 @@ libc {
     # u*
     umount2;
 
-    #errlist-compat 125
     _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
   }
   GLIBC_2.2 {
@@ -102,7 +95,6 @@ libc {
     # r*
     readahead;
 
-    #errlist-compat 126
     _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
   }
   GLIBC_2.3.2 {
@@ -120,7 +112,6 @@ libc {
 
     unshare;
 
-    #errlist-compat 132
     _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
   }
   GLIBC_2.5 {
@@ -142,7 +133,6 @@ libc {
     fallocate;
   }
   GLIBC_2.12 {
-    #errlist-compat 135
     _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
 
     ntp_gettimex;
diff --git a/sysdeps/unix/sysv/linux/alpha/Versions b/sysdeps/unix/sysv/linux/alpha/Versions
index 3b7971c2a3..b90d5f2e5a 100644
--- a/sysdeps/unix/sysv/linux/alpha/Versions
+++ b/sysdeps/unix/sysv/linux/alpha/Versions
@@ -1,12 +1,5 @@
 libc {
-  # The comment lines with "#errlist-compat" are magic; see
-  # sysdeps/gnu/errlist-compat.awk.
-  # When you get an error from errlist-compat.awk, you need to add a new
-  # version here.  Don't do this blindly, since this means changing the ABI
-  # for all GNU/Linux configurations.
-
   GLIBC_2.0 {
-    #errlist-compat 131
     _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
 
     # Unfortunately in wider use.
@@ -33,7 +26,6 @@ libc {
     pciconfig_read; pciconfig_write; sethae;
   }
   GLIBC_2.1 {
-    #errlist-compat 131
     _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
 
     # Linux/Alpha 64-bit timeval functions.
@@ -70,19 +62,15 @@ libc {
     wordexp;
   }
   GLIBC_2.3 {
-    #errlist-compat 132
     _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
   }
   GLIBC_2.4 {
-    #errlist-compat 138
     _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
   }
   GLIBC_2.12 {
-    #errlist-compat 139
     _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
   }
   GLIBC_2.16 {
-    #errlist-compat 140
     _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
   }
   GLIBC_2.27 {
diff --git a/sysdeps/unix/sysv/linux/alpha/errlist-compat.c b/sysdeps/unix/sysv/linux/alpha/errlist-compat.c
new file mode 100644
index 0000000000..709807aa6b
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/alpha/errlist-compat.c
@@ -0,0 +1,43 @@
+/* Linux sys_errlist compat symbol definitions.  Alpha version.
+   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 <errlist-compat.h>
+
+#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
+DEFINE_COMPAT_ERRLIST (131, GLIBC_2_0)
+#endif
+
+#if SHLIB_COMPAT (libc, GLIBC_2_1, GLIBC_2_3)
+DEFINE_COMPAT_ERRLIST (131, GLIBC_2_1)
+#endif
+
+#if SHLIB_COMPAT (libc, GLIBC_2_3, GLIBC_2_4)
+DEFINE_COMPAT_ERRLIST (132, GLIBC_2_3)
+#endif
+
+#if SHLIB_COMPAT (libc, GLIBC_2_4, GLIBC_2_12)
+DEFINE_COMPAT_ERRLIST (138, GLIBC_2_4)
+#endif
+
+#if SHLIB_COMPAT (libc, GLIBC_2_12, GLIBC_2_16)
+DEFINE_COMPAT_ERRLIST (139, GLIBC_2_12)
+#endif
+
+#if SHLIB_COMPAT (libc, GLIBC_2_16, GLIBC_2_32)
+DEFINE_COMPAT_ERRLIST (140, GLIBC_2_16)
+#endif
diff --git a/sysdeps/unix/sysv/linux/bits/sys_errlist.h b/sysdeps/unix/sysv/linux/errlist-compat.c
similarity index 56%
rename from sysdeps/unix/sysv/linux/bits/sys_errlist.h
rename to sysdeps/unix/sysv/linux/errlist-compat.c
index d6f5fa0a5e..c4d79b70aa 100644
--- a/sysdeps/unix/sysv/linux/bits/sys_errlist.h
+++ b/sysdeps/unix/sysv/linux/errlist-compat.c
@@ -1,5 +1,5 @@
-/* Declare sys_errlist and sys_nerr, or don't.  Compatibility (do) version.
-   Copyright (C) 2002-2020 Free Software Foundation, Inc.
+/* Linux sys_errlist compat symbol definitions.  Generic version.
+   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
@@ -16,17 +16,24 @@
    License along with the GNU C Library; if not, see
    <https://www.gnu.org/licenses/>.  */
 
-#ifndef _STDIO_H
-# error "Never include <bits/sys_errlist.h> directly; use <stdio.h> instead."
+#include <errlist-compat.h>
+
+#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
+DEFINE_COMPAT_ERRLIST (123, GLIBC_2_0)
 #endif
 
-/* sys_errlist and sys_nerr are deprecated.  Use strerror instead.  */
+#if SHLIB_COMPAT (libc, GLIBC_2_1, GLIBC_2_3)
+DEFINE_COMPAT_ERRLIST (125, GLIBC_2_1)
+#endif
 
-#ifdef  __USE_MISC
-extern int sys_nerr;
-extern const char *const sys_errlist[];
+#if SHLIB_COMPAT (libc, GLIBC_2_3, GLIBC_2_4)
+DEFINE_COMPAT_ERRLIST (126, GLIBC_2_3)
 #endif
-#ifdef  __USE_GNU
-extern int _sys_nerr;
-extern const char *const _sys_errlist[];
+
+#if SHLIB_COMPAT (libc, GLIBC_2_4, GLIBC_2_12)
+DEFINE_COMPAT_ERRLIST (132, GLIBC_2_4)
+#endif
+
+#if SHLIB_COMPAT (libc, GLIBC_2_12, GLIBC_2_32)
+DEFINE_COMPAT_ERRLIST (135, GLIBC_2_12)
 #endif
diff --git a/sysdeps/unix/sysv/linux/errlist-compat.h b/sysdeps/unix/sysv/linux/errlist-compat.h
new file mode 100644
index 0000000000..edd35fd4ed
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/errlist-compat.h
@@ -0,0 +1,43 @@
+/* Linux sys_errlist compatibility macro definitions.
+   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/>.  */
+
+#ifndef _ERRLIST_COMPAT_H
+#define _ERRLIST_COMPAT_H
+
+#include <shlib-compat.h>
+
+/* Define new compat symbols for symbols  _sys_errlist, sys_errlist,
+   _sys_nerr, and sys_nerr for version VERSION with NUMBERERR times number of
+   bytes per long int size.
+   Both _sys_errlist and sys_errlist alias to _sys_errlist_internal symbol
+   (defined on errlist.c) while _sys_nerr and sys_nerr created new variable
+   with the expected size.  */
+#define DEFINE_COMPAT_ERRLIST(NUMBERERR, VERSION)     \
+  const int __##VERSION##_sys_nerr = NUMBERERR;     \
+  strong_alias (__##VERSION##_sys_nerr, __##VERSION##__sys_nerr);     \
+  declare_symbol_alias (__ ## VERSION ## _sys_errlist, _sys_errlist_internal,\
+ object, NUMBERERR * (ULONG_WIDTH / UCHAR_WIDTH));    \
+  declare_symbol_alias (__ ## VERSION ## __sys_errlist,     \
+ _sys_errlist_internal, object,     \
+ NUMBERERR * (ULONG_WIDTH / UCHAR_WIDTH));     \
+  compat_symbol (libc, __## VERSION ## _sys_nerr, sys_nerr, VERSION);     \
+  compat_symbol (libc, __## VERSION ## __sys_nerr, _sys_nerr, VERSION);      \
+  compat_symbol (libc, __## VERSION ## _sys_errlist, sys_errlist, VERSION);  \
+  compat_symbol (libc, __## VERSION ## __sys_errlist, _sys_errlist, VERSION);\
+
+#endif
diff --git a/sysdeps/unix/sysv/linux/hppa/Versions b/sysdeps/unix/sysv/linux/hppa/Versions
index b5098b2171..9532d207fc 100644
--- a/sysdeps/unix/sysv/linux/hppa/Versions
+++ b/sysdeps/unix/sysv/linux/hppa/Versions
@@ -1,11 +1,5 @@
 libc {
-  # The comment lines with "#errlist-compat" are magic; see errlist-compat.awk.
-  # When you get an error from errlist-compat.awk, you need to add a new
-  # version here.  Don't do this blindly, since this means changing the ABI
-  # for all GNU/Linux configurations.
-
   GLIBC_2.1 {
-    #errlist-compat 253
     _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
   }
   GLIBC_2.2 {
@@ -13,22 +7,18 @@ libc {
     getrlimit; setrlimit; getrlimit64; setrlimit64;
   }
   GLIBC_2.3 {
-    #errlist-compat 254
     _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
   }
   GLIBC_2.4 {
-    #errlist-compat 256
     _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
   }
   GLIBC_2.11 {
     fallocate64;
   }
   GLIBC_2.12 {
-    #errlist-compat 257
     _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
   }
   GLIBC_2.17 {
-    #errlist-compat 260
     _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
     prlimit64;
   }
diff --git a/sysdeps/unix/sysv/linux/hppa/errlist-compat.c b/sysdeps/unix/sysv/linux/hppa/errlist-compat.c
new file mode 100644
index 0000000000..65860d884c
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/hppa/errlist-compat.c
@@ -0,0 +1,39 @@
+/* Linux sys_errlist compat symbol definitions.  HPPA version.
+   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 <errlist-compat.h>
+
+#if SHLIB_COMPAT (libc, GLIBC_2_1, GLIBC_2_3)
+DEFINE_COMPAT_ERRLIST (253, GLIBC_2_1)
+#endif
+
+#if SHLIB_COMPAT (libc, GLIBC_2_3, GLIBC_2_4)
+DEFINE_COMPAT_ERRLIST (254, GLIBC_2_3)
+#endif
+
+#if SHLIB_COMPAT (libc, GLIBC_2_4, GLIBC_2_12)
+DEFINE_COMPAT_ERRLIST (256, GLIBC_2_4)
+#endif
+
+#if SHLIB_COMPAT (libc, GLIBC_2_12, GLIBC_2_17)
+DEFINE_COMPAT_ERRLIST (257, GLIBC_2_12)
+#endif
+
+#if SHLIB_COMPAT (libc, GLIBC_2_17, GLIBC_2_32)
+DEFINE_COMPAT_ERRLIST (260, GLIBC_2_17)
+#endif
diff --git a/sysdeps/unix/sysv/linux/mips/Versions b/sysdeps/unix/sysv/linux/mips/Versions
index 453f276aad..0ec82dc480 100644
--- a/sysdeps/unix/sysv/linux/mips/Versions
+++ b/sysdeps/unix/sysv/linux/mips/Versions
@@ -5,13 +5,7 @@ ld {
   }
 }
 libc {
-  # The comment lines with "#errlist-compat" are magic; see errlist-compat.awk.
-  # When you get an error from errlist-compat.awk, you need to add a new
-  # version here.  Don't do this blindly, since this means changing the ABI
-  # for all GNU/Linux configurations.
-
   GLIBC_2.0 {
-    #errlist-compat 123
     _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
 
     # Exception handling support functions from libgcc
@@ -28,7 +22,6 @@ libc {
     sysmips;
   }
   GLIBC_2.2 {
-    #errlist-compat 1134
     _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
 
     # _*
diff --git a/bits/sys_errlist.h b/sysdeps/unix/sysv/linux/mips/errlist-compat.c
similarity index 69%
rename from bits/sys_errlist.h
rename to sysdeps/unix/sysv/linux/mips/errlist-compat.c
index 40425a74c3..b720db9244 100644
--- a/bits/sys_errlist.h
+++ b/sysdeps/unix/sysv/linux/mips/errlist-compat.c
@@ -1,5 +1,5 @@
-/* Declare sys_errlist and sys_nerr, or don't.  Don't version.
-   Copyright (C) 2002-2020 Free Software Foundation, Inc.
+/* Linux sys_errlist compat symbol definitions.  MIPS version.
+   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
@@ -16,8 +16,12 @@
    License along with the GNU C Library; if not, see
    <https://www.gnu.org/licenses/>.  */
 
-#ifndef _STDIO_H
-# error "Never include <bits/sys_errlist.h> directly; use <stdio.h> instead."
+#include <errlist-compat.h>
+
+#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2)
+DEFINE_COMPAT_ERRLIST (123, GLIBC_2_0)
 #endif
 
-/* sys_errlist and sys_nerr are deprecated.  Use strerror instead.  */
+#if SHLIB_COMPAT (libc, GLIBC_2_2, GLIBC_2_32)
+DEFINE_COMPAT_ERRLIST (1134, GLIBC_2_1)
+#endif
diff --git a/sysdeps/unix/sysv/linux/sparc/Versions b/sysdeps/unix/sysv/linux/sparc/Versions
index f056addee6..61e57fae99 100644
--- a/sysdeps/unix/sysv/linux/sparc/Versions
+++ b/sysdeps/unix/sysv/linux/sparc/Versions
@@ -1,30 +1,20 @@
 libc {
-  # The comment lines with "#errlist-compat" are magic; see errlist-compat.awk.
-  # When you get an error from errlist-compat.awk, you need to add a new
-  # version here.
-
   GLIBC_2.0 {
-    #errlist-compat 127
     _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
   }
   GLIBC_2.1 {
-    #errlist-compat 127
     _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
   }
   GLIBC_2.3 {
-    #errlist-compat 128
     _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
   }
   GLIBC_2.4 {
-    #errlist-compat 134
     _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
   }
   GLIBC_2.12 {
-    #errlist-compat 135
     _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
   }
   GLIBC_2.16 {
-    #errlist-compat 136
     _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
 
     __getshmlba;
diff --git a/sysdeps/unix/sysv/linux/sparc/errlist-compat.c b/sysdeps/unix/sysv/linux/sparc/errlist-compat.c
new file mode 100644
index 0000000000..43fc364add
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/errlist-compat.c
@@ -0,0 +1,43 @@
+/* Linux sys_errlist compat symbol definitions.  Sparc version.
+   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 <errlist-compat.h>
+
+#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
+DEFINE_COMPAT_ERRLIST (127, GLIBC_2_0)
+#endif
+
+#if SHLIB_COMPAT (libc, GLIBC_2_1, GLIBC_2_3)
+DEFINE_COMPAT_ERRLIST (127, GLIBC_2_1)
+#endif
+
+#if SHLIB_COMPAT (libc, GLIBC_2_3, GLIBC_2_4)
+DEFINE_COMPAT_ERRLIST (128, GLIBC_2_3)
+#endif
+
+#if SHLIB_COMPAT (libc, GLIBC_2_4, GLIBC_2_12)
+DEFINE_COMPAT_ERRLIST (134, GLIBC_2_4)
+#endif
+
+#if SHLIB_COMPAT (libc, GLIBC_2_12, GLIBC_2_16)
+DEFINE_COMPAT_ERRLIST (135, GLIBC_2_12)
+#endif
+
+#if SHLIB_COMPAT (libc, GLIBC_2_16, GLIBC_2_32)
+DEFINE_COMPAT_ERRLIST (136, GLIBC_2_16)
+#endif
--
2.25.1

Reply | Threaded
Open this post in threaded view
|

[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
The __NSIG_WORDS value is based on minimum number of words to hold
the maximum number of signal supported by the architecture.  Maximum
number of signals non multiple of word is rounded up.

This patch also adds __NSIG_BYTES, which is the number of bytes
required to represent the support number of signals.  It is used on
syscall which takes a sigset_t.

Checked on x86_64-linux-gnu and i686-linux-gnu.
---
 include/signal.h                           |  2 ++
 nptl/nptl-init.c                           |  2 +-
 nptl/pthread_sigmask.c                     |  2 +-
 sysdeps/unix/sysv/linux/aio_misc.h         |  9 ++++++---
 sysdeps/unix/sysv/linux/epoll_pwait.c      |  2 +-
 sysdeps/unix/sysv/linux/internal-signals.h | 10 +++++-----
 sysdeps/unix/sysv/linux/ppoll.c            |  7 ++++---
 sysdeps/unix/sysv/linux/pselect.c          |  2 +-
 sysdeps/unix/sysv/linux/sigaction.c        |  3 ++-
 sysdeps/unix/sysv/linux/signalfd.c         |  2 +-
 sysdeps/unix/sysv/linux/sigpending.c       |  2 +-
 sysdeps/unix/sysv/linux/sigsetops.h        | 18 +++++++++++++-----
 sysdeps/unix/sysv/linux/sigsuspend.c       |  2 +-
 sysdeps/unix/sysv/linux/sigtimedwait.c     |  3 ++-
 sysdeps/unix/sysv/linux/x86/setjmpP.h      |  5 ++---
 15 files changed, 43 insertions(+), 28 deletions(-)

diff --git a/include/signal.h b/include/signal.h
index aa68f45886..3d6315b741 100644
--- a/include/signal.h
+++ b/include/signal.h
@@ -2,6 +2,8 @@
 # include <signal/signal.h>
 
 # ifndef _ISOMAC
+#  include <sigsetops.h>
+
 libc_hidden_proto (sigemptyset)
 libc_hidden_proto (sigfillset)
 libc_hidden_proto (sigaddset)
diff --git a/nptl/nptl-init.c b/nptl/nptl-init.c
index d4cf20e3d1..95c60a524a 100644
--- a/nptl/nptl-init.c
+++ b/nptl/nptl-init.c
@@ -281,7 +281,7 @@ __pthread_initialize_minimal_internal (void)
   __sigaddset (&sa.sa_mask, SIGCANCEL);
   __sigaddset (&sa.sa_mask, SIGSETXID);
   INTERNAL_SYSCALL_CALL (rt_sigprocmask, SIG_UNBLOCK, &sa.sa_mask,
- NULL, _NSIG / 8);
+ NULL, __NSIG_BYTES);
 
   /* Get the size of the static and alignment requirements for the TLS
      block.  */
diff --git a/nptl/pthread_sigmask.c b/nptl/pthread_sigmask.c
index d266d296c5..7b65ae1f27 100644
--- a/nptl/pthread_sigmask.c
+++ b/nptl/pthread_sigmask.c
@@ -39,7 +39,7 @@ __pthread_sigmask (int how, const sigset_t *newmask, sigset_t *oldmask)
 
   /* We know that realtime signals are available if NPTL is used.  */
   int result = INTERNAL_SYSCALL_CALL (rt_sigprocmask, how, newmask,
-      oldmask, _NSIG / 8);
+      oldmask, __NSIG_BYTES);
 
   return (INTERNAL_SYSCALL_ERROR_P (result)
   ? INTERNAL_SYSCALL_ERRNO (result)
diff --git a/sysdeps/unix/sysv/linux/aio_misc.h b/sysdeps/unix/sysv/linux/aio_misc.h
index 30c3cd778e..e31ca8edbe 100644
--- a/sysdeps/unix/sysv/linux/aio_misc.h
+++ b/sysdeps/unix/sysv/linux/aio_misc.h
@@ -31,7 +31,8 @@ __aio_start_notify_thread (void)
 {
   sigset_t ss;
   sigemptyset (&ss);
-  INTERNAL_SYSCALL_CALL (rt_sigprocmask, SIG_SETMASK, &ss, NULL, _NSIG / 8);
+  INTERNAL_SYSCALL_CALL (rt_sigprocmask, SIG_SETMASK, &ss, NULL,
+ __NSIG_BYTES);
 }
 
 extern inline int
@@ -52,12 +53,14 @@ __aio_create_helper_thread (pthread_t *threadp, void *(*tf) (void *),
   sigset_t ss;
   sigset_t oss;
   sigfillset (&ss);
-  INTERNAL_SYSCALL_CALL (rt_sigprocmask, SIG_SETMASK, &ss, &oss, _NSIG / 8);
+  INTERNAL_SYSCALL_CALL (rt_sigprocmask, SIG_SETMASK, &ss, &oss,
+ __NSIG_BYTES);
 
   int ret = pthread_create (threadp, &attr, tf, arg);
 
   /* Restore the signal mask.  */
-  INTERNAL_SYSCALL_CALL (rt_sigprocmask, SIG_SETMASK, &oss, NULL, _NSIG / 8);
+  INTERNAL_SYSCALL_CALL (rt_sigprocmask, SIG_SETMASK, &oss, NULL,
+ __NSIG_BYTES);
 
   (void) pthread_attr_destroy (&attr);
   return ret;
diff --git a/sysdeps/unix/sysv/linux/epoll_pwait.c b/sysdeps/unix/sysv/linux/epoll_pwait.c
index 66f04482c7..af6d0fd713 100644
--- a/sysdeps/unix/sysv/linux/epoll_pwait.c
+++ b/sysdeps/unix/sysv/linux/epoll_pwait.c
@@ -38,6 +38,6 @@ int epoll_pwait (int epfd, struct epoll_event *events,
  const sigset_t *set)
 {
   return SYSCALL_CANCEL (epoll_pwait, epfd, events, maxevents,
- timeout, set, _NSIG / 8);
+ timeout, set, __NSIG_BYTES);
 }
 libc_hidden_def (epoll_pwait)
diff --git a/sysdeps/unix/sysv/linux/internal-signals.h b/sysdeps/unix/sysv/linux/internal-signals.h
index 3fbd4807d1..35f2de04c5 100644
--- a/sysdeps/unix/sysv/linux/internal-signals.h
+++ b/sysdeps/unix/sysv/linux/internal-signals.h
@@ -68,7 +68,7 @@ static inline void
 __libc_signal_block_all (sigset_t *set)
 {
   INTERNAL_SYSCALL_CALL (rt_sigprocmask, SIG_BLOCK, &sigall_set, set,
- _NSIG / 8);
+ __NSIG_BYTES);
 }
 
 /* Block all application signals (excluding internal glibc ones).  */
@@ -78,7 +78,7 @@ __libc_signal_block_app (sigset_t *set)
   sigset_t allset = sigall_set;
   __clear_internal_signals (&allset);
   INTERNAL_SYSCALL_CALL (rt_sigprocmask, SIG_BLOCK, &allset, set,
- _NSIG / 8);
+ __NSIG_BYTES);
 }
 
 /* Block only SIGTIMER and return the previous set on SET.  */
@@ -86,7 +86,7 @@ static inline void
 __libc_signal_block_sigtimer (sigset_t *set)
 {
   INTERNAL_SYSCALL_CALL (rt_sigprocmask, SIG_BLOCK, &sigtimer_set, set,
- _NSIG / 8);
+ __NSIG_BYTES);
 }
 
 /* Unblock only SIGTIMER and return the previous set on SET.  */
@@ -94,7 +94,7 @@ static inline void
 __libc_signal_unblock_sigtimer (sigset_t *set)
 {
   INTERNAL_SYSCALL_CALL (rt_sigprocmask, SIG_UNBLOCK, &sigtimer_set, set,
- _NSIG / 8);
+ __NSIG_BYTES);
 }
 
 /* Restore current process signal mask.  */
@@ -102,7 +102,7 @@ static inline void
 __libc_signal_restore_set (const sigset_t *set)
 {
   INTERNAL_SYSCALL_CALL (rt_sigprocmask, SIG_SETMASK, set, NULL,
- _NSIG / 8);
+ __NSIG_BYTES);
 }
 
 /* Used to communicate with signal handler.  */
diff --git a/sysdeps/unix/sysv/linux/ppoll.c b/sysdeps/unix/sysv/linux/ppoll.c
index 4ffb23710e..0f15636cce 100644
--- a/sysdeps/unix/sysv/linux/ppoll.c
+++ b/sysdeps/unix/sysv/linux/ppoll.c
@@ -41,11 +41,12 @@ __ppoll64 (struct pollfd *fds, nfds_t nfds, const struct __timespec64 *timeout,
 # ifndef __NR_ppoll_time64
 #  define __NR_ppoll_time64 __NR_ppoll
 # endif
-  return SYSCALL_CANCEL (ppoll_time64, fds, nfds, timeout, sigmask, _NSIG / 8);
+  return SYSCALL_CANCEL (ppoll_time64, fds, nfds, timeout, sigmask,
+ __NSIG_BYTES);
 #else
 # ifdef __NR_ppoll_time64
   int ret = SYSCALL_CANCEL (ppoll_time64, fds, nfds, timeout, sigmask,
-                            _NSIG / 8);
+                            __NSIG_BYTES);
   if (ret >= 0 || errno != ENOSYS)
     return ret;
 # endif
@@ -62,7 +63,7 @@ __ppoll64 (struct pollfd *fds, nfds_t nfds, const struct __timespec64 *timeout,
     }
 
   return SYSCALL_CANCEL (ppoll, fds, nfds, timeout ? &ts32 : NULL, sigmask,
-                         _NSIG / 8);
+                         __NSIG_BYTES);
 #endif
 }
 
diff --git a/sysdeps/unix/sysv/linux/pselect.c b/sysdeps/unix/sysv/linux/pselect.c
index d7c6ff8fdb..304db03338 100644
--- a/sysdeps/unix/sysv/linux/pselect.c
+++ b/sysdeps/unix/sysv/linux/pselect.c
@@ -43,7 +43,7 @@ __pselect (int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
   } data;
 
   data.ss = (__syscall_ulong_t) (uintptr_t) sigmask;
-  data.ss_len = _NSIG / 8;
+  data.ss_len = __NSIG_BYTES;
 
   return SYSCALL_CANCEL (pselect6, nfds, readfds, writefds, exceptfds,
                          timeout, &data);
diff --git a/sysdeps/unix/sysv/linux/sigaction.c b/sysdeps/unix/sysv/linux/sigaction.c
index 4e6d11a6ae..f27349d552 100644
--- a/sysdeps/unix/sysv/linux/sigaction.c
+++ b/sysdeps/unix/sysv/linux/sigaction.c
@@ -57,7 +57,8 @@ __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact)
      real size of the user-level sigset_t.  */
   result = INLINE_SYSCALL_CALL (rt_sigaction, sig,
  act ? &kact : NULL,
- oact ? &koact : NULL, STUB (act, _NSIG / 8));
+ oact ? &koact : NULL, STUB (act,
+    __NSIG_BYTES));
 
   if (oact && result >= 0)
     {
diff --git a/sysdeps/unix/sysv/linux/signalfd.c b/sysdeps/unix/sysv/linux/signalfd.c
index 64d7bccba9..71d91fdde5 100644
--- a/sysdeps/unix/sysv/linux/signalfd.c
+++ b/sysdeps/unix/sysv/linux/signalfd.c
@@ -24,5 +24,5 @@
 int
 signalfd (int fd, const sigset_t *mask, int flags)
 {
-  return INLINE_SYSCALL (signalfd4, 4, fd, mask, _NSIG / 8, flags);
+  return INLINE_SYSCALL (signalfd4, 4, fd, mask, __NSIG_BYTES, flags);
 }
diff --git a/sysdeps/unix/sysv/linux/sigpending.c b/sysdeps/unix/sysv/linux/sigpending.c
index 458a3cf99e..8898fe8b34 100644
--- a/sysdeps/unix/sysv/linux/sigpending.c
+++ b/sysdeps/unix/sysv/linux/sigpending.c
@@ -24,5 +24,5 @@
 int
 sigpending (sigset_t *set)
 {
-  return INLINE_SYSCALL (rt_sigpending, 2, set, _NSIG / 8);
+  return INLINE_SYSCALL_CALL (rt_sigpending, set, __NSIG_BYTES);
 }
diff --git a/sysdeps/unix/sysv/linux/sigsetops.h b/sysdeps/unix/sysv/linux/sigsetops.h
index db8f378cf0..3f29ead009 100644
--- a/sysdeps/unix/sysv/linux/sigsetops.h
+++ b/sysdeps/unix/sysv/linux/sigsetops.h
@@ -20,23 +20,31 @@
 #define _SIGSETOPS_H 1
 
 #include <signal.h>
+#include <limits.h>
+#include <libc-pointer-arith.h>
 
 /* Return a mask that includes the bit for SIG only.  */
-# define __sigmask(sig) \
-  (((unsigned long int) 1) << (((sig) - 1) % (8 * sizeof (unsigned long int))))
+#define __sigmask(sig) \
+  (1UL << (((sig) - 1) % ULONG_WIDTH))
 
 /* Return the word index for SIG.  */
 static inline unsigned long int
 __sigword (int sig)
 {
-  return (sig - 1) / (8 * sizeof (unsigned long int));
+  return (sig - 1) / ULONG_WIDTH;
 }
 
 /* Linux sig* functions only handle up to __NSIG_WORDS words instead of
    full _SIGSET_NWORDS sigset size.  The signal numbers are 1-based, and
    bit 0 of a signal mask is for signal 1.  */
-
-# define __NSIG_WORDS (_NSIG / (8 * sizeof (unsigned long int )))
+#define __NSIG_WORDS (ALIGN_UP ((_NSIG - 1), ULONG_WIDTH) / ULONG_WIDTH)
+_Static_assert (__NSIG_WORDS <= _SIGSET_NWORDS,
+ "__NSIG_WORDS > _SIGSET_WORDS");
+
+/* This macro is used on syscall that takes a sigset_t to specify the expected
+   size in bytes.  As for glibc, kernel sigset is implemented as an array of
+   unsigned long.  */
+#define __NSIG_BYTES (__NSIG_WORDS * (ULONG_WIDTH / UCHAR_WIDTH))
 
 static inline void
 __sigemptyset (sigset_t *set)
diff --git a/sysdeps/unix/sysv/linux/sigsuspend.c b/sysdeps/unix/sysv/linux/sigsuspend.c
index dd5df5af25..b4bf2ec4bc 100644
--- a/sysdeps/unix/sysv/linux/sigsuspend.c
+++ b/sysdeps/unix/sysv/linux/sigsuspend.c
@@ -23,7 +23,7 @@
 int
 __sigsuspend (const sigset_t *set)
 {
-  return SYSCALL_CANCEL (rt_sigsuspend, set, _NSIG / 8);
+  return SYSCALL_CANCEL (rt_sigsuspend, set, __NSIG_BYTES);
 }
 libc_hidden_def (__sigsuspend)
 weak_alias (__sigsuspend, sigsuspend)
diff --git a/sysdeps/unix/sysv/linux/sigtimedwait.c b/sysdeps/unix/sysv/linux/sigtimedwait.c
index 6b3d8f705f..f2ef3aad45 100644
--- a/sysdeps/unix/sysv/linux/sigtimedwait.c
+++ b/sysdeps/unix/sysv/linux/sigtimedwait.c
@@ -26,7 +26,8 @@ __sigtimedwait (const sigset_t *set, siginfo_t *info,
 {
   /* XXX The size argument hopefully will have to be changed to the
      real size of the user-level sigset_t.  */
-  int result = SYSCALL_CANCEL (rt_sigtimedwait, set, info, timeout, _NSIG / 8);
+  int result = SYSCALL_CANCEL (rt_sigtimedwait, set, info, timeout,
+       __NSIG_BYTES);
 
   /* The kernel generates a SI_TKILL code in si_code in case tkill is
      used.  tkill is transparently used in raise().  Since having
diff --git a/sysdeps/unix/sysv/linux/x86/setjmpP.h b/sysdeps/unix/sysv/linux/x86/setjmpP.h
index 1783b8eb78..a5de31bfd6 100644
--- a/sysdeps/unix/sysv/linux/x86/setjmpP.h
+++ b/sysdeps/unix/sysv/linux/x86/setjmpP.h
@@ -21,6 +21,7 @@
 
 #include <bits/types/__sigset_t.h>
 #include <libc-pointer-arith.h>
+#include <sigsetops.h>
 
 /* <setjmp/setjmp.h> has
 
@@ -113,11 +114,9 @@ typedef union
 
 #include <signal.h>
 
-#define _SIGPROCMASK_NSIG_WORDS (_NSIG / (8 * sizeof (unsigned long int)))
-
 typedef struct
   {
-    unsigned long int __val[_SIGPROCMASK_NSIG_WORDS];
+    unsigned long int __val[__NSIG_WORDS];
   } __sigprocmask_sigset_t;
 
 extern jmp_buf ___buf;
--
2.25.1

Reply | Threaded
Open this post in threaded view
|

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

  2. Linux allocates on struct pthread and access it through THREAD_*
     macros.

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

It is used only on Hurd, where accessing the thread point in single
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
translated messages (to avoid partial translation) and the resulting
usage is not thread-safe.

Checked on x86-64-linux-gnu, i686-linux-gnu, powerpc64le-linux-gnu,
and s390x-linux-gnu.
---
 malloc/thread-freeres.c                |   2 +
 nptl/allocatestack.c                   |   2 +
 nptl/descr.h                           |   4 +
 string/strsignal.c                     | 112 +++++--------------------
 sysdeps/generic/Makefile               |   1 +
 sysdeps/generic/tls-internal-struct.h  |  27 ++++++
 sysdeps/generic/tls-internal.c         |  21 +++++
 sysdeps/generic/tls-internal.h         |  39 +++++++++
 sysdeps/unix/sysv/linux/tls-internal.c |   1 +
 sysdeps/unix/sysv/linux/tls-internal.h |  37 ++++++++
 10 files changed, 155 insertions(+), 91 deletions(-)
 create mode 100644 sysdeps/generic/tls-internal-struct.h
 create mode 100644 sysdeps/generic/tls-internal.c
 create mode 100644 sysdeps/generic/tls-internal.h
 create mode 100644 sysdeps/unix/sysv/linux/tls-internal.c
 create mode 100644 sysdeps/unix/sysv/linux/tls-internal.h

diff --git a/malloc/thread-freeres.c b/malloc/thread-freeres.c
index c71ca4fc33..3408bdbefd 100644
--- a/malloc/thread-freeres.c
+++ b/malloc/thread-freeres.c
@@ -21,6 +21,7 @@
 #include <resolv/resolv-internal.h>
 #include <rpc/rpc.h>
 #include <string.h>
+#include <tls-internal.h>
 
 /* Thread shutdown function.  Note that this function must be called
    for threads during shutdown for correctness reasons.  Unlike
@@ -32,6 +33,7 @@ __libc_thread_freeres (void)
   call_function_static_weak (__rpc_thread_destroy);
   call_function_static_weak (__res_thread_freeres);
   call_function_static_weak (__strerror_thread_freeres);
+  __glibc_tls_internal_free ();
 
   /* This should come last because it shuts down malloc for this
      thread and the other shutdown functions might well call free.  */
diff --git a/nptl/allocatestack.c b/nptl/allocatestack.c
index d16f3d71f8..4ae4b5a986 100644
--- a/nptl/allocatestack.c
+++ b/nptl/allocatestack.c
@@ -237,6 +237,8 @@ get_cached_stack (size_t *sizep, void **memp)
   /* No pending event.  */
   result->nextevent = NULL;
 
+  result->tls_state = (struct tls_internal_t) { 0 };
+
   /* Clear the DTV.  */
   dtv_t *dtv = GET_DTV (TLS_TPADJ (result));
   for (size_t cnt = 0; cnt < dtv[-1].counter; ++cnt)
diff --git a/nptl/descr.h b/nptl/descr.h
index e1c7db5473..6a509b6725 100644
--- a/nptl/descr.h
+++ b/nptl/descr.h
@@ -34,6 +34,7 @@
 #include <unwind.h>
 #include <bits/types/res_state.h>
 #include <kernel-features.h>
+#include <tls-internal-struct.h>
 
 #ifndef TCB_ALIGNMENT
 # define TCB_ALIGNMENT sizeof (double)
@@ -398,6 +399,9 @@ struct pthread
   /* Indicates whether is a C11 thread created by thrd_creat.  */
   bool c11;
 
+  /* Used on strsignal.  */
+  struct tls_internal_t tls_state;
+
   /* This member must be last.  */
   char end_padding[];
 
diff --git a/string/strsignal.c b/string/strsignal.c
index 7e3b262c55..701ce20e6e 100644
--- a/string/strsignal.c
+++ b/string/strsignal.c
@@ -20,106 +20,36 @@
 #include <stdlib.h>
 #include <string.h>
 #include <libintl.h>
-#include <libc-lock.h>
-
-static __libc_key_t key;
-
-/* If nonzero the key allocation failed and we should better use a
-   static buffer than fail.  */
-#define BUFFERSIZ 100
-static char local_buf[BUFFERSIZ];
-static char *static_buf;
-
-/* Destructor for the thread-specific data.  */
-static void init (void);
-static void free_key_mem (void *mem);
-static char *getbuffer (void);
-
+#include <tls-internal.h>
+#include <array_length.h>
 
 /* Return a string describing the meaning of the signal number SIGNUM.  */
 char *
 strsignal (int signum)
 {
-  __libc_once_define (static, once);
-  const char *desc;
-
-  /* If we have not yet initialized the buffer do it now.  */
-  __libc_once (once, init);
-
-  if (
-#ifdef SIGRTMIN
-      (signum >= SIGRTMIN && signum <= SIGRTMAX) ||
-#endif
-      signum < 0 || signum >= NSIG
-      || (desc = __sys_siglist[signum]) == NULL)
-    {
-      char *buffer = getbuffer ();
-      int len;
-#ifdef SIGRTMIN
-      if (signum >= SIGRTMIN && signum <= SIGRTMAX)
- len = __snprintf (buffer, BUFFERSIZ - 1, _("Real-time signal %d"),
-  signum - SIGRTMIN);
-      else
-#endif
- len = __snprintf (buffer, BUFFERSIZ - 1, _("Unknown signal %d"),
-  signum);
-      if (len >= BUFFERSIZ)
- buffer = NULL;
-      else
- buffer[len] = '\0';
-
-      return buffer;
-    }
-
-  return (char *) _(desc);
-}
-
-
-/* Initialize buffer.  */
-static void
-init (void)
-{
-  if (__libc_key_create (&key, free_key_mem))
-    /* Creating the key failed.  This means something really went
-       wrong.  In any case use a static buffer which is better than
-       nothing.  */
-    static_buf = local_buf;
-}
-
+  const char *desc = NULL;
 
-/* Free the thread specific data, this is done if a thread terminates.  */
-static void
-free_key_mem (void *mem)
-{
-  free (mem);
-  __libc_setspecific (key, NULL);
-}
+  if (signum >= 0 && signum <= NSIG && signum < array_length (__sys_siglist))
+    desc = __sys_siglist[signum];
 
+  if (desc != NULL)
+    return (char *) _(desc);
 
-/* Return the buffer to be used.  */
-static char *
-getbuffer (void)
-{
-  char *result;
+  struct tls_internal_t *tls_internal = __glibc_tls_internal ();
+  free (tls_internal->strsignal_buf);
 
-  if (static_buf != NULL)
-    result = static_buf;
+  int r;
+#ifdef SIGRTMIN
+  if (signum >= SIGRTMIN && signum <= SIGRTMAX)
+    r = __asprintf (&tls_internal->strsignal_buf, _("Real-time signal %d"),
+    signum - SIGRTMIN);
   else
-    {
-      /* We don't use the static buffer and so we have a key.  Use it
- to get the thread-specific buffer.  */
-      result = __libc_getspecific (key);
-      if (result == NULL)
- {
-  /* No buffer allocated so far.  */
-  result = malloc (BUFFERSIZ);
-  if (result == NULL)
-    /* No more memory available.  We use the static buffer.  */
-    result = local_buf;
-  else
-    __libc_setspecific (key, result);
- }
-    }
+#endif
+    r = __asprintf (&tls_internal->strsignal_buf, _("Unknown signal %d"),
+    signum);
+
+  if (r == -1)
+    tls_internal->strsignal_buf = NULL;
 
-  return result;
+  return tls_internal->strsignal_buf;
 }
diff --git a/sysdeps/generic/Makefile b/sysdeps/generic/Makefile
index bd4f9425ca..1240d99436 100644
--- a/sysdeps/generic/Makefile
+++ b/sysdeps/generic/Makefile
@@ -16,6 +16,7 @@
 # <https://www.gnu.org/licenses/>.
 
 ifeq ($(subdir),string)
+sysdep_routines += tls-internal
 CFLAGS-wordcopy.c += -Wno-uninitialized
 endif
 
diff --git a/sysdeps/generic/tls-internal-struct.h b/sysdeps/generic/tls-internal-struct.h
new file mode 100644
index 0000000000..33a9079ee9
--- /dev/null
+++ b/sysdeps/generic/tls-internal-struct.h
@@ -0,0 +1,27 @@
+/* Per-thread state.  Generic version.
+   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/>.  */
+
+#ifndef _TLS_INTERNAL_STRUCT_H
+#define _TLS_INTERNAL_STRUCT_H 1
+
+struct tls_internal_t
+{
+  char *strsignal_buf;
+};
+
+#endif
diff --git a/sysdeps/generic/tls-internal.c b/sysdeps/generic/tls-internal.c
new file mode 100644
index 0000000000..14b914e5f3
--- /dev/null
+++ b/sysdeps/generic/tls-internal.c
@@ -0,0 +1,21 @@
+/* Per-thread state.  Generic version.
+   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 <tls-internal.h>
+
+__thread struct tls_internal_t __tls_internal;
diff --git a/sysdeps/generic/tls-internal.h b/sysdeps/generic/tls-internal.h
new file mode 100644
index 0000000000..1f6a117d76
--- /dev/null
+++ b/sysdeps/generic/tls-internal.h
@@ -0,0 +1,39 @@
+/* Per-thread state.  Generic version.
+   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/>.  */
+
+#ifndef _TLS_INTERNAL_H
+#define _TLS_INTERNAL_H 1
+
+#include <stdlib.h>
+#include <tls-internal-struct.h>
+
+extern __thread struct tls_internal_t __tls_internal attribute_hidden;
+
+static inline struct tls_internal_t *
+__glibc_tls_internal (void)
+{
+  return &__tls_internal;
+}
+
+static inline void
+__glibc_tls_internal_free (void)
+{
+  free (__tls_internal.strsignal_buf);
+}
+
+#endif
diff --git a/sysdeps/unix/sysv/linux/tls-internal.c b/sysdeps/unix/sysv/linux/tls-internal.c
new file mode 100644
index 0000000000..6e25b021ab
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/tls-internal.c
@@ -0,0 +1 @@
+/* Empty.  */
diff --git a/sysdeps/unix/sysv/linux/tls-internal.h b/sysdeps/unix/sysv/linux/tls-internal.h
new file mode 100644
index 0000000000..5d712abd4a
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/tls-internal.h
@@ -0,0 +1,37 @@
+/* Per-thread state.  Linux version.
+   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/>.  */
+
+#ifndef _TLS_INTERNAL_H
+#define _TLS_INTERNAL_H 1
+
+#include <stdlib.h>
+#include <nptl/pthreadP.h>
+
+static inline struct tls_internal_t *
+__glibc_tls_internal (void)
+{
+  return &THREAD_SELF->tls_state;
+}
+
+static inline void
+__glibc_tls_internal_free (void)
+{
+  free (THREAD_SELF->tls_state.strsignal_buf);
+}
+
+#endif
--
2.25.1

Reply | Threaded
Open this post in threaded view
|

[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
Checked on x86-64-linux-gnu, i686-linux-gnu, powerpc64le-linux-gnu,
and s390x-linux-gnu.
---
 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.
+
 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>
 
 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);
+
 /* 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)
 
 #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));
 }
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)
 
 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)
 
 /* This is called when a thread is exiting to free the last_value string.  */
 void
--
2.25.1

Reply | Threaded
Open this post in threaded view
|

[PATCH v5 07/13] string: Use tls-internal on strerror_l

Sourceware - libc-alpha mailing list
In reply to this post by Sourceware - libc-alpha mailing list
The buffer allocation uses the same strategy of strsignal.

Checked on x86-64-linux-gnu, i686-linux-gnu, powerpc64le-linux-gnu,
and s390x-linux-gnu.
---
 include/string.h                       |  3 ---
 malloc/thread-freeres.c                |  1 -
 string/strerror_l.c                    | 21 +++++------------
 sysdeps/generic/tls-internal-struct.h  |  1 +
 sysdeps/generic/tls-internal.h         |  1 +
 sysdeps/mach/strerror_l.c              | 32 +++++++++-----------------
 sysdeps/unix/sysv/linux/tls-internal.h |  1 +
 7 files changed, 20 insertions(+), 40 deletions(-)

diff --git a/include/string.h b/include/string.h
index 3a33327cc0..ce01ad8254 100644
--- a/include/string.h
+++ b/include/string.h
@@ -53,9 +53,6 @@ extern char *__strerror_r (int __errnum, char *__buf, size_t __buflen);
 
 extern char *__strerror_l (int __errnum, locale_t __loc);
 
-/* Called as part of the thread shutdown sequence.  */
-void __strerror_thread_freeres (void) attribute_hidden;
-
 /* Get _STRING_ARCH_unaligned.  */
 #include <string_private.h>
 #endif
diff --git a/malloc/thread-freeres.c b/malloc/thread-freeres.c
index 3408bdbefd..eb29d53310 100644
--- a/malloc/thread-freeres.c
+++ b/malloc/thread-freeres.c
@@ -32,7 +32,6 @@ __libc_thread_freeres (void)
 {
   call_function_static_weak (__rpc_thread_destroy);
   call_function_static_weak (__res_thread_freeres);
-  call_function_static_weak (__strerror_thread_freeres);
   __glibc_tls_internal_free ();
 
   /* This should come last because it shuts down malloc for this
diff --git a/string/strerror_l.c b/string/strerror_l.c
index 017bd14b99..a203e9e80b 100644
--- a/string/strerror_l.c
+++ b/string/strerror_l.c
@@ -18,11 +18,8 @@
 #include <libintl.h>
 #include <locale.h>
 #include <stdio.h>
-#include <stdlib.h>
 #include <string.h>
-#include <errno.h>
-
-static __thread char *last_value;
+#include <tls-internal.h>
 
 
 static const char *
@@ -43,12 +40,13 @@ __strerror_l (int errnum, locale_t loc)
   char *err = (char *) __get_errlist (errnum);
   if (__glibc_unlikely (err == NULL))
     {
-      free (last_value);
-      if (__asprintf (&last_value, "%s%d",
+      struct tls_internal_t *tls_internal = __glibc_tls_internal ();
+      free (tls_internal->strerror_l_buf);
+      if (__asprintf (&tls_internal->strerror_l_buf, "%s%d",
       translate ("Unknown error ", loc), errnum) == -1)
- last_value = NULL;
+ tls_internal->strerror_l_buf = NULL;
 
-      err = last_value;
+      err = tls_internal->strerror_l_buf;
     }
   else
     err = (char *) translate (err, loc);
@@ -58,10 +56,3 @@ __strerror_l (int errnum, locale_t loc)
 }
 weak_alias (__strerror_l, strerror_l)
 libc_hidden_def (__strerror_l)
-
-void
-__strerror_thread_freeres (void)
-{
-  free (last_value);
-}
-text_set_element (__libc_subfreeres, __strerror_thread_freeres);
diff --git a/sysdeps/generic/tls-internal-struct.h b/sysdeps/generic/tls-internal-struct.h
index 33a9079ee9..156e722bd8 100644
--- a/sysdeps/generic/tls-internal-struct.h
+++ b/sysdeps/generic/tls-internal-struct.h
@@ -22,6 +22,7 @@
 struct tls_internal_t
 {
   char *strsignal_buf;
+  char *strerror_l_buf;
 };
 
 #endif
diff --git a/sysdeps/generic/tls-internal.h b/sysdeps/generic/tls-internal.h
index 1f6a117d76..b4b03b4ecf 100644
--- a/sysdeps/generic/tls-internal.h
+++ b/sysdeps/generic/tls-internal.h
@@ -34,6 +34,7 @@ static inline void
 __glibc_tls_internal_free (void)
 {
   free (__tls_internal.strsignal_buf);
+  free (__tls_internal.strerror_l_buf);
 }
 
 #endif
diff --git a/sysdeps/mach/strerror_l.c b/sysdeps/mach/strerror_l.c
index b6c9fdbe80..72b857f4a0 100644
--- a/sysdeps/mach/strerror_l.c
+++ b/sysdeps/mach/strerror_l.c
@@ -23,11 +23,7 @@
 #include <string.h>
 #include <mach/error.h>
 #include <errorlib.h>
-#include <sys/param.h>
-#include <libc-symbols.h>
-
-
-static __thread char *last_value;
+#include <tls-internal.h>
 
 
 static const char *
@@ -58,13 +54,14 @@ __strerror_l (int errnum, locale_t loc)
 
   if (system > err_max_system || ! __mach_error_systems[system].bad_sub)
     {
-      free (last_value);
-      if (__asprintf (&last_value, "%s%X",
+      struct tls_internal_t *tls_internal = __glibc_tls_internal ();
+      free (tls_internal->strerror_l_buf);
+      if (__asprintf (&tls_internal->strerror_l_buf, "%s%X",
       translate ("Error in unknown error system: ", loc),
       errnum) == -1)
- last_value = NULL;
+ tls_internal->strerror_l_buf = NULL;
 
-      return last_value;
+      return tls_internal->strerror_l_buf;
     }
 
   es = &__mach_error_systems[system];
@@ -74,25 +71,18 @@ __strerror_l (int errnum, locale_t loc)
 
   if (code >= es->subsystem[sub].max_code)
     {
-      free (last_value);
-      if (__asprintf (&last_value, "%s%s %d",
+      struct tls_internal_t *tls_internal = __glibc_tls_internal ();
+      free (tls_internal->strerror_l_buf);
+      if (__asprintf (&tls_internal->strerror_l_buf, "%s%s %d",
       translate ("Unknown error ", loc),
       translate (es->subsystem[sub].subsys_name, loc),
       errnum) == -1)
- last_value = NULL;
+ tls_internal->strerror_l_buf = NULL;
 
-      return last_value;
+      return tls_internal->strerror_l_buf;
     }
 
   return (char *) translate (es->subsystem[sub].codes[code], loc);
 }
 weak_alias (__strerror_l, strerror_l)
 libc_hidden_def (__strerror_l)
-
-/* This is called when a thread is exiting to free the last_value string.  */
-void
-__strerror_thread_freeres (void)
-{
-  free (last_value);
-}
-text_set_element (__libc_subfreeres, __strerror_thread_freeres);
diff --git a/sysdeps/unix/sysv/linux/tls-internal.h b/sysdeps/unix/sysv/linux/tls-internal.h
index 5d712abd4a..d07f4b680d 100644
--- a/sysdeps/unix/sysv/linux/tls-internal.h
+++ b/sysdeps/unix/sysv/linux/tls-internal.h
@@ -32,6 +32,7 @@ static inline void
 __glibc_tls_internal_free (void)
 {
   free (THREAD_SELF->tls_state.strsignal_buf);
+  free (THREAD_SELF->tls_state.strerror_l_buf);
 }
 
 #endif
--
2.25.1

Reply | Threaded
Open this post in threaded view
|

[PATCH v5 08/13] string: Simplify strerror_r

Sourceware - libc-alpha mailing list
In reply to this post by Sourceware - libc-alpha mailing list
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.
---
 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
 
 /* 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);
       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
 
 /* 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);
       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);
       return buf;
     }
 
--
2.25.1

Reply | Threaded
Open this post in threaded view
|

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

Sourceware - libc-alpha mailing list
In reply to this post by Sourceware - libc-alpha mailing list
Checked on x86-64-linux-gnu, i686-linux-gnu, powerpc64le-linux-gnu,
and s390x-linux-gnu.
---
 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
+
 # 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
 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)
 
 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.
+
+   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>
+
+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
+  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>
--
2.25.1

Reply | Threaded
Open this post in threaded view
|

[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
Checked on x86-64-linux-gnu, i686-linux-gnu, powerpc64le-linux-gnu,
and s390x-linux-gnu.
---
 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
 
 # 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)
 
 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>
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;
+}
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;
+}
--
2.25.1

Reply | Threaded
Open this post in threaded view
|

[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
Checked on x86-64-linux-gnu, i686-linux-gnu, powerpc64le-linux-gnu,
and s390x-linux-gnu.
---
 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);
+
   return 0;
 }
 
--
2.25.1

Reply | Threaded
Open this post in threaded view
|

[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
The sigabbrev_np returns the abbreviated signal name (i.g. "HUP" for
SIGHUP) while sigdescr_np returns string describing error number
(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).

Checked on x86-64-linux-gnu, i686-linux-gnu, powerpc64le-linux-gnu,
and s390x-linux-gnu.
---
 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"
+  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.
+
 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)
 
 /* 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)
+
 /* 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{}}
+This function returns the message describing the signal @var{signum} or
+@code{NULL} for invalid signal number (i.g "Hangup" for @code{SIGHUP}).
+Different than @code{strsignal} the returned description is not translated.
+The message porints to a static 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
+
+@deftypefun void sigabbrev_np (int @var{signum})
+@standards{GNU, string.h}
+@safety{@prelim{}@mtsafe{@mtssigintr{}}@assafe{}@acsafe{}}
+This function returns the abbreviation describing the signal @var{signum} or
+@code{NULL} for invalid signal number.  The message porints to a static
+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)
 
 #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
 
 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
 
 # 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;
+  }
 }
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;
+}
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;
+}
+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
+
 /* 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);
   if (desc != NULL)
-    return (char *) _(desc);
+    return _(desc);
 
   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>
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
--
2.25.1

Reply | Threaded
Open this post in threaded view
|

[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
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
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.
---
 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
+  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
+  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..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{}}
+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}).
+
+@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{}}
+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
+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..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.
+
+   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 (-1) == NULL);
+  TEST_VERIFY (strerrordesc (array_length (errlist)) == NULL);
+  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;
+}
+
+#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
 
 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;
   }
 }
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);
+}
+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);
+}
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
+/* 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
--
2.25.1

Reply | Threaded
Open this post in threaded view
|

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

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:

> It refactor how signals are defined by each architecture.  Instead of
> include a generic header (bits/signum-generic.h) and undef non-default
> values in an arch specific header (bits/signum.h) the new scheme uses a
> common definition (bits/signum-generic.h) and each architectures add
> its specific definitions on a new header (bits/signum-arch.h).
>
> For Linux it requires copy some system default definitions to alpha,
> hppa, and sparc.  They are historical values and newer ports uses
> the generic Linux signum-arch.h.
>
> For Hurd the BSD signum is removed and moved to a new header (it is
> used currently only on Hurd).
>
> Checked on a build against all affected ABIs.

I agree that starting with a common definition and then adding to that
results in fewer mistakes. There is no case where the common definition
got updated and the arch then forgot to undef the non-default.

I agree that having a single signum-arch.h for new generic ports is a
good idea and makes porting easier.

In general we've been following the generic concept that we start with
smaller headers and build up to more complex headers.

Therefore on the fact of it this refactor looks like an improvement so
I'm going to agree with it, given that you did the work and subsequent
patches follow on from this patch, and *those* patches have even more
value.

OK for master.

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

> ---
>  bits/signum-arch.h                            | 59 +++++++++++++++
>  bits/signum-generic.h                         | 27 +------
>  bits/signum.h                                 | 32 --------
>  signal/Makefile                               |  2 +-
>  signal/signal.h                               |  2 +-
>  sysdeps/mach/hurd/bits/signum-arch.h          | 65 ++++++++++++++++
>  sysdeps/unix/bsd/bits/signum.h                | 35 ---------
>  .../unix/sysv/linux/alpha/bits/signum-arch.h  | 67 +++++++++++++++++
>  sysdeps/unix/sysv/linux/alpha/bits/signum.h   | 40 ----------
>  sysdeps/unix/sysv/linux/bits/signum-arch.h    | 64 ++++++++++++++++
>  sysdeps/unix/sysv/linux/bits/signum.h         | 58 --------------
>  .../unix/sysv/linux/hppa/bits/signum-arch.h   | 69 +++++++++++++++++
>  sysdeps/unix/sysv/linux/hppa/bits/signum.h    | 75 -------------------
>  sysdeps/unix/sysv/linux/ia64/vfork.S          |  2 +-
>  .../unix/sysv/linux/mips/bits/signum-arch.h   | 65 ++++++++++++++++
>  sysdeps/unix/sysv/linux/mips/bits/signum.h    | 68 -----------------
>  .../unix/sysv/linux/sparc/bits/signum-arch.h  | 66 ++++++++++++++++
>  sysdeps/unix/sysv/linux/sparc/bits/signum.h   | 39 ----------
>  18 files changed, 461 insertions(+), 374 deletions(-)
>  create mode 100644 bits/signum-arch.h
>  delete mode 100644 bits/signum.h
>  create mode 100644 sysdeps/mach/hurd/bits/signum-arch.h
>  delete mode 100644 sysdeps/unix/bsd/bits/signum.h
>  create mode 100644 sysdeps/unix/sysv/linux/alpha/bits/signum-arch.h
>  delete mode 100644 sysdeps/unix/sysv/linux/alpha/bits/signum.h
>  create mode 100644 sysdeps/unix/sysv/linux/bits/signum-arch.h
>  delete mode 100644 sysdeps/unix/sysv/linux/bits/signum.h
>  create mode 100644 sysdeps/unix/sysv/linux/hppa/bits/signum-arch.h
>  delete mode 100644 sysdeps/unix/sysv/linux/hppa/bits/signum.h
>  create mode 100644 sysdeps/unix/sysv/linux/mips/bits/signum-arch.h
>  delete mode 100644 sysdeps/unix/sysv/linux/mips/bits/signum.h
>  create mode 100644 sysdeps/unix/sysv/linux/sparc/bits/signum-arch.h
>  delete mode 100644 sysdeps/unix/sysv/linux/sparc/bits/signum.h
>
> diff --git a/bits/signum-arch.h b/bits/signum-arch.h
> new file mode 100644
> index 0000000000..abecff2345
> --- /dev/null
> +++ b/bits/signum-arch.h
> @@ -0,0 +1,59 @@
> +/* Signal number constants.  Specific architecture definitions.
> +   Copyright (C) 2020 Free Software Foundation, Inc.

OK.

> +   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/>.  */
> +
> +#ifndef _BITS_SIGNUM_ARCH_H
> +#define _BITS_SIGNUM_ARCH_H 1
> +
> +#ifndef _SIGNAL_H
> +#error "Never include <bits/signum-generic.h> directly; use <signal.h> instead."
> +#endif
> +
> +/* Historical signals specified by POSIX. */
> +#define SIGBUS 10 /* Bus error.  */
> +#define SIGSYS 12 /* Bad system call.  */
> +
> +/* New(er) POSIX signals (1003.1-2008, 1003.1-2013).  */
> +#define SIGURG 16 /* Urgent data is available at a socket.  */
> +#define SIGSTOP 17 /* Stop, unblockable.  */
> +#define SIGTSTP 18 /* Keyboard stop.  */
> +#define SIGCONT 19 /* Continue.  */
> +#define SIGCHLD 20 /* Child terminated or stopped.  */
> +#define SIGTTIN 21 /* Background read from control terminal.  */
> +#define SIGTTOU 22 /* Background write to control terminal.  */
> +#define SIGPOLL 23 /* Pollable event occurred (System V).  */
> +#define SIGXCPU 24 /* CPU time limit exceeded.  */
> +#define SIGVTALRM 26 /* Virtual timer expired.  */
> +#define SIGPROF 27 /* Profiling timer expired.  */
> +#define SIGXFSZ 25 /* File size limit exceeded.  */
> +#define SIGUSR1 30 /* User-defined signal 1.  */
> +#define SIGUSR2 31 /* User-defined signal 2.  */
> +
> +/* Nonstandard signals found in all modern POSIX systems
> +   (including both BSD and Linux).  */
> +#define SIGWINCH 28 /* Window size change (4.3 BSD, Sun).  */
> +
> +/* Archaic names for compatibility.  */
> +#define SIGIO SIGPOLL /* I/O now possible (4.2 BSD).  */
> +#define SIGIOT SIGABRT /* IOT instruction, abort() on a PDP-11.  */
> +#define SIGCLD SIGCHLD /* Old System V name */
> +
> +/* By default no real-time signals are supported.  */
> +#define __SIGRTMIN 32
> +#define __SIGRTMAX __SIGRTMIN

OK.

> +
> +#endif
> diff --git a/bits/signum-generic.h b/bits/signum-generic.h
> index 504e5fb8c8..67131853c2 100644
> --- a/bits/signum-generic.h
> +++ b/bits/signum-generic.h
> @@ -57,31 +57,9 @@
>  #define SIGQUIT 3 /* Quit.  */
>  #define SIGTRAP 5 /* Trace/breakpoint trap.  */
>  #define SIGKILL 9 /* Killed.  */
> -#define SIGBUS 10 /* Bus error.  */
> -#define SIGSYS 12 /* Bad system call.  */
>  #define SIGPIPE 13 /* Broken pipe.  */
>  #define SIGALRM 14 /* Alarm clock.  */
>  
> -/* New(er) POSIX signals (1003.1-2008, 1003.1-2013).  */
> -#define SIGURG 16 /* Urgent data is available at a socket.  */
> -#define SIGSTOP 17 /* Stop, unblockable.  */
> -#define SIGTSTP 18 /* Keyboard stop.  */
> -#define SIGCONT 19 /* Continue.  */
> -#define SIGCHLD 20 /* Child terminated or stopped.  */
> -#define SIGTTIN 21 /* Background read from control terminal.  */
> -#define SIGTTOU 22 /* Background write to control terminal.  */
> -#define SIGPOLL 23 /* Pollable event occurred (System V).  */
> -#define SIGXCPU 24 /* CPU time limit exceeded.  */
> -#define SIGXFSZ 25 /* File size limit exceeded.  */
> -#define SIGVTALRM 26 /* Virtual timer expired.  */
> -#define SIGPROF 27 /* Profiling timer expired.  */
> -#define SIGUSR1 30 /* User-defined signal 1.  */
> -#define SIGUSR2 31 /* User-defined signal 2.  */
> -
> -/* Nonstandard signals found in all modern POSIX systems
> -   (including both BSD and Linux).  */
> -#define SIGWINCH 28 /* Window size change (4.3 BSD, Sun).  */
> -
>  /* Archaic names for compatibility.  */
>  #define SIGIO SIGPOLL /* I/O now possible (4.2 BSD).  */
>  #define SIGIOT SIGABRT /* IOT instruction, abort() on a PDP-11.  */
> @@ -93,8 +71,9 @@
>     but some real-time signals may be used internally by glibc.  Do not
>     use these constants in application code; use SIGRTMIN and SIGRTMAX
>     (defined in signal.h) instead.  */
> -#define __SIGRTMIN 32
> -#define __SIGRTMAX __SIGRTMIN
> +
> +/* Include system specific bits.  */
> +#include <bits/signum-arch.h>

OK.

>  
>  /* Biggest signal number + 1 (including real-time signals).  */
>  #define _NSIG (__SIGRTMAX + 1)
> diff --git a/bits/signum.h b/bits/signum.h
> deleted file mode 100644
> index 183e3c0545..0000000000
> --- a/bits/signum.h
> +++ /dev/null
> @@ -1,32 +0,0 @@
> -/* Signal number constants.  Generic version.
> -   Copyright (C) 2017-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/>.  */
> -
> -#ifndef _BITS_SIGNUM_H
> -#define _BITS_SIGNUM_H 1
> -
> -#ifndef _SIGNAL_H
> -#error "Never include <bits/signum.h> directly; use <signal.h> instead."
> -#endif
> -
> -#include <bits/signum-generic.h>
> -
> -/* This operating system does not need to override any of the generic
> -   signal number assignments in bits/signum-generic.h, nor to add any
> -   additional signal constants.  */
> -
> -#endif /* bits/signum.h.  */

OK.

> diff --git a/signal/Makefile b/signal/Makefile
> index f3c19e2992..2ec3ddd74f 100644
> --- a/signal/Makefile
> +++ b/signal/Makefile
> @@ -23,7 +23,7 @@ subdir := signal
>  include ../Makeconfig
>  
>  headers := signal.h sys/signal.h \
> -   bits/signum.h bits/signum-generic.h \
> +   bits/signum-generic.h bits/signum-arch.h \

OK.

>     bits/sigcontext.h bits/sigaction.h \
>     bits/sigevent-consts.h bits/siginfo-consts.h \
>     bits/sigstack.h bits/sigthread.h bits/ss_flags.h \
> diff --git a/signal/signal.h b/signal/signal.h
> index 2c57f90e20..db325bde16 100644
> --- a/signal/signal.h
> +++ b/signal/signal.h
> @@ -27,7 +27,7 @@
>  __BEGIN_DECLS
>  
>  #include <bits/types.h>
> -#include <bits/signum.h>
> +#include <bits/signum-generic.h>

OK.

>  
>  #include <bits/types/sig_atomic_t.h>
>  
> diff --git a/sysdeps/mach/hurd/bits/signum-arch.h b/sysdeps/mach/hurd/bits/signum-arch.h
> new file mode 100644
> index 0000000000..bfcb37a47c
> --- /dev/null
> +++ b/sysdeps/mach/hurd/bits/signum-arch.h
> @@ -0,0 +1,65 @@
> +/* Signal number constants.  Specific architecture definitions.
> +   Copyright (C) 2020 Free Software Foundation, Inc.

OK.

> +   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/>.  */
> +
> +#ifndef _BITS_SIGNUM_ARCH_H
> +#define _BITS_SIGNUM_ARCH_H 1
> +
> +#ifndef _SIGNAL_H
> +#error "Never include <bits/signum-arch.h> directly; use <signal.h> instead."
> +#endif
> +
> +/* Historical signals specified by POSIX. */
> +#define SIGBUS 10 /* Bus error.  */
> +#define SIGSYS 12 /* Bad system call.  */
> +
> +/* Adjustments and additions to the signal number constants for
> +   4.2 or 4.3 BSD-derived Unix systems.  */
> +#define SIGEMT 7 /* Emulator trap (4.2 BSD).  */
> +#define SIGINFO 29 /* Information request (4.4 BSD).  */
> +#define SIGLOST 32 /* Resource lost (Sun); server died (GNU).  */
> +
> +/* New(er) POSIX signals (1003.1-2008, 1003.1-2013).  */
> +#define SIGURG 16 /* Urgent data is available at a socket.  */
> +#define SIGSTOP 17 /* Stop, unblockable.  */
> +#define SIGTSTP 18 /* Keyboard stop.  */
> +#define SIGCONT 19 /* Continue.  */
> +#define SIGCHLD 20 /* Child terminated or stopped.  */
> +#define SIGTTIN 21 /* Background read from control terminal.  */
> +#define SIGTTOU 22 /* Background write to control terminal.  */
> +#define SIGPOLL 23 /* Pollable event occurred (System V).  */
> +#define SIGXCPU 24 /* CPU time limit exceeded.  */
> +#define SIGVTALRM 26 /* Virtual timer expired.  */
> +#define SIGPROF 27 /* Profiling timer expired.  */
> +#define SIGXFSZ 25 /* File size limit exceeded.  */
> +#define SIGUSR1 30 /* User-defined signal 1.  */
> +#define SIGUSR2 31 /* User-defined signal 2.  */
> +
> +/* Nonstandard signals found in all modern POSIX systems
> +   (including both BSD and Linux).  */
> +#define SIGWINCH 28 /* Window size change (4.3 BSD, Sun).  */
> +
> +/* Archaic names for compatibility.  */
> +#define SIGIO SIGPOLL /* I/O now possible (4.2 BSD).  */
> +#define SIGIOT SIGABRT /* IOT instruction, abort() on a PDP-11.  */
> +#define SIGCLD SIGCHLD /* Old System V name */
> +
> +/* No real-time signals are supported.  */
> +#define __SIGRTMIN 32
> +#define __SIGRTMAX __SIGRTMIN

OK.

> +
> +#endif
> diff --git a/sysdeps/unix/bsd/bits/signum.h b/sysdeps/unix/bsd/bits/signum.h
> deleted file mode 100644
> index a8d47af038..0000000000
> --- a/sysdeps/unix/bsd/bits/signum.h
> +++ /dev/null
> @@ -1,35 +0,0 @@
> -/* Signal number definitions.  BSD version.
> -   Copyright (C) 1991-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/>.  */
> -
> -#ifndef _BITS_SIGNUM_H
> -#define _BITS_SIGNUM_H 1
> -
> -#ifndef _SIGNAL_H
> -#error "Never include <bits/signum.h> directly; use <signal.h> instead."
> -#endif
> -
> -#include <bits/signum-generic.h>
> -
> -/* Adjustments and additions to the signal number constants for
> -   4.2 or 4.3 BSD-derived Unix systems.  */
> -
> -#define SIGEMT 7 /* Emulator trap (4.2 BSD).  */
> -#define SIGINFO 29 /* Information request (4.4 BSD).  */
> -#define SIGLOST 32 /* Resource lost (Sun); server died (GNU).  */
> -
> -#endif /* bits/signum.h.  */

OK.

> diff --git a/sysdeps/unix/sysv/linux/alpha/bits/signum-arch.h b/sysdeps/unix/sysv/linux/alpha/bits/signum-arch.h
> new file mode 100644
> index 0000000000..47200d7337
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/alpha/bits/signum-arch.h
> @@ -0,0 +1,67 @@
> +/* Signal number definitions.  Linux/Alpha version.
> +   Copyright (C) 1996-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/>.  */
> +
> +#ifndef _BITS_SIGNUM_ARCH_H
> +#define _BITS_SIGNUM_ARCH_H 1
> +
> +#ifndef _SIGNAL_H
> +#error "Never include <bits/signum-arch.h> directly; use <signal.h> instead."
> +#endif
> +
> +/* Adjustments and additions to the signal number constants for
> +   Linux/Alpha.  Signal values on this platform were chosen for OSF/1
> +   binary compatibility, and are therefore almost identical to the
> +   BSD-derived defaults.  */
> +
> +#define SIGEMT 7 /* Emulator trap (4.2 BSD).  */
> +#define SIGINFO 29 /* Information request (BSD).  */
> +#define SIGPWR SIGINFO /* Power failure imminent (System V).  */
> +
> +/* Historical signals specified by POSIX. */
> +#define SIGBUS 10 /* Bus error.  */
> +#define SIGSYS 12 /* Bad system call.  */
> +
> +/* New(er) POSIX signals (1003.1-2008, 1003.1-2013).  */
> +#define SIGURG 16 /* Urgent data is available at a socket.  */
> +#define SIGSTOP 17 /* Stop, unblockable.  */
> +#define SIGTSTP 18 /* Keyboard stop.  */
> +#define SIGCONT 19 /* Continue.  */
> +#define SIGCHLD 20 /* Child terminated or stopped.  */
> +#define SIGTTIN 21 /* Background read from control terminal.  */
> +#define SIGTTOU 22 /* Background write to control terminal.  */
> +#define SIGPOLL 23 /* Pollable event occurred (System V).  */
> +#define SIGXCPU 24 /* CPU time limit exceeded.  */
> +#define SIGVTALRM 26 /* Virtual timer expired.  */
> +#define SIGPROF 27 /* Profiling timer expired.  */
> +#define SIGXFSZ 25 /* File size limit exceeded.  */
> +#define SIGUSR1 30 /* User-defined signal 1.  */
> +#define SIGUSR2 31 /* User-defined signal 2.  */
> +
> +/* Nonstandard signals found in all modern POSIX systems
> +   (including both BSD and Linux).  */
> +#define SIGWINCH 28
> +
> +/* Archaic names for compatibility.  */
> +#define SIGIO SIGPOLL /* I/O now possible (4.2 BSD).  */
> +#define SIGIOT SIGABRT /* IOT instruction, abort() on a PDP-11.  */
> +#define SIGCLD SIGCHLD /* Old System V name */
> +
> +#define __SIGRTMIN 32
> +#define __SIGRTMAX 64
> +
> +#endif /* <signal.h> included.  */

OK.

> diff --git a/sysdeps/unix/sysv/linux/alpha/bits/signum.h b/sysdeps/unix/sysv/linux/alpha/bits/signum.h
> deleted file mode 100644
> index 63add0e3db..0000000000
> --- a/sysdeps/unix/sysv/linux/alpha/bits/signum.h
> +++ /dev/null
> @@ -1,40 +0,0 @@
> -/* Signal number definitions.  Linux/Alpha version.
> -   Copyright (C) 1996-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/>.  */
> -
> -#ifndef _BITS_SIGNUM_H
> -#define _BITS_SIGNUM_H 1
> -
> -#ifndef _SIGNAL_H
> -#error "Never include <bits/signum.h> directly; use <signal.h> instead."
> -#endif
> -
> -#include <bits/signum-generic.h>
> -
> -/* Adjustments and additions to the signal number constants for
> -   Linux/Alpha.  Signal values on this platform were chosen for OSF/1
> -   binary compatibility, and are therefore almost identical to the
> -   BSD-derived defaults.  */
> -
> -#define SIGEMT 7 /* Emulator trap (4.2 BSD).  */
> -#define SIGINFO 29 /* Information request (BSD).  */
> -#define SIGPWR SIGINFO /* Power failure imminent (System V).  */
> -
> -#undef __SIGRTMAX
> -#define __SIGRTMAX 64
> -
> -#endif /* <signal.h> included.  */

OK.

> diff --git a/sysdeps/unix/sysv/linux/bits/signum-arch.h b/sysdeps/unix/sysv/linux/bits/signum-arch.h
> new file mode 100644
> index 0000000000..de5ee4af14
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/bits/signum-arch.h
> @@ -0,0 +1,64 @@
> +/* Signal number definitions.  Linux version.
> +   Copyright (C) 1995-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/>.  */
> +
> +#ifndef _BITS_SIGNUM_ARCH_H
> +#define _BITS_SIGNUM_ARCH_H 1
> +
> +#ifndef _SIGNAL_H
> +#error "Never include <bits/signum-arch.h> directly; use <signal.h> instead."
> +#endif
> +
> +/* Adjustments and additions to the signal number constants for
> +   most Linux systems.  */
> +
> +#define SIGSTKFLT 16 /* Stack fault (obsolete).  */
> +#define SIGPWR 30 /* Power failure imminent.  */
> +
> +/* Historical signals specified by POSIX. */
> +#define SIGBUS 7 /* Bus error.  */
> +#define SIGSYS 31 /* Bad system call.  */
> +
> +/* New(er) POSIX signals (1003.1-2008, 1003.1-2013).  */
> +#define SIGURG 23 /* Urgent data is available at a socket.  */
> +#define SIGSTOP 19 /* Stop, unblockable.  */
> +#define SIGTSTP 20 /* Keyboard stop.  */
> +#define SIGCONT 18 /* Continue.  */
> +#define SIGCHLD 17 /* Child terminated or stopped.  */
> +#define SIGTTIN 21 /* Background read from control terminal.  */
> +#define SIGTTOU 22 /* Background write to control terminal.  */
> +#define SIGPOLL 29 /* Pollable event occurred (System V).  */
> +#define SIGXFSZ 25 /* File size limit exceeded.  */
> +#define SIGXCPU 24 /* CPU time limit exceeded.  */
> +#define SIGVTALRM 26 /* Virtual timer expired.  */
> +#define SIGPROF 27 /* Profiling timer expired.  */
> +#define SIGUSR1 10 /* User-defined signal 1.  */
> +#define SIGUSR2 12 /* User-defined signal 2.  */
> +
> +/* Nonstandard signals found in all modern POSIX systems
> +   (including both BSD and Linux).  */
> +#define SIGWINCH 28 /* Window size change (4.3 BSD, Sun).  */
> +
> +/* Archaic names for compatibility.  */
> +#define SIGIO SIGPOLL /* I/O now possible (4.2 BSD).  */
> +#define SIGIOT SIGABRT /* IOT instruction, abort() on a PDP-11.  */
> +#define SIGCLD SIGCHLD /* Old System V name */
> +
> +#define __SIGRTMIN 32
> +#define __SIGRTMAX 64
> +
> +#endif /* <signal.h> included.  */

OK.

> diff --git a/sysdeps/unix/sysv/linux/bits/signum.h b/sysdeps/unix/sysv/linux/bits/signum.h
> deleted file mode 100644
> index 423fd8be70..0000000000
> --- a/sysdeps/unix/sysv/linux/bits/signum.h
> +++ /dev/null
> @@ -1,58 +0,0 @@
> -/* Signal number definitions.  Linux version.
> -   Copyright (C) 1995-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/>.  */
> -
> -#ifndef _BITS_SIGNUM_H
> -#define _BITS_SIGNUM_H 1
> -
> -#ifndef _SIGNAL_H
> -#error "Never include <bits/signum.h> directly; use <signal.h> instead."
> -#endif
> -
> -#include <bits/signum-generic.h>
> -
> -/* Adjustments and additions to the signal number constants for
> -   most Linux systems.  */
> -
> -#define SIGSTKFLT 16 /* Stack fault (obsolete).  */
> -#define SIGPWR 30 /* Power failure imminent.  */
> -
> -#undef SIGBUS
> -#define SIGBUS 7
> -#undef SIGUSR1
> -#define SIGUSR1 10
> -#undef SIGUSR2
> -#define SIGUSR2 12
> -#undef SIGCHLD
> -#define SIGCHLD 17
> -#undef SIGCONT
> -#define SIGCONT 18
> -#undef SIGSTOP
> -#define SIGSTOP 19
> -#undef SIGTSTP
> -#define SIGTSTP 20
> -#undef SIGURG
> -#define SIGURG 23
> -#undef SIGPOLL
> -#define SIGPOLL 29
> -#undef SIGSYS
> -#define SIGSYS 31
> -
> -#undef __SIGRTMAX
> -#define __SIGRTMAX 64
> -
> -#endif /* <signal.h> included.  */

OK.

> diff --git a/sysdeps/unix/sysv/linux/hppa/bits/signum-arch.h b/sysdeps/unix/sysv/linux/hppa/bits/signum-arch.h
> new file mode 100644
> index 0000000000..364e57ec4a
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/hppa/bits/signum-arch.h
> @@ -0,0 +1,69 @@
> +/* Signal number definitions.  Linux/HPPA version.
> +   Copyright (C) 1995-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/>.  */
> +
> +#ifndef _BITS_SIGNUM_ARCH_H
> +#define _BITS_SIGNUM_ARCH_H 1
> +
> +#ifndef _SIGNAL_H
> +#error "Never include <bits/signum-arch.h> directly; use <signal.h> instead."
> +#endif
> +
> +/* Adjustments and additions to the signal number constants for
> +   Linux/HPPA.  These values were originally chosen for HP/UX
> +   compatibility, but were renumbered as of kernel 3.17 and glibc 2.21
> +   to accommodate software (notably systemd) that assumed at least 29
> +   real-time signal numbers would be available.  SIGEMT and SIGLOST
> +   were removed, and the values of SIGSTKFLT, SIGXCPU, XIGXFSZ, and
> +   SIGSYS were changed, enabling __SIGRTMIN to be 32.  */
> +
> +#define SIGSTKFLT 7 /* Stack fault (obsolete).  */
> +#define SIGPWR 19 /* Power failure imminent.  */
> +
> +/* Historical signals specified by POSIX. */
> +#define SIGBUS 10 /* Bus error.  */
> +#define SIGSYS 31 /* Bad system call.  */
> +
> +/* New(er) POSIX signals (1003.1-2008, 1003.1-2013).  */
> +#define SIGURG 29 /* Urgent data is available at a socket.  */
> +#define SIGSTOP 24 /* Stop, unblockable.  */
> +#define SIGTSTP 25 /* Keyboard stop.  */
> +#define SIGCONT 26 /* Continue.  */
> +#define SIGCHLD 18 /* Child terminated or stopped.  */
> +#define SIGTTIN 27 /* Background read from control terminal.  */
> +#define SIGTTOU 28 /* Background write to control terminal.  */
> +#define SIGPOLL 22 /* Pollable event occurred (System V).  */
> +#define SIGXCPU 12 /* CPU time limit exceeded.  */
> +#define SIGVTALRM 20 /* Virtual timer expired.  */
> +#define SIGPROF 21 /* Profiling timer expired.  */
> +#define SIGXFSZ 30 /* File size limit exceeded.  */
> +#define SIGUSR1 16 /* User-defined signal 1.  */
> +#define SIGUSR2 17 /* User-defined signal 2.  */
> +
> +/* Nonstandard signals found in all modern POSIX systems
> +   (including both BSD and Linux).  */
> +#define SIGWINCH 23 /* Window size change (4.3 BSD, Sun).  */
> +
> +/* Archaic names for compatibility.  */
> +#define SIGIO SIGPOLL /* I/O now possible (4.2 BSD).  */
> +#define SIGIOT SIGABRT /* IOT instruction, abort() on a PDP-11.  */
> +#define SIGCLD SIGCHLD /* Old System V name */
> +
> +#define __SIGRTMIN 32
> +#define __SIGRTMAX 64
> +
> +#endif /* <signal.h> included.  */

OK.

> diff --git a/sysdeps/unix/sysv/linux/hppa/bits/signum.h b/sysdeps/unix/sysv/linux/hppa/bits/signum.h
> deleted file mode 100644
> index 2210304e37..0000000000
> --- a/sysdeps/unix/sysv/linux/hppa/bits/signum.h
> +++ /dev/null
> @@ -1,75 +0,0 @@
> -/* Signal number definitions.  Linux/HPPA version.
> -   Copyright (C) 1995-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/>.  */
> -
> -#ifndef _BITS_SIGNUM_H
> -#define _BITS_SIGNUM_H 1
> -
> -#ifndef _SIGNAL_H
> -#error "Never include <bits/signum.h> directly; use <signal.h> instead."
> -#endif
> -
> -#include <bits/signum-generic.h>
> -
> -/* Adjustments and additions to the signal number constants for
> -   Linux/HPPA.  These values were originally chosen for HP/UX
> -   compatibility, but were renumbered as of kernel 3.17 and glibc 2.21
> -   to accommodate software (notably systemd) that assumed at least 29
> -   real-time signal numbers would be available.  SIGEMT and SIGLOST
> -   were removed, and the values of SIGSTKFLT, SIGXCPU, XIGXFSZ, and
> -   SIGSYS were changed, enabling __SIGRTMIN to be 32.  */
> -
> -#define SIGSTKFLT 7 /* Stack fault (obsolete).  */
> -#define SIGPWR 19 /* Power failure imminent.  */
> -
> -#undef SIGXCPU
> -#define SIGXCPU 12
> -#undef SIGUSR1
> -#define SIGUSR1 16
> -#undef SIGUSR2
> -#define SIGUSR2 17
> -#undef SIGCHLD
> -#define SIGCHLD 18
> -#undef SIGVTALRM
> -#define SIGVTALRM 20
> -#undef SIGPROF
> -#define SIGPROF 21
> -#undef SIGPOLL
> -#define SIGPOLL 22
> -#undef SIGWINCH
> -#define SIGWINCH 23
> -#undef SIGSTOP
> -#define SIGSTOP 24
> -#undef SIGTSTP
> -#define SIGTSTP 25
> -#undef SIGCONT
> -#define SIGCONT 26
> -#undef SIGTTIN
> -#define SIGTTIN 27
> -#undef SIGTTOU
> -#define SIGTTOU 28
> -#undef SIGURG
> -#define SIGURG 29
> -#undef SIGXFSZ
> -#define SIGXFSZ 30
> -#undef SIGSYS
> -#define SIGSYS 31
> -
> -#undef __SIGRTMAX
> -#define __SIGRTMAX 64
> -
> -#endif /* <signal.h> included.  */

OK.

> diff --git a/sysdeps/unix/sysv/linux/ia64/vfork.S b/sysdeps/unix/sysv/linux/ia64/vfork.S
> index a8ceea8ea7..843bf7683c 100644
> --- a/sysdeps/unix/sysv/linux/ia64/vfork.S
> +++ b/sysdeps/unix/sysv/linux/ia64/vfork.S
> @@ -18,7 +18,7 @@
>  
>  #include <sysdep.h>
>  #define _SIGNAL_H
> -#include <bits/signum.h>
> +#include <bits/signum-arch.h>

OK.

>  #include <tcb-offsets.h>
>  
>  /* The following are defined in linux/sched.h, which unfortunately */
> diff --git a/sysdeps/unix/sysv/linux/mips/bits/signum-arch.h b/sysdeps/unix/sysv/linux/mips/bits/signum-arch.h
> new file mode 100644
> index 0000000000..c500d38322
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/mips/bits/signum-arch.h
> @@ -0,0 +1,65 @@
> +/* Signal number definitions.  Linux/MIPS version.
> +   Copyright (C) 1995-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/>.  */
> +
> +#ifndef _BITS_SIGNUM_H
> +#define _BITS_SIGNUM_H 1
> +
> +#ifndef _SIGNAL_H
> +#error "Never include <bits/signum.h> directly; use <signal.h> instead."
> +#endif
> +
> +/* Adjustments and additions to the signal number constants for
> +   Linux/MIPS.  */
> +
> +#define SIGEMT 7 /* Emulator trap.  */
> +#define SIGPWR 19 /* Power failure imminent.  */
> +
> +/* Historical signals specified by POSIX. */
> +#define SIGBUS 10 /* Bus error.  */
> +#define SIGSYS 12 /* Bad system call.  */
> +
> +/* New(er) POSIX signals (1003.1-2008, 1003.1-2013).  */
> +#define SIGURG 21 /* Urgent data is available at a socket.  */
> +#define SIGSTOP 23 /* Stop, unblockable.  */
> +#define SIGTSTP 24 /* Keyboard stop.  */
> +#define SIGCONT 25 /* Continue.  */
> +#define SIGCHLD 18 /* Child terminated or stopped.  */
> +#define SIGTTIN 26 /* Background read from control terminal.  */
> +#define SIGTTOU 27 /* Background write to control terminal.  */
> +#define SIGPOLL 22 /* Pollable event occurred (System V).  */
> +#define SIGXCPU 30 /* CPU time limit exceeded.  */
> +#define SIGVTALRM 28 /* Virtual timer expired.  */
> +#define SIGPROF 29 /* Profiling timer expired.  */
> +#define SIGXFSZ 31 /* File size limit exceeded.  */
> +#define SIGUSR1 16 /* User-defined signal 1.  */
> +#define SIGUSR2 17 /* User-defined signal 2.  */
> +
> +/* Nonstandard signals found in all modern POSIX systems
> +   (including both BSD and Linux).  */
> +#define SIGWINCH 20 /* Window size change (4.3 BSD, Sun).  */
> +
> +/* Archaic names for compatibility.  */
> +#define SIGIO SIGPOLL /* I/O now possible (4.2 BSD).  */
> +#define SIGIOT SIGABRT /* IOT instruction, abort() on a PDP-11.  */
> +#define SIGCLD SIGCHLD /* Old System V name */
> +
> +/* By default no real-time signals are supported.  */
> +#define __SIGRTMIN 32
> +#define __SIGRTMAX 127
> +
> +#endif /* <signal.h> included.  */

OK.

> diff --git a/sysdeps/unix/sysv/linux/mips/bits/signum.h b/sysdeps/unix/sysv/linux/mips/bits/signum.h
> deleted file mode 100644
> index f5a5e7b4cd..0000000000
> --- a/sysdeps/unix/sysv/linux/mips/bits/signum.h
> +++ /dev/null
> @@ -1,68 +0,0 @@
> -/* Signal number definitions.  Linux/MIPS version.
> -   Copyright (C) 1995-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/>.  */
> -
> -#ifndef _BITS_SIGNUM_H
> -#define _BITS_SIGNUM_H 1
> -
> -#ifndef _SIGNAL_H
> -#error "Never include <bits/signum.h> directly; use <signal.h> instead."
> -#endif
> -
> -#include <bits/signum-generic.h>
> -
> -/* Adjustments and additions to the signal number constants for
> -   Linux/MIPS.  */
> -
> -#define SIGEMT 7 /* Emulator trap.  */
> -#define SIGPWR 19 /* Power failure imminent.  */
> -
> -#undef SIGUSR1
> -#define SIGUSR1 16
> -#undef SIGUSR2
> -#define SIGUSR2 17
> -#undef SIGCHLD
> -#define SIGCHLD 18
> -#undef SIGWINCH
> -#define SIGWINCH 20
> -#undef SIGURG
> -#define SIGURG 21
> -#undef SIGPOLL
> -#define SIGPOLL 22
> -#undef SIGSTOP
> -#define SIGSTOP 23
> -#undef SIGTSTP
> -#define SIGTSTP 24
> -#undef SIGCONT
> -#define SIGCONT 25
> -#undef SIGTTIN
> -#define SIGTTIN 26
> -#undef SIGTTOU
> -#define SIGTTOU 27
> -#undef SIGVTALRM
> -#define SIGVTALRM 28
> -#undef SIGPROF
> -#define SIGPROF 29
> -#undef SIGXCPU
> -#define SIGXCPU 30
> -#undef SIGXFSZ
> -#define SIGXFSZ 31
> -
> -#undef __SIGRTMAX
> -#define __SIGRTMAX 127
> -
> -#endif /* <signal.h> included.  */

OK.

> diff --git a/sysdeps/unix/sysv/linux/sparc/bits/signum-arch.h b/sysdeps/unix/sysv/linux/sparc/bits/signum-arch.h
> new file mode 100644
> index 0000000000..0cece9a6c4
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/sparc/bits/signum-arch.h
> @@ -0,0 +1,66 @@
> +/* Signal number definitions.  Linux/SPARC version.
> +   Copyright (C) 1996-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/>.  */
> +
> +#ifndef _BITS_SIGNUM_ARCH_H
> +#define _BITS_SIGNUM_ARCH_H 1
> +
> +#ifndef _SIGNAL_H
> +#error "Never include <bits/signum-arch.h> directly; use <signal.h> instead."
> +#endif
> +
> +/* Adjustments and additions to the signal number constants for
> +   Linux/SPARC systems.  Signal values on this platform were chosen
> +   for SunOS binary compatibility.  */
> +
> +#define SIGEMT 7 /* Emulator trap.  */
> +#define SIGLOST 29 /* Resource lost (Sun); server died (GNU).  */
> +#define SIGPWR SIGLOST /* Power failure imminent (SysV).  */
> +
> +/* Historical signals specified by POSIX. */
> +#define SIGBUS 10 /* Bus error.  */
> +#define SIGSYS 12 /* Bad system call.  */
> +
> +/* New(er) POSIX signals (1003.1-2008, 1003.1-2013).  */
> +#define SIGURG 16 /* Urgent data is available at a socket.  */
> +#define SIGSTOP 17 /* Stop, unblockable.  */
> +#define SIGTSTP 18 /* Keyboard stop.  */
> +#define SIGCONT 19 /* Continue.  */
> +#define SIGCHLD 20 /* Child terminated or stopped.  */
> +#define SIGTTIN 21 /* Background read from control terminal.  */
> +#define SIGTTOU 22 /* Background write to control terminal.  */
> +#define SIGPOLL 23 /* Pollable event occurred (System V).  */
> +#define SIGXCPU 24 /* CPU time limit exceeded.  */
> +#define SIGVTALRM 26 /* Virtual timer expired.  */
> +#define SIGPROF 27 /* Profiling timer expired.  */
> +#define SIGXFSZ 25 /* File size limit exceeded.  */
> +#define SIGUSR1 30 /* User-defined signal 1.  */
> +#define SIGUSR2 31 /* User-defined signal 2.  */
> +
> +/* Nonstandard signals found in all modern POSIX systems
> +   (including both BSD and Linux).  */
> +#define SIGWINCH 28 /* Window size change (4.3 BSD, Sun).  */
> +
> +/* Archaic names for compatibility.  */
> +#define SIGIO SIGPOLL /* I/O now possible (4.2 BSD).  */
> +#define SIGIOT SIGABRT /* IOT instruction, abort() on a PDP-11.  */
> +#define SIGCLD SIGCHLD /* Old System V name */
> +
> +#define __SIGRTMIN 32
> +#define __SIGRTMAX 64
> +
> +#endif /* <signal.h> included.  */

OK.

> diff --git a/sysdeps/unix/sysv/linux/sparc/bits/signum.h b/sysdeps/unix/sysv/linux/sparc/bits/signum.h
> deleted file mode 100644
> index 40fb39a435..0000000000
> --- a/sysdeps/unix/sysv/linux/sparc/bits/signum.h
> +++ /dev/null
> @@ -1,39 +0,0 @@
> -/* Signal number definitions.  Linux/SPARC version.
> -   Copyright (C) 1996-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/>.  */
> -
> -#ifndef _BITS_SIGNUM_H
> -#define _BITS_SIGNUM_H 1
> -
> -#ifndef _SIGNAL_H
> -#error "Never include <bits/signum.h> directly; use <signal.h> instead."
> -#endif
> -
> -#include <bits/signum-generic.h>
> -
> -/* Adjustments and additions to the signal number constants for
> -   Linux/SPARC systems.  Signal values on this platform were chosen
> -   for SunOS binary compatibility.  */
> -
> -#define SIGEMT 7 /* Emulator trap.  */
> -#define SIGLOST 29 /* Resource lost (Sun); server died (GNU).  */
> -#define SIGPWR SIGLOST /* Power failure imminent (SysV).  */
> -
> -#undef __SIGRTMAX
> -#define __SIGRTMAX 64
> -
> -#endif /* <signal.h> included.  */
>

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

> ---
>  NEWS                                          |  6 ++
>  debug/segfault.c                              | 18 ++---
>  include/signal.h                              |  4 +-
>  manual/signal.texi                            |  5 --
>  signal/signal.h                               |  6 --
>  stdio-common/psiginfo.c                       |  2 +-
>  stdio-common/psignal.c                        |  2 +-
>  stdio-common/siglist.c                        |  8 +-
>  string/strsignal.c                            |  2 +-
>  sysdeps/generic/siglist-compat.c              |  1 +
>  sysdeps/generic/siglist-compat.h              | 47 +++++++++++
>  sysdeps/gnu/siglist.c                         | 78 -------------------
>  .../mach/hurd/{siglist.h => siglist-compat.c} | 13 +++-
>  .../linux/{siglist.h => siglist-compat.c}     | 17 ++--
>  14 files changed, 93 insertions(+), 116 deletions(-)
>  create mode 100644 sysdeps/generic/siglist-compat.c
>  create mode 100644 sysdeps/generic/siglist-compat.h
>  delete mode 100644 sysdeps/gnu/siglist.c
>  rename sysdeps/mach/hurd/{siglist.h => siglist-compat.c} (68%)
>  rename sysdeps/unix/sysv/linux/{siglist.h => siglist-compat.c} (62%)
>
> 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.

> +
>  Changes to build and runtime requirements:
>  
>  * powerpc64le requires GCC 7.4 or newer.  This is required for supporting
> diff --git a/debug/segfault.c b/debug/segfault.c
> index 14c64cd0bd..8b59783c9e 100644
> --- a/debug/segfault.c
> +++ b/debug/segfault.c
> @@ -49,20 +49,16 @@
>  static const char *fname;
>  
>  
> -/* We better should not use `strerror' since it can call far too many
> -   other functions which might fail.  Do it here ourselves.  */
> +/* Print the signal number SIGNAL.  Either strerror or strsignal might
> +   call local internal functions and these in turn call far too many
> +   other functions and might even allocate memory which might fail.  */

OK.

>  static void
>  write_strsignal (int fd, int signal)
>  {
> -  if (signal < 0 || signal >= _NSIG || _sys_siglist[signal] == NULL)
> -    {
> -      char buf[30];
> -      char *ptr = _itoa_word (signal, &buf[sizeof (buf)], 10, 0);
> -      WRITE_STRING ("signal ");
> -      write (fd, buf, &buf[sizeof (buf)] - ptr);
> -    }
> -  else
> -    WRITE_STRING (_sys_siglist[signal]);
> +  char buf[30];
> +  char *ptr = _itoa_word (signal, &buf[sizeof (buf)], 10, 0);
> +  WRITE_STRING ("signal ");
> +  write (fd, buf, &buf[sizeof (buf)] - ptr);

OK.

>  }
>  
>  
> diff --git a/include/signal.h b/include/signal.h
> index 293258ad65..aa68f45886 100644
> --- a/include/signal.h
> +++ b/include/signal.h
> @@ -12,7 +12,9 @@ libc_hidden_proto (__sigpause)
>  libc_hidden_proto (raise)
>  libc_hidden_proto (__libc_current_sigrtmin)
>  libc_hidden_proto (__libc_current_sigrtmax)
> -libc_hidden_proto (_sys_siglist)
> +extern const char * const __sys_siglist[_NSIG];
> +libc_hidden_proto (__sys_siglist)

OK.

> +
>  
>  /* Now define the internal interfaces.  */
>  extern __sighandler_t __bsd_signal (int __sig, __sighandler_t __handler);
> diff --git a/manual/signal.texi b/manual/signal.texi
> index 911b422a18..34def1c06c 100644
> --- a/manual/signal.texi
> +++ b/manual/signal.texi
> @@ -880,11 +880,6 @@ to @var{signum}.
>  This function is a BSD feature, declared in the header file @file{signal.h}.
>  @end deftypefun
>  
> -@vindex sys_siglist
> -There is also an array @code{sys_siglist} which contains the messages
> -for the various signal codes.  This array exists on BSD systems, unlike
> -@code{strsignal}.

OK.

> -
>  @node Signal Actions
>  @section Specifying Signal Actions
>  @cindex signal actions
> diff --git a/signal/signal.h b/signal/signal.h
> index db325bde16..effe3d698f 100644
> --- a/signal/signal.h
> +++ b/signal/signal.h
> @@ -284,12 +284,6 @@ extern int sigqueue (__pid_t __pid, int __sig, const union sigval __val)
>  
>  #ifdef __USE_MISC
>  
> -/* Names of the signals.  This variable exists only for compatibility.
> -   Use `strsignal' instead (see <string.h>).  */
> -extern const char *const _sys_siglist[_NSIG];
> -extern const char *const sys_siglist[_NSIG];

OK.

> -
> -
>  /* Get machine-dependent `struct sigcontext' and signal subcodes.  */
>  # include <bits/sigcontext.h>
>  
> diff --git a/stdio-common/psiginfo.c b/stdio-common/psiginfo.c
> index 4d498d00aa..362de9e565 100644
> --- a/stdio-common/psiginfo.c
> +++ b/stdio-common/psiginfo.c
> @@ -80,7 +80,7 @@ psiginfo (const siginfo_t *pinfo, const char *s)
>  
>    const char *desc;
>    if (pinfo->si_signo >= 0 && pinfo->si_signo < NSIG
> -      && ((desc = _sys_siglist[pinfo->si_signo]) != NULL
> +      && ((desc = __sys_siglist[pinfo->si_signo]) != NULL

OK.

>  #ifdef SIGRTMIN
>    || (pinfo->si_signo >= SIGRTMIN && pinfo->si_signo < SIGRTMAX)
>  #endif
> diff --git a/stdio-common/psignal.c b/stdio-common/psignal.c
> index de45e52734..1f217a3332 100644
> --- a/stdio-common/psignal.c
> +++ b/stdio-common/psignal.c
> @@ -34,7 +34,7 @@ psignal (int sig, const char *s)
>    else
>      colon = ": ";
>  
> -  if (sig >= 0 && sig < NSIG && (desc = _sys_siglist[sig]) != NULL)
> +  if (sig >= 0 && sig < NSIG && (desc = __sys_siglist[sig]) != NULL)

OK.

>      (void) __fxprintf (NULL, "%s%s%s\n", s, colon, _(desc));
>    else
>      {
> diff --git a/stdio-common/siglist.c b/stdio-common/siglist.c
> index 04082594a0..3e29aa8227 100644
> --- a/stdio-common/siglist.c
> +++ b/stdio-common/siglist.c
> @@ -20,17 +20,19 @@
>  #include <signal.h>
>  #include <libintl.h>
>  
> -const char *const _sys_siglist[NSIG] =
> +const char *const __sys_siglist[NSIG] =

OK.

>  {
>  #define init_sig(sig, abbrev, desc)   [sig] = desc,
>  #include <siglist.h>
>  #undef init_sig
>  };
> +libc_hidden_def (__sys_siglist)

OK.

>  
> -
> -const char *const _sys_sigabbrev[NSIG] =
> +const char *const __sys_sigabbrev[NSIG] =
>  {
>  #define init_sig(sig, abbrev, desc)   [sig] = abbrev,
>  #include <siglist.h>
>  #undef init_sig
>  };
> +
> +#include <siglist-compat.c>

OK.

> diff --git a/string/strsignal.c b/string/strsignal.c
> index 2843ffe39b..7e3b262c55 100644
> --- a/string/strsignal.c
> +++ b/string/strsignal.c
> @@ -51,7 +51,7 @@ strsignal (int signum)
>        (signum >= SIGRTMIN && signum <= SIGRTMAX) ||
>  #endif
>        signum < 0 || signum >= NSIG
> -      || (desc = _sys_siglist[signum]) == NULL)
> +      || (desc = __sys_siglist[signum]) == NULL)
>      {
>        char *buffer = getbuffer ();
>        int len;
> diff --git a/sysdeps/generic/siglist-compat.c b/sysdeps/generic/siglist-compat.c
> new file mode 100644
> index 0000000000..6e25b021ab
> --- /dev/null
> +++ b/sysdeps/generic/siglist-compat.c
> @@ -0,0 +1 @@
> +/* Empty.  */
> diff --git a/sysdeps/generic/siglist-compat.h b/sysdeps/generic/siglist-compat.h
> new file mode 100644
> index 0000000000..13e5f253dc
> --- /dev/null
> +++ b/sysdeps/generic/siglist-compat.h
> @@ -0,0 +1,47 @@
> +/* Generic siglist compatibility macro definitions.
> +   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/>.  */
> +
> +#ifndef _SIGLIST_COMPAT_H
> +#define _SIGLIST_COMPAT_H
> +
> +#include <shlib-compat.h>
> +#include <limits.h>
> +
> +/* Define new compat symbols for sys_siglist, _sys_siglist, and sys_sigabbrev
> +   for version VERSION with NUMBERSIG times the number of bytes per long int.
> +   Both _sys_siglist and sys_siglist alias to __sys_siglist while
> +   sys_sigabbrev alias to __sys_sigabbrev.  Both target alias are
> +   define in siglist.c.  */
> +#define DEFINE_COMPAT_SIGLIST(NUMBERSIG, VERSION)     \
> +  declare_symbol_alias (__ ## VERSION ## _sys_siglist,     \
> + __sys_siglist,     \
> + object, NUMBERSIG * (ULONG_WIDTH / UCHAR_WIDTH));    \
> +  declare_symbol_alias (__ ## VERSION ## sys_siglist,     \
> + __sys_siglist,     \
> + object, NUMBERSIG * (ULONG_WIDTH / UCHAR_WIDTH));    \
> +  declare_symbol_alias (__ ## VERSION ## _sys_sigabbrev,     \
> + __sys_sigabbrev,     \
> + object, NUMBERSIG * (ULONG_WIDTH / UCHAR_WIDTH));    \
> +  compat_symbol (libc, __## VERSION ## _sys_siglist,   _sys_siglist,     \
> + VERSION);     \
> +  compat_symbol (libc, __## VERSION ## sys_siglist,    sys_siglist,     \
> + VERSION);     \
> +  compat_symbol (libc, __## VERSION ## _sys_sigabbrev, sys_sigabbrev,     \
> + VERSION);     \
> +
> +#endif

OK.

> diff --git a/sysdeps/gnu/siglist.c b/sysdeps/gnu/siglist.c
> deleted file mode 100644
> index c24f356f21..0000000000
> --- a/sysdeps/gnu/siglist.c
> +++ /dev/null
> @@ -1,78 +0,0 @@
> -/* Define list of all signal numbers and their names.
> -   Copyright (C) 1997-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 <stddef.h>
> -#include <signal.h>
> -#include <libintl.h>
> -#include <shlib-compat.h>
> -#include <bits/wordsize.h>
> -
> -const char *const __new_sys_siglist[NSIG] =
> -{
> -#define init_sig(sig, abbrev, desc)   [sig] = desc,
> -#include <siglist.h>
> -#undef init_sig
> -};
> -libc_hidden_ver (__new_sys_siglist, _sys_siglist)
> -
> -const char *const __new_sys_sigabbrev[NSIG] =
> -{
> -#define init_sig(sig, abbrev, desc)   [sig] = abbrev,
> -#include <siglist.h>
> -#undef init_sig
> -};
> -
> -#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
> -declare_symbol_alias (__old_sys_siglist, __new_sys_siglist, object,
> -      OLD_SIGLIST_SIZE * __WORDSIZE / 8)
> -
> -declare_symbol_alias (__old_sys_sigabbrev, __new_sys_sigabbrev, object,
> -      OLD_SIGLIST_SIZE * __WORDSIZE / 8)
> -
> -declare_symbol_alias (_old_sys_siglist, __new_sys_siglist, object,
> -      OLD_SIGLIST_SIZE * __WORDSIZE / 8)
> -
> -compat_symbol (libc, __old_sys_siglist, _sys_siglist, GLIBC_2_0);
> -compat_symbol (libc, _old_sys_siglist, sys_siglist, GLIBC_2_0);
> -compat_symbol (libc, __old_sys_sigabbrev, sys_sigabbrev, GLIBC_2_0);
> -#endif
> -
> -#if SHLIB_COMPAT (libc, GLIBC_2_1, GLIBC_2_3_3) && defined OLD2_SIGLIST_SIZE
> -declare_symbol_alias (__old2_sys_siglist, __new_sys_siglist, object,
> -      OLD2_SIGLIST_SIZE * __WORDSIZE / 8)
> -
> -declare_symbol_alias (__old2_sys_sigabbrev, __new_sys_sigabbrev, object,
> -      OLD2_SIGLIST_SIZE * __WORDSIZE / 8)
> -
> -declare_symbol_alias (_old2_sys_siglist, __new_sys_siglist, object,
> -      OLD2_SIGLIST_SIZE * __WORDSIZE / 8)
> -
> -compat_symbol (libc, __old2_sys_siglist, _sys_siglist, GLIBC_2_1);
> -compat_symbol (libc, _old2_sys_siglist, sys_siglist, GLIBC_2_1);
> -compat_symbol (libc, __old2_sys_sigabbrev, sys_sigabbrev, GLIBC_2_1);
> -
> -strong_alias (__new_sys_siglist, _new_sys_siglist)
> -versioned_symbol (libc, __new_sys_siglist, _sys_siglist, GLIBC_2_3_3);
> -versioned_symbol (libc, _new_sys_siglist, sys_siglist, GLIBC_2_3_3);
> -versioned_symbol (libc, __new_sys_sigabbrev, sys_sigabbrev, GLIBC_2_3_3);
> -#else
> -strong_alias (__new_sys_siglist, _new_sys_siglist)
> -versioned_symbol (libc, __new_sys_siglist, _sys_siglist, GLIBC_2_1);
> -versioned_symbol (libc, _new_sys_siglist, sys_siglist, GLIBC_2_1);
> -versioned_symbol (libc, __new_sys_sigabbrev, sys_sigabbrev, GLIBC_2_1);
> -#endif

OK.

> diff --git a/sysdeps/mach/hurd/siglist.h b/sysdeps/mach/hurd/siglist-compat.c
> similarity index 68%
> rename from sysdeps/mach/hurd/siglist.h
> rename to sysdeps/mach/hurd/siglist-compat.c
> index 2eee091610..c93f12366b 100644
> --- a/sysdeps/mach/hurd/siglist.h
> +++ b/sysdeps/mach/hurd/siglist-compat.c
> @@ -1,4 +1,5 @@
> -/* Copyright (C) 1999-2020 Free Software Foundation, Inc.
> +/* Compatibility signal numbers and their names symbols.  Hurd version.
> +   Copyright (C) 1997-2020 Free Software Foundation, Inc.

OK.

>     This file is part of the GNU C Library.
>  
>     The GNU C Library is free software; you can redistribute it and/or
> @@ -15,8 +16,12 @@
>     License along with the GNU C Library; if not, see
>     <https://www.gnu.org/licenses/>.  */
>  
> -/* This file is included multiple times.  */
> +#include <siglist-compat.h>
>  
> -#include_next <siglist.h> /* Get the canonical list.  */
> +#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
> +DEFINE_COMPAT_SIGLIST (33, GLIBC_2_0)
> +#endif
>  
> -#define OLD_SIGLIST_SIZE 33 /* For GLIBC_2.0 binary compatibility.  */
> +#if SHLIB_COMPAT (libc, GLIBC_2_1, GLIBC_2_32)
> +DEFINE_COMPAT_SIGLIST (NSIG, GLIBC_2_1)
> +#endif
> diff --git a/sysdeps/unix/sysv/linux/siglist.h b/sysdeps/unix/sysv/linux/siglist-compat.c
> similarity index 62%
> rename from sysdeps/unix/sysv/linux/siglist.h
> rename to sysdeps/unix/sysv/linux/siglist-compat.c
> index 6ff2c613ad..c322326a99 100644
> --- a/sysdeps/unix/sysv/linux/siglist.h
> +++ b/sysdeps/unix/sysv/linux/siglist-compat.c
> @@ -1,4 +1,5 @@
> -/* Copyright (C) 1996-2020 Free Software Foundation, Inc.
> +/* Compatibility signal numbers and their names symbols.  Linux version.
> +   Copyright (C) 1997-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
> @@ -15,10 +16,16 @@
>     License along with the GNU C Library; if not, see
>     <https://www.gnu.org/licenses/>.  */
>  
> -/* This file is included multiple times.  */
> +#include <siglist-compat.h>
>  
> -#include_next <siglist.h> /* Get the canonical list.  */
> +#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
> +DEFINE_COMPAT_SIGLIST (32, GLIBC_2_0)
> +#endif
>  
> -#define OLD_SIGLIST_SIZE 32 /* For GLIBC_2.0 binary compatibility.  */
> +#if SHLIB_COMPAT (libc, GLIBC_2_1, GLIBC_2_3_3)
> +DEFINE_COMPAT_SIGLIST (64, GLIBC_2_1)
> +#endif
>  
> -#define OLD2_SIGLIST_SIZE 64 /* For GLIBC_2.1 binary compatibility.  */
> +#if SHLIB_COMPAT (libc, GLIBC_2_3_3, GLIBC_2_32)
> +DEFINE_COMPAT_SIGLIST (NSIG, GLIBC_2_3_3)
> +#endif

OK. Final compat for glibc 2.32.

>


--
Cheers,
Carlos.

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

Tested on x86_64 and i686.

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

> ---
>  NEWS                                          |    6 +
>  include/stdio.h                               |    2 +-
>  libio/Makefile                                |    2 +-
>  libio/stdio.h                                 |    6 -
>  scripts/build-many-glibcs.py                  |    3 +-
>  stdio-common/Makefile                         |   11 +
>  stdio-common/errlist-compat.c                 |    1 +
>  stdio-common/errlist.c                        |   30 +-
>  stdio-common/tst-errno-manual.py              |   73 +
>  string/_strerror.c                            |    6 +-
>  string/strerror_l.c                           |    8 +-
>  string/xpg-strerror.c                         |    9 +-
>  sysdeps/gnu/Makefile                          |   43 -
>  sysdeps/gnu/errlist-compat.awk                |  133 --
>  sysdeps/gnu/errlist.awk                       |  110 --
>  sysdeps/gnu/errlist.c                         | 1495 -----------------
>  sysdeps/gnu/errlist.h                         |  448 +++++
>  sysdeps/mach/hurd/err_hurd.sub                |    5 +-
>  sysdeps/mach/hurd/errlist.c                   |   11 +-
>  sysdeps/unix/sysv/linux/Versions              |   10 -
>  sysdeps/unix/sysv/linux/alpha/Versions        |   12 -
>  .../unix/sysv/linux/alpha/errlist-compat.c    |   43 +
>  .../{bits/sys_errlist.h => errlist-compat.c}  |   29 +-
>  sysdeps/unix/sysv/linux/errlist-compat.h      |   43 +
>  sysdeps/unix/sysv/linux/hppa/Versions         |   10 -
>  sysdeps/unix/sysv/linux/hppa/errlist-compat.c |   39 +
>  sysdeps/unix/sysv/linux/mips/Versions         |    7 -
>  .../unix/sysv/linux/mips/errlist-compat.c     |   14 +-
>  sysdeps/unix/sysv/linux/sparc/Versions        |   10 -
>  .../unix/sysv/linux/sparc/errlist-compat.c    |   43 +
>  30 files changed, 764 insertions(+), 1898 deletions(-)
>  create mode 100644 stdio-common/errlist-compat.c
>  create mode 100755 stdio-common/tst-errno-manual.py
>  delete mode 100644 sysdeps/gnu/errlist-compat.awk
>  delete mode 100644 sysdeps/gnu/errlist.awk
>  delete mode 100644 sysdeps/gnu/errlist.c
>  create mode 100644 sysdeps/gnu/errlist.h
>  create mode 100644 sysdeps/unix/sysv/linux/alpha/errlist-compat.c
>  rename sysdeps/unix/sysv/linux/{bits/sys_errlist.h => errlist-compat.c} (56%)
>  create mode 100644 sysdeps/unix/sysv/linux/errlist-compat.h
>  create mode 100644 sysdeps/unix/sysv/linux/hppa/errlist-compat.c
>  rename bits/sys_errlist.h => sysdeps/unix/sysv/linux/mips/errlist-compat.c (69%)
>  create mode 100644 sysdeps/unix/sysv/linux/sparc/errlist-compat.c
>
> 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).

> +
>  Changes to build and runtime requirements:
>  
>  * powerpc64le requires GCC 7.4 or newer.  This is required for supporting
> diff --git a/include/stdio.h b/include/stdio.h
> index 9df98b2833..9e3bf6fe42 100644
> --- a/include/stdio.h
> +++ b/include/stdio.h
> @@ -186,7 +186,7 @@ ssize_t __libc_readline_unlocked (FILE *fp, char *buffer, size_t length);
>  libc_hidden_proto (__libc_readline_unlocked);
>  
>  extern const char *const _sys_errlist_internal[] attribute_hidden;
> -extern int _sys_nerr_internal attribute_hidden;
> +extern const char *__get_errlist (int) attribute_hidden;

OK.

>  
>  libc_hidden_ldbl_proto (__asprintf)
>  
> diff --git a/libio/Makefile b/libio/Makefile
> index 59e1f68e9c..926df1870b 100644
> --- a/libio/Makefile
> +++ b/libio/Makefile
> @@ -23,7 +23,7 @@ subdir := libio
>  include ../Makeconfig
>  
>  headers := stdio.h \
> -   bits/stdio.h bits/stdio2.h bits/sys_errlist.h bits/stdio-ldbl.h \
> +   bits/stdio.h bits/stdio2.h bits/stdio-ldbl.h \

OK. Remove header.

>     bits/types/FILE.h bits/types/__FILE.h bits/types/struct_FILE.h \
>     bits/types/__fpos_t.h bits/types/__fpos64_t.h \
>     bits/types/cookie_io_functions_t.h
> diff --git a/libio/stdio.h b/libio/stdio.h
> index 07f2d9afb5..998470943e 100644
> --- a/libio/stdio.h
> +++ b/libio/stdio.h
> @@ -779,12 +779,6 @@ extern int ferror_unlocked (FILE *__stream) __THROW __wur;
>     marked with __THROW.  */
>  extern void perror (const char *__s);
>  
> -/* Provide the declarations for `sys_errlist' and `sys_nerr' if they
> -   are available on this system.  Even if available, these variables
> -   should not be used directly.  The `strerror' function provides
> -   all the necessary functionality.  */
> -#include <bits/sys_errlist.h>

OK. Remove.

> -
>  
>  #ifdef __USE_POSIX
>  /* Return the system file descriptor for STREAM.  */
> diff --git a/scripts/build-many-glibcs.py b/scripts/build-many-glibcs.py
> index 8c72b9e571..07e9b457da 100755
> --- a/scripts/build-many-glibcs.py
> +++ b/scripts/build-many-glibcs.py
> @@ -892,8 +892,7 @@ class Context(object):
>          # Some other files have such dependencies but do not need to
>          # be touched because nothing in a build depends on the files
>          # in question.
> -        for f in ('sysdeps/gnu/errlist.c',
> -                  'sysdeps/mach/hurd/bits/errno.h'):
> +        for f in ('sysdeps/mach/hurd/bits/errno.h',):

OK. Remove one more auto-generated file! Yay!

>              to_touch = os.path.join(srcdir, f)
>              subprocess.run(['touch', '-c', to_touch], check=True)
>          for dirpath, dirnames, filenames in os.walk(srcdir):
> diff --git a/stdio-common/Makefile b/stdio-common/Makefile
> index 0a8d66b846..8f15eb7e56 100644
> --- a/stdio-common/Makefile
> +++ b/stdio-common/Makefile
> @@ -84,6 +84,8 @@ generated += tst-printf-bz18872.c tst-printf-bz18872.mtrace \
>       tst-printf-bz25691.mtrace tst-printf-bz25691-mem.out
>  endif
>  
> +tests-special += $(objpfx)tst-errno-manual.out

OK.

> +
>  include ../Rules
>  
>  ifeq ($(run-built-tests),yes)
> @@ -128,6 +130,15 @@ $(objpfx)tst-%-mem.out: $(objpfx)tst-%.out
>   $(common-objpfx)malloc/mtrace $(objpfx)tst-$*.mtrace > $@; \
>   $(evaluate-test)
>  
> +errlist-h = $(firstword $(wildcard $(addsuffix /errlist.h,$(sysdirs) .)))
> +
> +$(objpfx)tst-errno-manual.out: tst-errno-manual.py \
> +       $(errlist-h) \
> +       $(..)manual/errno.texi
> + $(PYTHON) tst-errno-manual.py -m $(..)manual/errno.texi \
> +      -e $(errlist-h) > $@; \
> + $(evaluate-test)

OK.

> +
>  CFLAGS-vfprintf.c += -Wno-uninitialized
>  CFLAGS-vfwprintf.c += -Wno-uninitialized
>  
> diff --git a/stdio-common/errlist-compat.c b/stdio-common/errlist-compat.c
> new file mode 100644
> index 0000000000..6e25b021ab
> --- /dev/null
> +++ b/stdio-common/errlist-compat.c
> @@ -0,0 +1 @@
> +/* Empty.  */

OK.

> diff --git a/stdio-common/errlist.c b/stdio-common/errlist.c
> index 91fa789be0..df52356066 100644
> --- a/stdio-common/errlist.c
> +++ b/stdio-common/errlist.c
> @@ -15,22 +15,24 @@
>     License along with the GNU C Library; if not, see
>     <https://www.gnu.org/licenses/>.  */
>  
> +#include <stdio.h>
> +#include <errno.h>
> +#include <libintl.h>
>  #include <array_length.h>
> -#include <stddef.h>
>  
> -const char *const _sys_errlist[] =
> +const char *const _sys_errlist_internal[] =
>    {
> -    "Error 0", /* 0 */
> -    "Argument out of function's domain", /* 1 = EDOM */
> -    "Result out of range", /* 2 = ERANGE */
> -    "Operation not implemented", /* 3 = ENOSYS */
> -    "Invalid argument", /* 4 = EINVAL */
> -    "Illegal seek", /* 5 = ESPIPE */
> -    "Bad file descriptor", /* 6 = EBADF */
> -    "Cannot allocate memory", /* 7 = ENOMEM */
> -    "Permission denied", /* 8 = EACCES */
> -    "Too many open files in system", /* 9 = ENFILE */
> -    "Too many open files", /* 10 = EMFILE */
> +#define _S(n, str)         [n] = str,
> +#include <errlist.h>
> +#undef _S

OK.

>    };
>  
> -const int _sys_nerr = array_length (_sys_errlist);
> +const char *
> +__get_errlist (int errnum)
> +{
> +  if (errnum >= 0 && errnum < array_length (_sys_errlist_internal))
> +    return _sys_errlist_internal[errnum];
> +  return NULL;
> +}
> +
> +#include <errlist-compat.c>

OK.

> diff --git a/stdio-common/tst-errno-manual.py b/stdio-common/tst-errno-manual.py
> new file mode 100755
> index 0000000000..618120f4f0
> --- /dev/null
> +++ b/stdio-common/tst-errno-manual.py
> @@ -0,0 +1,73 @@
> +#!/usr/bin/python3
> +# Check is all errno definitions at errlist.h documented in the manual.
> +# 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/>.
> +
> +import argparse
> +import sys
> +import re
> +
> +RE_MANUAL = re.compile(
> +    r'(?:^@errno){(\w+)')
> +
> +RE_ERRLIST = re.compile(
> +    r'\(E[a-zA-Z0-9]+\)')
> +
> +PASS=0
> +FAIL=1
> +
> +# Each manual entry is in the form:
> +#
> +#  errno{EAGAIN, 35, Resource temporarily unavailable}
> +def parse_manual(f):
> +    errlist = [RE_MANUAL.findall(s) for s in f]
> +    return map(lambda x : x[0], filter(None, errlist))
> +
> +# Each errlist entry is in the form:
> +#
> +#  _S(ERR_MAP(EAGAIN), N_("Resource temporarily unavailable"))
> +def parse_errlist(f):
> +    errlist = [RE_ERRLIST.findall(s) for s in f]
> +    # Each element is '[]' or '['(EAGAIN)']'
> +    return map(lambda s : s[0][s[0].find('(')+1:s[0].find(')')],
> +               filter(None, errlist))
> +
> +def check_errno_definitions(manual_fname, errlist_fname):
> +    with open(manual_fname, 'r') as mfile, open(errlist_fname, 'r') as efile:
> +        merr = parse_manual(mfile)
> +        eerr = parse_errlist(efile)
> +        diff = set(eerr).difference(merr)
> +        if not diff:
> +            sys.exit(PASS)
> +        else:
> +            print("Failure: the following value(s) are not in manual:",
> +                  ", ".join(str(e) for e in diff))
> +            sys.exit(FAIL)
> +
> +def main():
> +    parser = argparse.ArgumentParser(description='Generate errlist.h')
> +    parser.add_argument('-m', dest='manual', metavar='FILE',
> +                        help='manual errno texi file')
> +    parser.add_argument('-e', dest='errlist', metavar='FILE',
> +                        help='errlist with errno definitions')
> +    args = parser.parse_args()
> +
> +    check_errno_definitions(args.manual, args.errlist)
> +
> +
> +if __name__ == '__main__':
> +    main()

OK.

> diff --git a/string/_strerror.c b/string/_strerror.c
> index af6be56fdc..01226e3d4b 100644
> --- a/string/_strerror.c
> +++ b/string/_strerror.c
> @@ -36,8 +36,8 @@
>  char *
>  __strerror_r (int errnum, char *buf, size_t buflen)
>  {
> -  if (__builtin_expect (errnum < 0 || errnum >= _sys_nerr_internal
> - || _sys_errlist_internal[errnum] == NULL, 0))
> +  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.  */
> @@ -68,7 +68,7 @@ __strerror_r (int errnum, char *buf, size_t buflen)
>        return buf;
>      }
>  
> -  return (char *) _(_sys_errlist_internal[errnum]);
> +  return _(err);

OK.

>  }
>  weak_alias (__strerror_r, strerror_r)
>  libc_hidden_def (__strerror_r)
> diff --git a/string/strerror_l.c b/string/strerror_l.c
> index c8c3d4a6ef..309f42e66b 100644
> --- a/string/strerror_l.c
> +++ b/string/strerror_l.c
> @@ -40,10 +40,8 @@ translate (const char *str, locale_t loc)
>  char *
>  strerror_l (int errnum, locale_t loc)
>  {
> -
> -
> -  if (__builtin_expect (errnum < 0 || errnum >= _sys_nerr_internal
> - || _sys_errlist_internal[errnum] == NULL, 0))
> +  char *err = (char *) __get_errlist (errnum);
> +  if (__glibc_unlikely (err == NULL))
>      {
>        free (last_value);
>        if (__asprintf (&last_value, "%s%d",
> @@ -53,7 +51,7 @@ strerror_l (int errnum, locale_t loc)
>        return last_value;
>      }
>  
> -  return (char *) translate (_sys_errlist_internal[errnum], loc);
> +  return (char *) translate (err, loc);

OK.

>  }
>  
>  void
> diff --git a/string/xpg-strerror.c b/string/xpg-strerror.c
> index 5290b63f18..95311b75e9 100644
> --- a/string/xpg-strerror.c
> +++ b/string/xpg-strerror.c
> @@ -32,16 +32,9 @@ __xpg_strerror_r (int errnum, char *buf, size_t buflen)
>       string) if errnum is invalid, otherwise it returns a string whose
>       storage has indefinite extent.  */
>    if (estr == buf)
> -    {
> -      assert (errnum < 0 || errnum >= _sys_nerr_internal
> -      || _sys_errlist_internal[errnum] == NULL);
> -      return EINVAL;
> -    }
> +    return EINVAL;
>    else
>      {
> -      assert (errnum >= 0 && errnum < _sys_nerr_internal
> -      && _sys_errlist_internal[errnum] != NULL);
> -

OK.

>        size_t estrlen = strlen (estr);
>  
>        /* Terminate the string in any case.  */
> diff --git a/sysdeps/gnu/Makefile b/sysdeps/gnu/Makefile
> index 97fcb6fb90..9cf34c8ac6 100644
> --- a/sysdeps/gnu/Makefile
> +++ b/sysdeps/gnu/Makefile
> @@ -15,49 +15,6 @@
>  # License along with the GNU C Library; if not, see
>  # <https://www.gnu.org/licenses/>.
>  
> -# Generate the list of strings for errno codes from the section of the
> -# manual which documents the codes.
> -
> -$(..)sysdeps/gnu/errlist.c: $(..)sysdeps/gnu/errlist.awk \
> -    $(..)manual/errno.texi
> - $(AWK) -f $^ > $@-tmp
> -# Make it unwritable so noone will edit it by mistake.
> - -chmod a-w $@-tmp
> - mv -f $@-tmp $@
> -
> -ifeq ($(subdir),stdio-common)
> -
> -errlist-c = $(firstword $(wildcard $(addsuffix /errlist.c,$(sysdirs) .)))
> -
> -libof-errlist-compat = extramodules
> -
> -ifeq ($(build-shared),yes)
> -$(objpfx)errlist-compat.c: $(errlist-c) $(..)sysdeps/gnu/errlist-compat.awk \
> -   $(common-objpfx)Versions.v.i $(before-compile)
> -else
> -$(objpfx)errlist-compat.c: $(errlist-c) $(..)sysdeps/gnu/errlist-compat.awk \
> -   $(before-compile)
> -endif
> - $(make-target-directory)
> - $(AWK) -v maxerr=`\
> -  $(CC) -S $(CPPFLAGS) $(CFLAGS) -DEMIT_ERR_MAX $< -o - \
> -  | sed -n 's/^.*@@@[^0-9]*\([0-9]*\)[^0-9]*@@@.*$$/\1/p'` \
> -       -f $(..)sysdeps/gnu/errlist-compat.awk \
> -       $(wildcard $(sysdirs:=/Versions)) > $@T
> -# Make it unwritable so noone will edit it by mistake.
> - -chmod a-w $@T
> - mv -f $@T $@
> -$(objpfx)errlist-compat.h: $(objpfx)errlist-compat.c
> - sed -n '1p;/ERR_MAX/p' $< > $@T
> - -chmod a-w $@T
> - mv -f $@T $@
> -generated += errlist-compat.c errlist-compat.h
> -
> -# This will force the generation above to happy if need be.
> -$(foreach o,$(object-suffixes) $(object-suffixes:=.d),\
> -  $(objpfx)errlist$o): $(objpfx)errlist-compat.h
> -endif
> -

OK.

>  ifeq ($(subdir),login)
>  sysdep_routines += setutxent getutxent endutxent getutxid getutxline \
>     pututxline utmpxname updwtmpx getutmpx getutmp
> diff --git a/sysdeps/gnu/errlist-compat.awk b/sysdeps/gnu/errlist-compat.awk
> deleted file mode 100644
> index 07334c63d8..0000000000
> --- a/sysdeps/gnu/errlist-compat.awk
> +++ /dev/null
> @@ -1,133 +0,0 @@
> -# awk script to generate errlist-compat.c
> -# Copyright (C) 2002-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/>.
> -
> -#
> -# This script takes the Versions file as input and looks for #errlist-compat
> -# magic comments, which have the form:
> -# #errlist-compat NNN
> -# where NNN is the number of elements in the sys_errlist for that version set.
> -# We need the awk variable `maxerr' defined to the current size of sys_errlist.
> -#
> -# If there is no magic comment matching the current size, we barf.
> -# Otherwise we generate code (errlist-compat.c) to define all the
> -# necessary compatibility symbols for older, smaller versions of sys_errlist.
> -#
> -
> -# These two rules catch the Versions file contents.
> -NF == 2 && $2 == "{" { last_version = $1; next }
> -$1 == "#errlist-compat" {
> -  # Don't process any further Versions files
> -  ARGC = ARGIND + 1;
> -  cnt = $2 + 0;
> -  if (cnt < 80) {
> -    print "*** this line seems bogus:", $0 > "/dev/stderr";
> -    exit 1;
> -  }
> -  version[pos + 0] = cnt SUBSEP last_version;
> -  pos++;
> -  if (cnt < highest) {
> -    printf "*** %s #errlist-compat counts are not sorted\n", ARGV[ARGIND];
> -    exit 1;
> -  }
> -  if (cnt > highest)
> -    highest = cnt;
> -  highest_version = last_version;
> -  next;
> -}
> -
> -END {
> -  if (! highest_version) {
> -    print "/* No sys_errlist/sys_nerr symbols defined on this platform.  */";
> -    exit 0;
> -  }
> -
> -  count = maxerr + 1;
> -
> -  if (highest < count) {
> -    printf "*** errlist.c count %d vs Versions sys_errlist@%s count %d\n", \
> -      count, highest_version, highest > "/dev/stderr";
> -    exit 1;
> -  }
> -
> -  lastv = "";
> -  for (n = 0; n < pos; ++n) {
> -    split(version[n], t, SUBSEP)
> -    v = t[2];
> -    gsub(/[^A-Z0-9_]/, "_", v);
> -    if (lastv != "")
> -      compat[lastv] = v;
> -    lastv = v;
> -    vcount[v] = t[1];
> -  }
> -
> -  print "/* This file was generated by errlist-compat.awk; DO NOT EDIT!  */\n";
> -  print "#include <shlib-compat.h>\n";
> -
> -  if (highest > count) {
> -    printf "*** errlist.c count %d inflated to %s count %d (old errno.h?)\n", \
> -      count, highest_version, highest > "/dev/stderr";
> -    printf "#define ERR_MAX %d\n\n", highest - 1;
> -  }
> -
> -  # same regardless of awk's ordering of the associative array.
> -  num_compat_elems = asorti(compat, compat_indices)
> -  for (i = 1; i <= num_compat_elems; i++) {
> -    old = compat_indices[i]
> -    new = compat[old];
> -    n = vcount[old];
> -    printf "#if SHLIB_COMPAT (libc, %s, %s)\n", old, new;
> -    printf "# include <bits/wordsize.h>\n";
> -    printf "extern const char *const __sys_errlist_%s[NERR];\n", old;
> -    printf "const int __sys_nerr_%s = %d;\n", old, n;
> -    printf "declare_symbol_alias (__sys_errlist_%s, _sys_errlist_internal,", \
> -      old;
> -    printf " object, __WORDSIZE/8*%d)\n", n;
> -    printf "compat_symbol (libc, __sys_errlist_%s, sys_errlist, %s);\n", \
> -      old, old;
> -    printf "compat_symbol (libc, __sys_nerr_%s, sys_nerr, %s);\n", old, old;
> -
> -    printf "extern const char *const ___sys_errlist_%s[NERR];\n", old;
> -    printf "extern const int __sys_nerr_%s;\n", old;
> -    printf "declare_symbol_alias (___sys_errlist_%s, _sys_errlist_internal,", \
> -      old;
> -    printf " object, __WORDSIZE/8*%d)\n", n;
> -    printf "strong_alias (__sys_nerr_%s, ___sys_nerr_%s)\n", old, old;
> -    printf "compat_symbol (libc, ___sys_errlist_%s, _sys_errlist, %s);\n", \
> -      old, old;
> -    printf "compat_symbol (libc, ___sys_nerr_%s, _sys_nerr, %s);\n", old, old;
> -    printf "#endif\n\n";
> -  }
> -
> -  printf "\
> -extern const char *const __sys_errlist_internal[NERR];\n\
> -extern const int __sys_nerr_internal;\n\
> -strong_alias (_sys_errlist_internal, __sys_errlist_internal)\n\
> -strong_alias (_sys_nerr_internal, __sys_nerr_internal)\n\
> -extern const char *const sys_errlist[NERR];\n\
> -versioned_symbol (libc, _sys_errlist_internal, sys_errlist, %s);\n\
> -versioned_symbol (libc, __sys_errlist_internal, _sys_errlist, %s);\n\
> -versioned_symbol (libc, _sys_nerr_internal, sys_nerr, %s);\n\
> -versioned_symbol (libc, __sys_nerr_internal, _sys_nerr, %s);\n", \
> -    lastv, lastv, lastv, lastv;
> -
> -  print "\n\
> -link_warning (sys_errlist, \"\
> -`sys_errlist' is deprecated; use `strerror' or `strerror_r' instead\")\n\
> -link_warning (sys_nerr, \"\
> -`sys_nerr' is deprecated; use `strerror' or `strerror_r' instead\")";
> -}

OK. I like removing awk that generates C code :-)

> diff --git a/sysdeps/gnu/errlist.awk b/sysdeps/gnu/errlist.awk
> deleted file mode 100644
> index 09f80f5b44..0000000000
> --- a/sysdeps/gnu/errlist.awk
> +++ /dev/null
> @@ -1,110 +0,0 @@
> -# Copyright (C) 1991-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/>.
> -
> -# errno.texi contains lines like:
> -# @deftypevr Macro int ENOSYS
> -# @errno{ENOSYS, 78, Function not implemented}
> -# Descriptive paragraph...
> -# @end deftypevr
> -
> -BEGIN {
> -
> -    # Here we list the E* names that might be duplicate names for the
> -    # same integer value on some systems.  This causes the code below
> -    # to generate ``#if defined (ALIAS) && ALIAS != ORIGINAL'' in the code,
> -    # so the output does not presume that these are in fact aliases.
> -    # We list here all the known potential cases on any system,
> -    # so that the C source we produce will do the right thing based
> -    # on the actual #define'd values it's compiled with.
> -    alias["EWOULDBLOCK"]= "EAGAIN";
> -    alias["EDEADLOCK"] = "EDEADLK";
> -    alias["ENOTSUP"] = "EOPNOTSUPP";
> -
> -    print "/* This file is generated from errno.texi by errlist.awk.  */"
> -    print "";
> -    print "#include <errno.h>";
> -    print "#include <libintl.h>";
> -    print "";
> -    print "#ifndef ERR_REMAP";
> -    print "# define ERR_REMAP(n) n";
> -    print "#endif";
> -    print "";
> -
> -    print "#if !defined EMIT_ERR_MAX && !defined ERRLIST_NO_COMPAT";
> -    print "# include <errlist-compat.h>";
> -    print "#endif";
> -    print "#ifdef ERR_MAX";
> -    print "# define ERRLIST_SIZE ERR_MAX + 1";
> -    print "#else"
> -    print "# define ERR_MAX 0";
> -    print "# define ERRLIST_SIZE";
> -    print "#endif";
> -
> -    print "const char *const _sys_errlist_internal[ERRLIST_SIZE] =";
> -    print "  {";
> -    print "    [0] = N_(\"Success\"),"
> -  }
> -
> -/^@errno\{/ \
> -  {
> -    etext = $3;
> -    for (i = 4; i <= NF; ++i)
> -      etext = etext " " $i;
> -    etext = substr(etext, 1, length(etext)-1)
> -    e = substr($1, 8, length($1)-8)
> -    errno = substr($2, 1, length($2)-1) + 0
> -    if (alias[e])
> -      printf "#if defined (%s) && %s != %s\n", e, e, alias[e];
> -    else
> -      printf "#ifdef %s\n", e;
> -    errnoh = 4;
> -    desc="";
> -    next;
> -  }
> -errnoh == 4 && $1 == "@end" && $2 == "deftypevr" \
> -  {
> -    printf "/*%s */\n", desc;
> -    printf "    [ERR_REMAP (%s)] = N_(\"%s\"),\n", e, etext;
> -    printf "# if %s > ERR_MAX\n", e;
> -    print  "# undef ERR_MAX";
> -    printf "# define ERR_MAX %s\n", e;
> -    print  "# endif";
> -    print "#endif";
> -    errnoh = 0;
> -    next;
> -  }
> -errnoh == 4 \
> -  {
> -    # This magic tag in C comments gets them copied into libc.pot.
> -    desc = desc "\nTRANS" ($0 != "" ? " " : "") $0; next
> -  }
> -END {
> -  print "  };";
> -  print "";
> -  print "#define NERR \\";
> -  print "  (sizeof _sys_errlist_internal / sizeof _sys_errlist_internal [0])";
> -  print "const int _sys_nerr_internal = NERR;"
> -  print "";
> -  print "#if IS_IN (libc) && !defined ERRLIST_NO_COMPAT";
> -  print "# include <errlist-compat.c>";
> -  print "#endif";
> -  print "";
> -  print "#ifdef EMIT_ERR_MAX";
> -  print "void dummy (void)"
> -  print "{ asm volatile (\" @@@ %0 @@@ \" : : \"i\" (ERR_REMAP (ERR_MAX))); }"
> -  print "#endif";
> -}
> diff --git a/sysdeps/gnu/errlist.c b/sysdeps/gnu/errlist.c
> deleted file mode 100644
> index 77577bf3e1..0000000000
> --- a/sysdeps/gnu/errlist.c
> +++ /dev/null
> @@ -1,1495 +0,0 @@
> -/* This file is generated from errno.texi by errlist.awk.  */
> -
> -#include <errno.h>
> -#include <libintl.h>
> -
> -#ifndef ERR_REMAP
> -# define ERR_REMAP(n) n
> -#endif
> -
> -#if !defined EMIT_ERR_MAX && !defined ERRLIST_NO_COMPAT
> -# include <errlist-compat.h>
> -#endif
> -#ifdef ERR_MAX
> -# define ERRLIST_SIZE ERR_MAX + 1
> -#else
> -# define ERR_MAX 0
> -# define ERRLIST_SIZE
> -#endif
> -const char *const _sys_errlist_internal[ERRLIST_SIZE] =
> -  {
> -    [0] = N_("Success"),
> -#ifdef EPERM
> -/*
> -TRANS Only the owner of the file (or other resource)
> -TRANS or processes with special privileges can perform the operation. */
> -    [ERR_REMAP (EPERM)] = N_("Operation not permitted"),
> -# if EPERM > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EPERM
> -# endif
> -#endif
> -#ifdef ENOENT
> -/*
> -TRANS This is a ``file doesn't exist'' error
> -TRANS for ordinary files that are referenced in contexts where they are
> -TRANS expected to already exist. */
> -    [ERR_REMAP (ENOENT)] = N_("No such file or directory"),
> -# if ENOENT > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX ENOENT
> -# endif
> -#endif
> -#ifdef ESRCH
> -/*
> -TRANS No process matches the specified process ID. */
> -    [ERR_REMAP (ESRCH)] = N_("No such process"),
> -# if ESRCH > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX ESRCH
> -# endif
> -#endif
> -#ifdef EINTR
> -/*
> -TRANS An asynchronous signal occurred and prevented
> -TRANS completion of the call.  When this happens, you should try the call
> -TRANS again.
> -TRANS
> -TRANS You can choose to have functions resume after a signal that is handled,
> -TRANS rather than failing with @code{EINTR}; see @ref{Interrupted
> -TRANS Primitives}. */
> -    [ERR_REMAP (EINTR)] = N_("Interrupted system call"),
> -# if EINTR > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EINTR
> -# endif
> -#endif
> -#ifdef EIO
> -/*
> -TRANS Usually used for physical read or write errors. */
> -    [ERR_REMAP (EIO)] = N_("Input/output error"),
> -# if EIO > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EIO
> -# endif
> -#endif
> -#ifdef ENXIO
> -/*
> -TRANS The system tried to use the device
> -TRANS represented by a file you specified, and it couldn't find the device.
> -TRANS This can mean that the device file was installed incorrectly, or that
> -TRANS the physical device is missing or not correctly attached to the
> -TRANS computer. */
> -    [ERR_REMAP (ENXIO)] = N_("No such device or address"),
> -# if ENXIO > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX ENXIO
> -# endif
> -#endif
> -#ifdef E2BIG
> -/*
> -TRANS Used when the arguments passed to a new program
> -TRANS being executed with one of the @code{exec} functions (@pxref{Executing a
> -TRANS File}) occupy too much memory space.  This condition never arises on
> -TRANS @gnuhurdsystems{}. */
> -    [ERR_REMAP (E2BIG)] = N_("Argument list too long"),
> -# if E2BIG > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX E2BIG
> -# endif
> -#endif
> -#ifdef ENOEXEC
> -/*
> -TRANS Invalid executable file format.  This condition is detected by the
> -TRANS @code{exec} functions; see @ref{Executing a File}. */
> -    [ERR_REMAP (ENOEXEC)] = N_("Exec format error"),
> -# if ENOEXEC > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX ENOEXEC
> -# endif
> -#endif
> -#ifdef EBADF
> -/*
> -TRANS For example, I/O on a descriptor that has been
> -TRANS closed or reading from a descriptor open only for writing (or vice
> -TRANS versa). */
> -    [ERR_REMAP (EBADF)] = N_("Bad file descriptor"),
> -# if EBADF > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EBADF
> -# endif
> -#endif
> -#ifdef ECHILD
> -/*
> -TRANS This error happens on operations that are
> -TRANS supposed to manipulate child processes, when there aren't any processes
> -TRANS to manipulate. */
> -    [ERR_REMAP (ECHILD)] = N_("No child processes"),
> -# if ECHILD > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX ECHILD
> -# endif
> -#endif
> -#ifdef EDEADLK
> -/*
> -TRANS Allocating a system resource would have resulted in a
> -TRANS deadlock situation.  The system does not guarantee that it will notice
> -TRANS all such situations.  This error means you got lucky and the system
> -TRANS noticed; it might just hang.  @xref{File Locks}, for an example. */
> -    [ERR_REMAP (EDEADLK)] = N_("Resource deadlock avoided"),
> -# if EDEADLK > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EDEADLK
> -# endif
> -#endif
> -#ifdef ENOMEM
> -/*
> -TRANS The system cannot allocate more virtual memory
> -TRANS because its capacity is full. */
> -    [ERR_REMAP (ENOMEM)] = N_("Cannot allocate memory"),
> -# if ENOMEM > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX ENOMEM
> -# endif
> -#endif
> -#ifdef EACCES
> -/*
> -TRANS The file permissions do not allow the attempted operation. */
> -    [ERR_REMAP (EACCES)] = N_("Permission denied"),
> -# if EACCES > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EACCES
> -# endif
> -#endif
> -#ifdef EFAULT
> -/*
> -TRANS An invalid pointer was detected.
> -TRANS On @gnuhurdsystems{}, this error never happens; you get a signal instead. */
> -    [ERR_REMAP (EFAULT)] = N_("Bad address"),
> -# if EFAULT > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EFAULT
> -# endif
> -#endif
> -#ifdef ENOTBLK
> -/*
> -TRANS A file that isn't a block special file was given in a situation that
> -TRANS requires one.  For example, trying to mount an ordinary file as a file
> -TRANS system in Unix gives this error. */
> -    [ERR_REMAP (ENOTBLK)] = N_("Block device required"),
> -# if ENOTBLK > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX ENOTBLK
> -# endif
> -#endif
> -#ifdef EBUSY
> -/*
> -TRANS A system resource that can't be shared is already in use.
> -TRANS For example, if you try to delete a file that is the root of a currently
> -TRANS mounted filesystem, you get this error. */
> -    [ERR_REMAP (EBUSY)] = N_("Device or resource busy"),
> -# if EBUSY > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EBUSY
> -# endif
> -#endif
> -#ifdef EEXIST
> -/*
> -TRANS An existing file was specified in a context where it only
> -TRANS makes sense to specify a new file. */
> -    [ERR_REMAP (EEXIST)] = N_("File exists"),
> -# if EEXIST > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EEXIST
> -# endif
> -#endif
> -#ifdef EXDEV
> -/*
> -TRANS An attempt to make an improper link across file systems was detected.
> -TRANS This happens not only when you use @code{link} (@pxref{Hard Links}) but
> -TRANS also when you rename a file with @code{rename} (@pxref{Renaming Files}). */
> -    [ERR_REMAP (EXDEV)] = N_("Invalid cross-device link"),
> -# if EXDEV > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EXDEV
> -# endif
> -#endif
> -#ifdef ENODEV
> -/*
> -TRANS The wrong type of device was given to a function that expects a
> -TRANS particular sort of device. */
> -    [ERR_REMAP (ENODEV)] = N_("No such device"),
> -# if ENODEV > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX ENODEV
> -# endif
> -#endif
> -#ifdef ENOTDIR
> -/*
> -TRANS A file that isn't a directory was specified when a directory is required. */
> -    [ERR_REMAP (ENOTDIR)] = N_("Not a directory"),
> -# if ENOTDIR > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX ENOTDIR
> -# endif
> -#endif
> -#ifdef EISDIR
> -/*
> -TRANS You cannot open a directory for writing,
> -TRANS or create or remove hard links to it. */
> -    [ERR_REMAP (EISDIR)] = N_("Is a directory"),
> -# if EISDIR > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EISDIR
> -# endif
> -#endif
> -#ifdef EINVAL
> -/*
> -TRANS This is used to indicate various kinds of problems
> -TRANS with passing the wrong argument to a library function. */
> -    [ERR_REMAP (EINVAL)] = N_("Invalid argument"),
> -# if EINVAL > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EINVAL
> -# endif
> -#endif
> -#ifdef EMFILE
> -/*
> -TRANS The current process has too many files open and can't open any more.
> -TRANS Duplicate descriptors do count toward this limit.
> -TRANS
> -TRANS In BSD and GNU, the number of open files is controlled by a resource
> -TRANS limit that can usually be increased.  If you get this error, you might
> -TRANS want to increase the @code{RLIMIT_NOFILE} limit or make it unlimited;
> -TRANS @pxref{Limits on Resources}. */
> -    [ERR_REMAP (EMFILE)] = N_("Too many open files"),
> -# if EMFILE > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EMFILE
> -# endif
> -#endif
> -#ifdef ENFILE
> -/*
> -TRANS There are too many distinct file openings in the entire system.  Note
> -TRANS that any number of linked channels count as just one file opening; see
> -TRANS @ref{Linked Channels}.  This error never occurs on @gnuhurdsystems{}. */
> -    [ERR_REMAP (ENFILE)] = N_("Too many open files in system"),
> -# if ENFILE > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX ENFILE
> -# endif
> -#endif
> -#ifdef ENOTTY
> -/*
> -TRANS Inappropriate I/O control operation, such as trying to set terminal
> -TRANS modes on an ordinary file. */
> -    [ERR_REMAP (ENOTTY)] = N_("Inappropriate ioctl for device"),
> -# if ENOTTY > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX ENOTTY
> -# endif
> -#endif
> -#ifdef ETXTBSY
> -/*
> -TRANS An attempt to execute a file that is currently open for writing, or
> -TRANS write to a file that is currently being executed.  Often using a
> -TRANS debugger to run a program is considered having it open for writing and
> -TRANS will cause this error.  (The name stands for ``text file busy''.)  This
> -TRANS is not an error on @gnuhurdsystems{}; the text is copied as necessary. */
> -    [ERR_REMAP (ETXTBSY)] = N_("Text file busy"),
> -# if ETXTBSY > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX ETXTBSY
> -# endif
> -#endif
> -#ifdef EFBIG
> -/*
> -TRANS The size of a file would be larger than allowed by the system. */
> -    [ERR_REMAP (EFBIG)] = N_("File too large"),
> -# if EFBIG > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EFBIG
> -# endif
> -#endif
> -#ifdef ENOSPC
> -/*
> -TRANS Write operation on a file failed because the
> -TRANS disk is full. */
> -    [ERR_REMAP (ENOSPC)] = N_("No space left on device"),
> -# if ENOSPC > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX ENOSPC
> -# endif
> -#endif
> -#ifdef ESPIPE
> -/*
> -TRANS Invalid seek operation (such as on a pipe). */
> -    [ERR_REMAP (ESPIPE)] = N_("Illegal seek"),
> -# if ESPIPE > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX ESPIPE
> -# endif
> -#endif
> -#ifdef EROFS
> -/*
> -TRANS An attempt was made to modify something on a read-only file system. */
> -    [ERR_REMAP (EROFS)] = N_("Read-only file system"),
> -# if EROFS > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EROFS
> -# endif
> -#endif
> -#ifdef EMLINK
> -/*
> -TRANS The link count of a single file would become too large.
> -TRANS @code{rename} can cause this error if the file being renamed already has
> -TRANS as many links as it can take (@pxref{Renaming Files}). */
> -    [ERR_REMAP (EMLINK)] = N_("Too many links"),
> -# if EMLINK > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EMLINK
> -# endif
> -#endif
> -#ifdef EPIPE
> -/*
> -TRANS There is no process reading from the other end of a pipe.
> -TRANS Every library function that returns this error code also generates a
> -TRANS @code{SIGPIPE} signal; this signal terminates the program if not handled
> -TRANS or blocked.  Thus, your program will never actually see @code{EPIPE}
> -TRANS unless it has handled or blocked @code{SIGPIPE}. */
> -    [ERR_REMAP (EPIPE)] = N_("Broken pipe"),
> -# if EPIPE > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EPIPE
> -# endif
> -#endif
> -#ifdef EDOM
> -/*
> -TRANS Used by mathematical functions when an argument value does
> -TRANS not fall into the domain over which the function is defined. */
> -    [ERR_REMAP (EDOM)] = N_("Numerical argument out of domain"),
> -# if EDOM > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EDOM
> -# endif
> -#endif
> -#ifdef ERANGE
> -/*
> -TRANS Used by mathematical functions when the result value is
> -TRANS not representable because of overflow or underflow. */
> -    [ERR_REMAP (ERANGE)] = N_("Numerical result out of range"),
> -# if ERANGE > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX ERANGE
> -# endif
> -#endif
> -#ifdef EAGAIN
> -/*
> -TRANS The call might work if you try again
> -TRANS later.  The macro @code{EWOULDBLOCK} is another name for @code{EAGAIN};
> -TRANS they are always the same in @theglibc{}.
> -TRANS
> -TRANS This error can happen in a few different situations:
> -TRANS
> -TRANS @itemize @bullet
> -TRANS @item
> -TRANS An operation that would block was attempted on an object that has
> -TRANS non-blocking mode selected.  Trying the same operation again will block
> -TRANS until some external condition makes it possible to read, write, or
> -TRANS connect (whatever the operation).  You can use @code{select} to find out
> -TRANS when the operation will be possible; @pxref{Waiting for I/O}.
> -TRANS
> -TRANS @strong{Portability Note:} In many older Unix systems, this condition
> -TRANS was indicated by @code{EWOULDBLOCK}, which was a distinct error code
> -TRANS different from @code{EAGAIN}.  To make your program portable, you should
> -TRANS check for both codes and treat them the same.
> -TRANS
> -TRANS @item
> -TRANS A temporary resource shortage made an operation impossible.  @code{fork}
> -TRANS can return this error.  It indicates that the shortage is expected to
> -TRANS pass, so your program can try the call again later and it may succeed.
> -TRANS It is probably a good idea to delay for a few seconds before trying it
> -TRANS again, to allow time for other processes to release scarce resources.
> -TRANS Such shortages are usually fairly serious and affect the whole system,
> -TRANS so usually an interactive program should report the error to the user
> -TRANS and return to its command loop.
> -TRANS @end itemize */
> -    [ERR_REMAP (EAGAIN)] = N_("Resource temporarily unavailable"),
> -# if EAGAIN > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EAGAIN
> -# endif
> -#endif
> -#if defined (EWOULDBLOCK) && EWOULDBLOCK != EAGAIN
> -/*
> -TRANS In @theglibc{}, this is another name for @code{EAGAIN} (above).
> -TRANS The values are always the same, on every operating system.
> -TRANS
> -TRANS C libraries in many older Unix systems have @code{EWOULDBLOCK} as a
> -TRANS separate error code. */
> -    [ERR_REMAP (EWOULDBLOCK)] = N_("Operation would block"),
> -# if EWOULDBLOCK > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EWOULDBLOCK
> -# endif
> -#endif
> -#ifdef EINPROGRESS
> -/*
> -TRANS An operation that cannot complete immediately was initiated on an object
> -TRANS that has non-blocking mode selected.  Some functions that must always
> -TRANS block (such as @code{connect}; @pxref{Connecting}) never return
> -TRANS @code{EAGAIN}.  Instead, they return @code{EINPROGRESS} to indicate that
> -TRANS the operation has begun and will take some time.  Attempts to manipulate
> -TRANS the object before the call completes return @code{EALREADY}.  You can
> -TRANS use the @code{select} function to find out when the pending operation
> -TRANS has completed; @pxref{Waiting for I/O}. */
> -    [ERR_REMAP (EINPROGRESS)] = N_("Operation now in progress"),
> -# if EINPROGRESS > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EINPROGRESS
> -# endif
> -#endif
> -#ifdef EALREADY
> -/*
> -TRANS An operation is already in progress on an object that has non-blocking
> -TRANS mode selected. */
> -    [ERR_REMAP (EALREADY)] = N_("Operation already in progress"),
> -# if EALREADY > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EALREADY
> -# endif
> -#endif
> -#ifdef ENOTSOCK
> -/*
> -TRANS A file that isn't a socket was specified when a socket is required. */
> -    [ERR_REMAP (ENOTSOCK)] = N_("Socket operation on non-socket"),
> -# if ENOTSOCK > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX ENOTSOCK
> -# endif
> -#endif
> -#ifdef EMSGSIZE
> -/*
> -TRANS The size of a message sent on a socket was larger than the supported
> -TRANS maximum size. */
> -    [ERR_REMAP (EMSGSIZE)] = N_("Message too long"),
> -# if EMSGSIZE > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EMSGSIZE
> -# endif
> -#endif
> -#ifdef EPROTOTYPE
> -/*
> -TRANS The socket type does not support the requested communications protocol. */
> -    [ERR_REMAP (EPROTOTYPE)] = N_("Protocol wrong type for socket"),
> -# if EPROTOTYPE > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EPROTOTYPE
> -# endif
> -#endif
> -#ifdef ENOPROTOOPT
> -/*
> -TRANS You specified a socket option that doesn't make sense for the
> -TRANS particular protocol being used by the socket.  @xref{Socket Options}. */
> -    [ERR_REMAP (ENOPROTOOPT)] = N_("Protocol not available"),
> -# if ENOPROTOOPT > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX ENOPROTOOPT
> -# endif
> -#endif
> -#ifdef EPROTONOSUPPORT
> -/*
> -TRANS The socket domain does not support the requested communications protocol
> -TRANS (perhaps because the requested protocol is completely invalid).
> -TRANS @xref{Creating a Socket}. */
> -    [ERR_REMAP (EPROTONOSUPPORT)] = N_("Protocol not supported"),
> -# if EPROTONOSUPPORT > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EPROTONOSUPPORT
> -# endif
> -#endif
> -#ifdef ESOCKTNOSUPPORT
> -/*
> -TRANS The socket type is not supported. */
> -    [ERR_REMAP (ESOCKTNOSUPPORT)] = N_("Socket type not supported"),
> -# if ESOCKTNOSUPPORT > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX ESOCKTNOSUPPORT
> -# endif
> -#endif
> -#ifdef EOPNOTSUPP
> -/*
> -TRANS The operation you requested is not supported.  Some socket functions
> -TRANS don't make sense for all types of sockets, and others may not be
> -TRANS implemented for all communications protocols.  On @gnuhurdsystems{}, this
> -TRANS error can happen for many calls when the object does not support the
> -TRANS particular operation; it is a generic indication that the server knows
> -TRANS nothing to do for that call. */
> -    [ERR_REMAP (EOPNOTSUPP)] = N_("Operation not supported"),
> -# if EOPNOTSUPP > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EOPNOTSUPP
> -# endif
> -#endif
> -#ifdef EPFNOSUPPORT
> -/*
> -TRANS The socket communications protocol family you requested is not supported. */
> -    [ERR_REMAP (EPFNOSUPPORT)] = N_("Protocol family not supported"),
> -# if EPFNOSUPPORT > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EPFNOSUPPORT
> -# endif
> -#endif
> -#ifdef EAFNOSUPPORT
> -/*
> -TRANS The address family specified for a socket is not supported; it is
> -TRANS inconsistent with the protocol being used on the socket.  @xref{Sockets}. */
> -    [ERR_REMAP (EAFNOSUPPORT)] = N_("Address family not supported by protocol"),
> -# if EAFNOSUPPORT > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EAFNOSUPPORT
> -# endif
> -#endif
> -#ifdef EADDRINUSE
> -/*
> -TRANS The requested socket address is already in use.  @xref{Socket Addresses}. */
> -    [ERR_REMAP (EADDRINUSE)] = N_("Address already in use"),
> -# if EADDRINUSE > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EADDRINUSE
> -# endif
> -#endif
> -#ifdef EADDRNOTAVAIL
> -/*
> -TRANS The requested socket address is not available; for example, you tried
> -TRANS to give a socket a name that doesn't match the local host name.
> -TRANS @xref{Socket Addresses}. */
> -    [ERR_REMAP (EADDRNOTAVAIL)] = N_("Cannot assign requested address"),
> -# if EADDRNOTAVAIL > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EADDRNOTAVAIL
> -# endif
> -#endif
> -#ifdef ENETDOWN
> -/*
> -TRANS A socket operation failed because the network was down. */
> -    [ERR_REMAP (ENETDOWN)] = N_("Network is down"),
> -# if ENETDOWN > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX ENETDOWN
> -# endif
> -#endif
> -#ifdef ENETUNREACH
> -/*
> -TRANS A socket operation failed because the subnet containing the remote host
> -TRANS was unreachable. */
> -    [ERR_REMAP (ENETUNREACH)] = N_("Network is unreachable"),
> -# if ENETUNREACH > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX ENETUNREACH
> -# endif
> -#endif
> -#ifdef ENETRESET
> -/*
> -TRANS A network connection was reset because the remote host crashed. */
> -    [ERR_REMAP (ENETRESET)] = N_("Network dropped connection on reset"),
> -# if ENETRESET > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX ENETRESET
> -# endif
> -#endif
> -#ifdef ECONNABORTED
> -/*
> -TRANS A network connection was aborted locally. */
> -    [ERR_REMAP (ECONNABORTED)] = N_("Software caused connection abort"),
> -# if ECONNABORTED > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX ECONNABORTED
> -# endif
> -#endif
> -#ifdef ECONNRESET
> -/*
> -TRANS A network connection was closed for reasons outside the control of the
> -TRANS local host, such as by the remote machine rebooting or an unrecoverable
> -TRANS protocol violation. */
> -    [ERR_REMAP (ECONNRESET)] = N_("Connection reset by peer"),
> -# if ECONNRESET > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX ECONNRESET
> -# endif
> -#endif
> -#ifdef ENOBUFS
> -/*
> -TRANS The kernel's buffers for I/O operations are all in use.  In GNU, this
> -TRANS error is always synonymous with @code{ENOMEM}; you may get one or the
> -TRANS other from network operations. */
> -    [ERR_REMAP (ENOBUFS)] = N_("No buffer space available"),
> -# if ENOBUFS > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX ENOBUFS
> -# endif
> -#endif
> -#ifdef EISCONN
> -/*
> -TRANS You tried to connect a socket that is already connected.
> -TRANS @xref{Connecting}. */
> -    [ERR_REMAP (EISCONN)] = N_("Transport endpoint is already connected"),
> -# if EISCONN > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EISCONN
> -# endif
> -#endif
> -#ifdef ENOTCONN
> -/*
> -TRANS The socket is not connected to anything.  You get this error when you
> -TRANS try to transmit data over a socket, without first specifying a
> -TRANS destination for the data.  For a connectionless socket (for datagram
> -TRANS protocols, such as UDP), you get @code{EDESTADDRREQ} instead. */
> -    [ERR_REMAP (ENOTCONN)] = N_("Transport endpoint is not connected"),
> -# if ENOTCONN > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX ENOTCONN
> -# endif
> -#endif
> -#ifdef EDESTADDRREQ
> -/*
> -TRANS No default destination address was set for the socket.  You get this
> -TRANS error when you try to transmit data over a connectionless socket,
> -TRANS without first specifying a destination for the data with @code{connect}. */
> -    [ERR_REMAP (EDESTADDRREQ)] = N_("Destination address required"),
> -# if EDESTADDRREQ > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EDESTADDRREQ
> -# endif
> -#endif
> -#ifdef ESHUTDOWN
> -/*
> -TRANS The socket has already been shut down. */
> -    [ERR_REMAP (ESHUTDOWN)] = N_("Cannot send after transport endpoint shutdown"),
> -# if ESHUTDOWN > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX ESHUTDOWN
> -# endif
> -#endif
> -#ifdef ETOOMANYREFS
> -/* */
> -    [ERR_REMAP (ETOOMANYREFS)] = N_("Too many references: cannot splice"),
> -# if ETOOMANYREFS > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX ETOOMANYREFS
> -# endif
> -#endif
> -#ifdef ETIMEDOUT
> -/*
> -TRANS A socket operation with a specified timeout received no response during
> -TRANS the timeout period. */
> -    [ERR_REMAP (ETIMEDOUT)] = N_("Connection timed out"),
> -# if ETIMEDOUT > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX ETIMEDOUT
> -# endif
> -#endif
> -#ifdef ECONNREFUSED
> -/*
> -TRANS A remote host refused to allow the network connection (typically because
> -TRANS it is not running the requested service). */
> -    [ERR_REMAP (ECONNREFUSED)] = N_("Connection refused"),
> -# if ECONNREFUSED > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX ECONNREFUSED
> -# endif
> -#endif
> -#ifdef ELOOP
> -/*
> -TRANS Too many levels of symbolic links were encountered in looking up a file name.
> -TRANS This often indicates a cycle of symbolic links. */
> -    [ERR_REMAP (ELOOP)] = N_("Too many levels of symbolic links"),
> -# if ELOOP > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX ELOOP
> -# endif
> -#endif
> -#ifdef ENAMETOOLONG
> -/*
> -TRANS Filename too long (longer than @code{PATH_MAX}; @pxref{Limits for
> -TRANS Files}) or host name too long (in @code{gethostname} or
> -TRANS @code{sethostname}; @pxref{Host Identification}). */
> -    [ERR_REMAP (ENAMETOOLONG)] = N_("File name too long"),
> -# if ENAMETOOLONG > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX ENAMETOOLONG
> -# endif
> -#endif
> -#ifdef EHOSTDOWN
> -/*
> -TRANS The remote host for a requested network connection is down. */
> -    [ERR_REMAP (EHOSTDOWN)] = N_("Host is down"),
> -# if EHOSTDOWN > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EHOSTDOWN
> -# endif
> -#endif
> -#ifdef EHOSTUNREACH
> -/*
> -TRANS The remote host for a requested network connection is not reachable. */
> -    [ERR_REMAP (EHOSTUNREACH)] = N_("No route to host"),
> -# if EHOSTUNREACH > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EHOSTUNREACH
> -# endif
> -#endif
> -#ifdef ENOTEMPTY
> -/*
> -TRANS Directory not empty, where an empty directory was expected.  Typically,
> -TRANS this error occurs when you are trying to delete a directory. */
> -    [ERR_REMAP (ENOTEMPTY)] = N_("Directory not empty"),
> -# if ENOTEMPTY > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX ENOTEMPTY
> -# endif
> -#endif
> -#ifdef EPROCLIM
> -/*
> -TRANS This means that the per-user limit on new process would be exceeded by
> -TRANS an attempted @code{fork}.  @xref{Limits on Resources}, for details on
> -TRANS the @code{RLIMIT_NPROC} limit. */
> -    [ERR_REMAP (EPROCLIM)] = N_("Too many processes"),
> -# if EPROCLIM > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EPROCLIM
> -# endif
> -#endif
> -#ifdef EUSERS
> -/*
> -TRANS The file quota system is confused because there are too many users.
> -TRANS @c This can probably happen in a GNU system when using NFS. */
> -    [ERR_REMAP (EUSERS)] = N_("Too many users"),
> -# if EUSERS > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EUSERS
> -# endif
> -#endif
> -#ifdef EDQUOT
> -/*
> -TRANS The user's disk quota was exceeded. */
> -    [ERR_REMAP (EDQUOT)] = N_("Disk quota exceeded"),
> -# if EDQUOT > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EDQUOT
> -# endif
> -#endif
> -#ifdef ESTALE
> -/*
> -TRANS This indicates an internal confusion in the
> -TRANS file system which is due to file system rearrangements on the server host
> -TRANS for NFS file systems or corruption in other file systems.
> -TRANS Repairing this condition usually requires unmounting, possibly repairing
> -TRANS and remounting the file system. */
> -    [ERR_REMAP (ESTALE)] = N_("Stale file handle"),
> -# if ESTALE > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX ESTALE
> -# endif
> -#endif
> -#ifdef EREMOTE
> -/*
> -TRANS An attempt was made to NFS-mount a remote file system with a file name that
> -TRANS already specifies an NFS-mounted file.
> -TRANS (This is an error on some operating systems, but we expect it to work
> -TRANS properly on @gnuhurdsystems{}, making this error code impossible.) */
> -    [ERR_REMAP (EREMOTE)] = N_("Object is remote"),
> -# if EREMOTE > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EREMOTE
> -# endif
> -#endif
> -#ifdef EBADRPC
> -/* */
> -    [ERR_REMAP (EBADRPC)] = N_("RPC struct is bad"),
> -# if EBADRPC > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EBADRPC
> -# endif
> -#endif
> -#ifdef ERPCMISMATCH
> -/* */
> -    [ERR_REMAP (ERPCMISMATCH)] = N_("RPC version wrong"),
> -# if ERPCMISMATCH > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX ERPCMISMATCH
> -# endif
> -#endif
> -#ifdef EPROGUNAVAIL
> -/* */
> -    [ERR_REMAP (EPROGUNAVAIL)] = N_("RPC program not available"),
> -# if EPROGUNAVAIL > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EPROGUNAVAIL
> -# endif
> -#endif
> -#ifdef EPROGMISMATCH
> -/* */
> -    [ERR_REMAP (EPROGMISMATCH)] = N_("RPC program version wrong"),
> -# if EPROGMISMATCH > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EPROGMISMATCH
> -# endif
> -#endif
> -#ifdef EPROCUNAVAIL
> -/* */
> -    [ERR_REMAP (EPROCUNAVAIL)] = N_("RPC bad procedure for program"),
> -# if EPROCUNAVAIL > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EPROCUNAVAIL
> -# endif
> -#endif
> -#ifdef ENOLCK
> -/*
> -TRANS This is used by the file locking facilities; see
> -TRANS @ref{File Locks}.  This error is never generated by @gnuhurdsystems{}, but
> -TRANS it can result from an operation to an NFS server running another
> -TRANS operating system. */
> -    [ERR_REMAP (ENOLCK)] = N_("No locks available"),
> -# if ENOLCK > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX ENOLCK
> -# endif
> -#endif
> -#ifdef EFTYPE
> -/*
> -TRANS The file was the wrong type for the
> -TRANS operation, or a data file had the wrong format.
> -TRANS
> -TRANS On some systems @code{chmod} returns this error if you try to set the
> -TRANS sticky bit on a non-directory file; @pxref{Setting Permissions}. */
> -    [ERR_REMAP (EFTYPE)] = N_("Inappropriate file type or format"),
> -# if EFTYPE > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EFTYPE
> -# endif
> -#endif
> -#ifdef EAUTH
> -/* */
> -    [ERR_REMAP (EAUTH)] = N_("Authentication error"),
> -# if EAUTH > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EAUTH
> -# endif
> -#endif
> -#ifdef ENEEDAUTH
> -/* */
> -    [ERR_REMAP (ENEEDAUTH)] = N_("Need authenticator"),
> -# if ENEEDAUTH > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX ENEEDAUTH
> -# endif
> -#endif
> -#ifdef ENOSYS
> -/*
> -TRANS This indicates that the function called is
> -TRANS not implemented at all, either in the C library itself or in the
> -TRANS operating system.  When you get this error, you can be sure that this
> -TRANS particular function will always fail with @code{ENOSYS} unless you
> -TRANS install a new version of the C library or the operating system. */
> -    [ERR_REMAP (ENOSYS)] = N_("Function not implemented"),
> -# if ENOSYS > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX ENOSYS
> -# endif
> -#endif
> -#if defined (ENOTSUP) && ENOTSUP != EOPNOTSUPP
> -/*
> -TRANS A function returns this error when certain parameter
> -TRANS values are valid, but the functionality they request is not available.
> -TRANS This can mean that the function does not implement a particular command
> -TRANS or option value or flag bit at all.  For functions that operate on some
> -TRANS object given in a parameter, such as a file descriptor or a port, it
> -TRANS might instead mean that only @emph{that specific object} (file
> -TRANS descriptor, port, etc.) is unable to support the other parameters given;
> -TRANS different file descriptors might support different ranges of parameter
> -TRANS values.
> -TRANS
> -TRANS If the entire function is not available at all in the implementation,
> -TRANS it returns @code{ENOSYS} instead. */
> -    [ERR_REMAP (ENOTSUP)] = N_("Not supported"),
> -# if ENOTSUP > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX ENOTSUP
> -# endif
> -#endif
> -#ifdef EILSEQ
> -/*
> -TRANS While decoding a multibyte character the function came along an invalid
> -TRANS or an incomplete sequence of bytes or the given wide character is invalid. */
> -    [ERR_REMAP (EILSEQ)] = N_("Invalid or incomplete multibyte or wide character"),
> -# if EILSEQ > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EILSEQ
> -# endif
> -#endif
> -#ifdef EBACKGROUND
> -/*
> -TRANS On @gnuhurdsystems{}, servers supporting the @code{term} protocol return
> -TRANS this error for certain operations when the caller is not in the
> -TRANS foreground process group of the terminal.  Users do not usually see this
> -TRANS error because functions such as @code{read} and @code{write} translate
> -TRANS it into a @code{SIGTTIN} or @code{SIGTTOU} signal.  @xref{Job Control},
> -TRANS for information on process groups and these signals. */
> -    [ERR_REMAP (EBACKGROUND)] = N_("Inappropriate operation for background process"),
> -# if EBACKGROUND > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EBACKGROUND
> -# endif
> -#endif
> -#ifdef EDIED
> -/*
> -TRANS On @gnuhurdsystems{}, opening a file returns this error when the file is
> -TRANS translated by a program and the translator program dies while starting
> -TRANS up, before it has connected to the file. */
> -    [ERR_REMAP (EDIED)] = N_("Translator died"),
> -# if EDIED > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EDIED
> -# endif
> -#endif
> -#ifdef ED
> -/*
> -TRANS The experienced user will know what is wrong.
> -TRANS @c This error code is a joke.  Its perror text is part of the joke.
> -TRANS @c Don't change it. */
> -    [ERR_REMAP (ED)] = N_("?"),
> -# if ED > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX ED
> -# endif
> -#endif
> -#ifdef EGREGIOUS
> -/*
> -TRANS You did @strong{what}? */
> -    [ERR_REMAP (EGREGIOUS)] = N_("You really blew it this time"),
> -# if EGREGIOUS > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EGREGIOUS
> -# endif
> -#endif
> -#ifdef EIEIO
> -/*
> -TRANS Go home and have a glass of warm, dairy-fresh milk.
> -TRANS @c Okay.  Since you are dying to know, I'll tell you.
> -TRANS @c This is a joke, obviously.  There is a children's song which begins,
> -TRANS @c "Old McDonald had a farm, e-i-e-i-o."  Every time I see the (real)
> -TRANS @c errno macro EIO, I think about that song.  Probably most of my
> -TRANS @c compatriots who program on Unix do, too.  One of them must have stayed
> -TRANS @c up a little too late one night and decided to add it to Hurd or Glibc.
> -TRANS @c Whoever did it should be castigated, but it made me laugh.
> -TRANS @c  --[hidden email]
> -TRANS @c
> -TRANS @c "bought the farm" means "died".  -jtobey
> -TRANS @c
> -TRANS @c Translators, please do not translate this litteraly, translate it into
> -TRANS @c an idiomatic funny way of saying that the computer died. */
> -    [ERR_REMAP (EIEIO)] = N_("Computer bought the farm"),
> -# if EIEIO > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EIEIO
> -# endif
> -#endif
> -#ifdef EGRATUITOUS
> -/*
> -TRANS This error code has no purpose. */
> -    [ERR_REMAP (EGRATUITOUS)] = N_("Gratuitous error"),
> -# if EGRATUITOUS > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EGRATUITOUS
> -# endif
> -#endif
> -#ifdef EBADMSG
> -/* */
> -    [ERR_REMAP (EBADMSG)] = N_("Bad message"),
> -# if EBADMSG > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EBADMSG
> -# endif
> -#endif
> -#ifdef EIDRM
> -/* */
> -    [ERR_REMAP (EIDRM)] = N_("Identifier removed"),
> -# if EIDRM > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EIDRM
> -# endif
> -#endif
> -#ifdef EMULTIHOP
> -/* */
> -    [ERR_REMAP (EMULTIHOP)] = N_("Multihop attempted"),
> -# if EMULTIHOP > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EMULTIHOP
> -# endif
> -#endif
> -#ifdef ENODATA
> -/* */
> -    [ERR_REMAP (ENODATA)] = N_("No data available"),
> -# if ENODATA > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX ENODATA
> -# endif
> -#endif
> -#ifdef ENOLINK
> -/* */
> -    [ERR_REMAP (ENOLINK)] = N_("Link has been severed"),
> -# if ENOLINK > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX ENOLINK
> -# endif
> -#endif
> -#ifdef ENOMSG
> -/* */
> -    [ERR_REMAP (ENOMSG)] = N_("No message of desired type"),
> -# if ENOMSG > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX ENOMSG
> -# endif
> -#endif
> -#ifdef ENOSR
> -/* */
> -    [ERR_REMAP (ENOSR)] = N_("Out of streams resources"),
> -# if ENOSR > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX ENOSR
> -# endif
> -#endif
> -#ifdef ENOSTR
> -/* */
> -    [ERR_REMAP (ENOSTR)] = N_("Device not a stream"),
> -# if ENOSTR > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX ENOSTR
> -# endif
> -#endif
> -#ifdef EOVERFLOW
> -/* */
> -    [ERR_REMAP (EOVERFLOW)] = N_("Value too large for defined data type"),
> -# if EOVERFLOW > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EOVERFLOW
> -# endif
> -#endif
> -#ifdef EPROTO
> -/* */
> -    [ERR_REMAP (EPROTO)] = N_("Protocol error"),
> -# if EPROTO > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EPROTO
> -# endif
> -#endif
> -#ifdef ETIME
> -/* */
> -    [ERR_REMAP (ETIME)] = N_("Timer expired"),
> -# if ETIME > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX ETIME
> -# endif
> -#endif
> -#ifdef ECANCELED
> -/*
> -TRANS An asynchronous operation was canceled before it
> -TRANS completed.  @xref{Asynchronous I/O}.  When you call @code{aio_cancel},
> -TRANS the normal result is for the operations affected to complete with this
> -TRANS error; @pxref{Cancel AIO Operations}. */
> -    [ERR_REMAP (ECANCELED)] = N_("Operation canceled"),
> -# if ECANCELED > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX ECANCELED
> -# endif
> -#endif
> -#ifdef EOWNERDEAD
> -/* */
> -    [ERR_REMAP (EOWNERDEAD)] = N_("Owner died"),
> -# if EOWNERDEAD > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EOWNERDEAD
> -# endif
> -#endif
> -#ifdef ENOTRECOVERABLE
> -/* */
> -    [ERR_REMAP (ENOTRECOVERABLE)] = N_("State not recoverable"),
> -# if ENOTRECOVERABLE > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX ENOTRECOVERABLE
> -# endif
> -#endif
> -#ifdef ERESTART
> -/* */
> -    [ERR_REMAP (ERESTART)] = N_("Interrupted system call should be restarted"),
> -# if ERESTART > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX ERESTART
> -# endif
> -#endif
> -#ifdef ECHRNG
> -/* */
> -    [ERR_REMAP (ECHRNG)] = N_("Channel number out of range"),
> -# if ECHRNG > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX ECHRNG
> -# endif
> -#endif
> -#ifdef EL2NSYNC
> -/* */
> -    [ERR_REMAP (EL2NSYNC)] = N_("Level 2 not synchronized"),
> -# if EL2NSYNC > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EL2NSYNC
> -# endif
> -#endif
> -#ifdef EL3HLT
> -/* */
> -    [ERR_REMAP (EL3HLT)] = N_("Level 3 halted"),
> -# if EL3HLT > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EL3HLT
> -# endif
> -#endif
> -#ifdef EL3RST
> -/* */
> -    [ERR_REMAP (EL3RST)] = N_("Level 3 reset"),
> -# if EL3RST > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EL3RST
> -# endif
> -#endif
> -#ifdef ELNRNG
> -/* */
> -    [ERR_REMAP (ELNRNG)] = N_("Link number out of range"),
> -# if ELNRNG > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX ELNRNG
> -# endif
> -#endif
> -#ifdef EUNATCH
> -/* */
> -    [ERR_REMAP (EUNATCH)] = N_("Protocol driver not attached"),
> -# if EUNATCH > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EUNATCH
> -# endif
> -#endif
> -#ifdef ENOCSI
> -/* */
> -    [ERR_REMAP (ENOCSI)] = N_("No CSI structure available"),
> -# if ENOCSI > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX ENOCSI
> -# endif
> -#endif
> -#ifdef EL2HLT
> -/* */
> -    [ERR_REMAP (EL2HLT)] = N_("Level 2 halted"),
> -# if EL2HLT > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EL2HLT
> -# endif
> -#endif
> -#ifdef EBADE
> -/* */
> -    [ERR_REMAP (EBADE)] = N_("Invalid exchange"),
> -# if EBADE > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EBADE
> -# endif
> -#endif
> -#ifdef EBADR
> -/* */
> -    [ERR_REMAP (EBADR)] = N_("Invalid request descriptor"),
> -# if EBADR > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EBADR
> -# endif
> -#endif
> -#ifdef EXFULL
> -/* */
> -    [ERR_REMAP (EXFULL)] = N_("Exchange full"),
> -# if EXFULL > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EXFULL
> -# endif
> -#endif
> -#ifdef ENOANO
> -/* */
> -    [ERR_REMAP (ENOANO)] = N_("No anode"),
> -# if ENOANO > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX ENOANO
> -# endif
> -#endif
> -#ifdef EBADRQC
> -/* */
> -    [ERR_REMAP (EBADRQC)] = N_("Invalid request code"),
> -# if EBADRQC > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EBADRQC
> -# endif
> -#endif
> -#ifdef EBADSLT
> -/* */
> -    [ERR_REMAP (EBADSLT)] = N_("Invalid slot"),
> -# if EBADSLT > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EBADSLT
> -# endif
> -#endif
> -#if defined (EDEADLOCK) && EDEADLOCK != EDEADLK
> -/* */
> -    [ERR_REMAP (EDEADLOCK)] = N_("File locking deadlock error"),
> -# if EDEADLOCK > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EDEADLOCK
> -# endif
> -#endif
> -#ifdef EBFONT
> -/* */
> -    [ERR_REMAP (EBFONT)] = N_("Bad font file format"),
> -# if EBFONT > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EBFONT
> -# endif
> -#endif
> -#ifdef ENONET
> -/* */
> -    [ERR_REMAP (ENONET)] = N_("Machine is not on the network"),
> -# if ENONET > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX ENONET
> -# endif
> -#endif
> -#ifdef ENOPKG
> -/* */
> -    [ERR_REMAP (ENOPKG)] = N_("Package not installed"),
> -# if ENOPKG > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX ENOPKG
> -# endif
> -#endif
> -#ifdef EADV
> -/* */
> -    [ERR_REMAP (EADV)] = N_("Advertise error"),
> -# if EADV > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EADV
> -# endif
> -#endif
> -#ifdef ESRMNT
> -/* */
> -    [ERR_REMAP (ESRMNT)] = N_("Srmount error"),
> -# if ESRMNT > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX ESRMNT
> -# endif
> -#endif
> -#ifdef ECOMM
> -/* */
> -    [ERR_REMAP (ECOMM)] = N_("Communication error on send"),
> -# if ECOMM > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX ECOMM
> -# endif
> -#endif
> -#ifdef EDOTDOT
> -/* */
> -    [ERR_REMAP (EDOTDOT)] = N_("RFS specific error"),
> -# if EDOTDOT > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EDOTDOT
> -# endif
> -#endif
> -#ifdef ENOTUNIQ
> -/* */
> -    [ERR_REMAP (ENOTUNIQ)] = N_("Name not unique on network"),
> -# if ENOTUNIQ > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX ENOTUNIQ
> -# endif
> -#endif
> -#ifdef EBADFD
> -/* */
> -    [ERR_REMAP (EBADFD)] = N_("File descriptor in bad state"),
> -# if EBADFD > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EBADFD
> -# endif
> -#endif
> -#ifdef EREMCHG
> -/* */
> -    [ERR_REMAP (EREMCHG)] = N_("Remote address changed"),
> -# if EREMCHG > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EREMCHG
> -# endif
> -#endif
> -#ifdef ELIBACC
> -/* */
> -    [ERR_REMAP (ELIBACC)] = N_("Can not access a needed shared library"),
> -# if ELIBACC > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX ELIBACC
> -# endif
> -#endif
> -#ifdef ELIBBAD
> -/* */
> -    [ERR_REMAP (ELIBBAD)] = N_("Accessing a corrupted shared library"),
> -# if ELIBBAD > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX ELIBBAD
> -# endif
> -#endif
> -#ifdef ELIBSCN
> -/* */
> -    [ERR_REMAP (ELIBSCN)] = N_(".lib section in a.out corrupted"),
> -# if ELIBSCN > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX ELIBSCN
> -# endif
> -#endif
> -#ifdef ELIBMAX
> -/* */
> -    [ERR_REMAP (ELIBMAX)] = N_("Attempting to link in too many shared libraries"),
> -# if ELIBMAX > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX ELIBMAX
> -# endif
> -#endif
> -#ifdef ELIBEXEC
> -/* */
> -    [ERR_REMAP (ELIBEXEC)] = N_("Cannot exec a shared library directly"),
> -# if ELIBEXEC > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX ELIBEXEC
> -# endif
> -#endif
> -#ifdef ESTRPIPE
> -/* */
> -    [ERR_REMAP (ESTRPIPE)] = N_("Streams pipe error"),
> -# if ESTRPIPE > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX ESTRPIPE
> -# endif
> -#endif
> -#ifdef EUCLEAN
> -/* */
> -    [ERR_REMAP (EUCLEAN)] = N_("Structure needs cleaning"),
> -# if EUCLEAN > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EUCLEAN
> -# endif
> -#endif
> -#ifdef ENOTNAM
> -/* */
> -    [ERR_REMAP (ENOTNAM)] = N_("Not a XENIX named type file"),
> -# if ENOTNAM > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX ENOTNAM
> -# endif
> -#endif
> -#ifdef ENAVAIL
> -/* */
> -    [ERR_REMAP (ENAVAIL)] = N_("No XENIX semaphores available"),
> -# if ENAVAIL > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX ENAVAIL
> -# endif
> -#endif
> -#ifdef EISNAM
> -/* */
> -    [ERR_REMAP (EISNAM)] = N_("Is a named type file"),
> -# if EISNAM > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EISNAM
> -# endif
> -#endif
> -#ifdef EREMOTEIO
> -/* */
> -    [ERR_REMAP (EREMOTEIO)] = N_("Remote I/O error"),
> -# if EREMOTEIO > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EREMOTEIO
> -# endif
> -#endif
> -#ifdef ENOMEDIUM
> -/* */
> -    [ERR_REMAP (ENOMEDIUM)] = N_("No medium found"),
> -# if ENOMEDIUM > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX ENOMEDIUM
> -# endif
> -#endif
> -#ifdef EMEDIUMTYPE
> -/* */
> -    [ERR_REMAP (EMEDIUMTYPE)] = N_("Wrong medium type"),
> -# if EMEDIUMTYPE > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EMEDIUMTYPE
> -# endif
> -#endif
> -#ifdef ENOKEY
> -/* */
> -    [ERR_REMAP (ENOKEY)] = N_("Required key not available"),
> -# if ENOKEY > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX ENOKEY
> -# endif
> -#endif
> -#ifdef EKEYEXPIRED
> -/* */
> -    [ERR_REMAP (EKEYEXPIRED)] = N_("Key has expired"),
> -# if EKEYEXPIRED > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EKEYEXPIRED
> -# endif
> -#endif
> -#ifdef EKEYREVOKED
> -/* */
> -    [ERR_REMAP (EKEYREVOKED)] = N_("Key has been revoked"),
> -# if EKEYREVOKED > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EKEYREVOKED
> -# endif
> -#endif
> -#ifdef EKEYREJECTED
> -/* */
> -    [ERR_REMAP (EKEYREJECTED)] = N_("Key was rejected by service"),
> -# if EKEYREJECTED > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EKEYREJECTED
> -# endif
> -#endif
> -#ifdef ERFKILL
> -/* */
> -    [ERR_REMAP (ERFKILL)] = N_("Operation not possible due to RF-kill"),
> -# if ERFKILL > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX ERFKILL
> -# endif
> -#endif
> -#ifdef EHWPOISON
> -/* */
> -    [ERR_REMAP (EHWPOISON)] = N_("Memory page has hardware error"),
> -# if EHWPOISON > ERR_MAX
> -# undef ERR_MAX
> -# define ERR_MAX EHWPOISON
> -# endif
> -#endif
> -  };
> -
> -#define NERR \
> -  (sizeof _sys_errlist_internal / sizeof _sys_errlist_internal [0])
> -const int _sys_nerr_internal = NERR;
> -
> -#if IS_IN (libc) && !defined ERRLIST_NO_COMPAT
> -# include <errlist-compat.c>
> -#endif
> -
> -#ifdef EMIT_ERR_MAX
> -void dummy (void)
> -{ asm volatile (" @@@ %0 @@@ " : : "i" (ERR_REMAP (ERR_MAX))); }
> -#endif

OK.

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

> +#endif
> +_S(ERR_MAP(0), N_("Success"))
> +#ifdef EPERM
> +_S(ERR_MAP(EPERM), N_("Operation not permitted"))
> +#endif
> +#ifdef ENOENT
> +_S(ERR_MAP(ENOENT), N_("No such file or directory"))
> +#endif
> +#ifdef ESRCH
> +_S(ERR_MAP(ESRCH), N_("No such process"))
> +#endif
> +#ifdef EINTR
> +_S(ERR_MAP(EINTR), N_("Interrupted system call"))
> +#endif
> +#ifdef EIO
> +_S(ERR_MAP(EIO), N_("Input/output error"))
> +#endif
> +#ifdef ENXIO
> +_S(ERR_MAP(ENXIO), N_("No such device or address"))
> +#endif
> +#ifdef E2BIG
> +_S(ERR_MAP(E2BIG), N_("Argument list too long"))
> +#endif
> +#ifdef ENOEXEC
> +_S(ERR_MAP(ENOEXEC), N_("Exec format error"))
> +#endif
> +#ifdef EBADF
> +_S(ERR_MAP(EBADF), N_("Bad file descriptor"))
> +#endif
> +#ifdef ECHILD
> +_S(ERR_MAP(ECHILD), N_("No child processes"))
> +#endif
> +#ifdef EDEADLK
> +_S(ERR_MAP(EDEADLK), N_("Resource deadlock avoided"))
> +#endif
> +#ifdef ENOMEM
> +_S(ERR_MAP(ENOMEM), N_("Cannot allocate memory"))
> +#endif
> +#ifdef EACCES
> +_S(ERR_MAP(EACCES), N_("Permission denied"))
> +#endif
> +#ifdef EFAULT
> +_S(ERR_MAP(EFAULT), N_("Bad address"))
> +#endif
> +#ifdef ENOTBLK
> +_S(ERR_MAP(ENOTBLK), N_("Block device required"))
> +#endif
> +#ifdef EBUSY
> +_S(ERR_MAP(EBUSY), N_("Device or resource busy"))
> +#endif
> +#ifdef EEXIST
> +_S(ERR_MAP(EEXIST), N_("File exists"))
> +#endif
> +#ifdef EXDEV
> +_S(ERR_MAP(EXDEV), N_("Invalid cross-device link"))
> +#endif
> +#ifdef ENODEV
> +_S(ERR_MAP(ENODEV), N_("No such device"))
> +#endif
> +#ifdef ENOTDIR
> +_S(ERR_MAP(ENOTDIR), N_("Not a directory"))
> +#endif
> +#ifdef EISDIR
> +_S(ERR_MAP(EISDIR), N_("Is a directory"))
> +#endif
> +#ifdef EINVAL
> +_S(ERR_MAP(EINVAL), N_("Invalid argument"))
> +#endif
> +#ifdef EMFILE
> +_S(ERR_MAP(EMFILE), N_("Too many open files"))
> +#endif
> +#ifdef ENFILE
> +_S(ERR_MAP(ENFILE), N_("Too many open files in system"))
> +#endif
> +#ifdef ENOTTY
> +_S(ERR_MAP(ENOTTY), N_("Inappropriate ioctl for device"))
> +#endif
> +#ifdef ETXTBSY
> +_S(ERR_MAP(ETXTBSY), N_("Text file busy"))
> +#endif
> +#ifdef EFBIG
> +_S(ERR_MAP(EFBIG), N_("File too large"))
> +#endif
> +#ifdef ENOSPC
> +_S(ERR_MAP(ENOSPC), N_("No space left on device"))
> +#endif
> +#ifdef ESPIPE
> +_S(ERR_MAP(ESPIPE), N_("Illegal seek"))
> +#endif
> +#ifdef EROFS
> +_S(ERR_MAP(EROFS), N_("Read-only file system"))
> +#endif
> +#ifdef EMLINK
> +_S(ERR_MAP(EMLINK), N_("Too many links"))
> +#endif
> +#ifdef EPIPE
> +_S(ERR_MAP(EPIPE), N_("Broken pipe"))
> +#endif
> +#ifdef EDOM
> +_S(ERR_MAP(EDOM), N_("Numerical argument out of domain"))
> +#endif
> +#ifdef ERANGE
> +_S(ERR_MAP(ERANGE), N_("Numerical result out of range"))
> +#endif
> +#ifdef EAGAIN
> +_S(ERR_MAP(EAGAIN), N_("Resource temporarily unavailable"))
> +#endif
> +#ifdef EINPROGRESS
> +_S(ERR_MAP(EINPROGRESS), N_("Operation now in progress"))
> +#endif
> +#ifdef EALREADY
> +_S(ERR_MAP(EALREADY), N_("Operation already in progress"))
> +#endif
> +#ifdef ENOTSOCK
> +_S(ERR_MAP(ENOTSOCK), N_("Socket operation on non-socket"))
> +#endif
> +#ifdef EMSGSIZE
> +_S(ERR_MAP(EMSGSIZE), N_("Message too long"))
> +#endif
> +#ifdef EPROTOTYPE
> +_S(ERR_MAP(EPROTOTYPE), N_("Protocol wrong type for socket"))
> +#endif
> +#ifdef ENOPROTOOPT
> +_S(ERR_MAP(ENOPROTOOPT), N_("Protocol not available"))
> +#endif
> +#ifdef EPROTONOSUPPORT
> +_S(ERR_MAP(EPROTONOSUPPORT), N_("Protocol not supported"))
> +#endif
> +#ifdef ESOCKTNOSUPPORT
> +_S(ERR_MAP(ESOCKTNOSUPPORT), N_("Socket type not supported"))
> +#endif
> +#ifdef EOPNOTSUPP
> +_S(ERR_MAP(EOPNOTSUPP), N_("Operation not supported"))
> +#endif
> +#ifdef EPFNOSUPPORT
> +_S(ERR_MAP(EPFNOSUPPORT), N_("Protocol family not supported"))
> +#endif
> +#ifdef EAFNOSUPPORT
> +_S(ERR_MAP(EAFNOSUPPORT), N_("Address family not supported by protocol"))
> +#endif
> +#ifdef EADDRINUSE
> +_S(ERR_MAP(EADDRINUSE), N_("Address already in use"))
> +#endif
> +#ifdef EADDRNOTAVAIL
> +_S(ERR_MAP(EADDRNOTAVAIL), N_("Cannot assign requested address"))
> +#endif
> +#ifdef ENETDOWN
> +_S(ERR_MAP(ENETDOWN), N_("Network is down"))
> +#endif
> +#ifdef ENETUNREACH
> +_S(ERR_MAP(ENETUNREACH), N_("Network is unreachable"))
> +#endif
> +#ifdef ENETRESET
> +_S(ERR_MAP(ENETRESET), N_("Network dropped connection on reset"))
> +#endif
> +#ifdef ECONNABORTED
> +_S(ERR_MAP(ECONNABORTED), N_("Software caused connection abort"))
> +#endif
> +#ifdef ECONNRESET
> +_S(ERR_MAP(ECONNRESET), N_("Connection reset by peer"))
> +#endif
> +#ifdef ENOBUFS
> +_S(ERR_MAP(ENOBUFS), N_("No buffer space available"))
> +#endif
> +#ifdef EISCONN
> +_S(ERR_MAP(EISCONN), N_("Transport endpoint is already connected"))
> +#endif
> +#ifdef ENOTCONN
> +_S(ERR_MAP(ENOTCONN), N_("Transport endpoint is not connected"))
> +#endif
> +#ifdef EDESTADDRREQ
> +_S(ERR_MAP(EDESTADDRREQ), N_("Destination address required"))
> +#endif
> +#ifdef ESHUTDOWN
> +_S(ERR_MAP(ESHUTDOWN), N_("Cannot send after transport endpoint shutdown"))
> +#endif
> +#ifdef ETOOMANYREFS
> +_S(ERR_MAP(ETOOMANYREFS), N_("Too many references: cannot splice"))
> +#endif
> +#ifdef ETIMEDOUT
> +_S(ERR_MAP(ETIMEDOUT), N_("Connection timed out"))
> +#endif
> +#ifdef ECONNREFUSED
> +_S(ERR_MAP(ECONNREFUSED), N_("Connection refused"))
> +#endif
> +#ifdef ELOOP
> +_S(ERR_MAP(ELOOP), N_("Too many levels of symbolic links"))
> +#endif
> +#ifdef ENAMETOOLONG
> +_S(ERR_MAP(ENAMETOOLONG), N_("File name too long"))
> +#endif
> +#ifdef EHOSTDOWN
> +_S(ERR_MAP(EHOSTDOWN), N_("Host is down"))
> +#endif
> +#ifdef EHOSTUNREACH
> +_S(ERR_MAP(EHOSTUNREACH), N_("No route to host"))
> +#endif
> +#ifdef ENOTEMPTY
> +_S(ERR_MAP(ENOTEMPTY), N_("Directory not empty"))
> +#endif
> +#ifdef EUSERS
> +_S(ERR_MAP(EUSERS), N_("Too many users"))
> +#endif
> +#ifdef EDQUOT
> +_S(ERR_MAP(EDQUOT), N_("Disk quota exceeded"))
> +#endif
> +#ifdef ESTALE
> +_S(ERR_MAP(ESTALE), N_("Stale file handle"))
> +#endif
> +#ifdef EREMOTE
> +_S(ERR_MAP(EREMOTE), N_("Object is remote"))
> +#endif
> +#ifdef ENOLCK
> +_S(ERR_MAP(ENOLCK), N_("No locks available"))
> +#endif
> +#ifdef ENOSYS
> +_S(ERR_MAP(ENOSYS), N_("Function not implemented"))
> +#endif
> +#ifdef EILSEQ
> +_S(ERR_MAP(EILSEQ), N_("Invalid or incomplete multibyte or wide character"))
> +#endif
> +#ifdef EBADMSG
> +_S(ERR_MAP(EBADMSG), N_("Bad message"))
> +#endif
> +#ifdef EIDRM
> +_S(ERR_MAP(EIDRM), N_("Identifier removed"))
> +#endif
> +#ifdef EMULTIHOP
> +_S(ERR_MAP(EMULTIHOP), N_("Multihop attempted"))
> +#endif
> +#ifdef ENODATA
> +_S(ERR_MAP(ENODATA), N_("No data available"))
> +#endif
> +#ifdef ENOLINK
> +_S(ERR_MAP(ENOLINK), N_("Link has been severed"))
> +#endif
> +#ifdef ENOMSG
> +_S(ERR_MAP(ENOMSG), N_("No message of desired type"))
> +#endif
> +#ifdef ENOSR
> +_S(ERR_MAP(ENOSR), N_("Out of streams resources"))
> +#endif
> +#ifdef ENOSTR
> +_S(ERR_MAP(ENOSTR), N_("Device not a stream"))
> +#endif
> +#ifdef EOVERFLOW
> +_S(ERR_MAP(EOVERFLOW), N_("Value too large for defined data type"))
> +#endif
> +#ifdef EPROTO
> +_S(ERR_MAP(EPROTO), N_("Protocol error"))
> +#endif
> +#ifdef ETIME
> +_S(ERR_MAP(ETIME), N_("Timer expired"))
> +#endif
> +#ifdef ECANCELED
> +_S(ERR_MAP(ECANCELED), N_("Operation canceled"))
> +#endif
> +#ifdef EOWNERDEAD
> +_S(ERR_MAP(EOWNERDEAD), N_("Owner died"))
> +#endif
> +#ifdef ENOTRECOVERABLE
> +_S(ERR_MAP(ENOTRECOVERABLE), N_("State not recoverable"))
> +#endif
> +#ifdef ERESTART
> +_S(ERR_MAP(ERESTART), N_("Interrupted system call should be restarted"))
> +#endif
> +#ifdef ECHRNG
> +_S(ERR_MAP(ECHRNG), N_("Channel number out of range"))
> +#endif
> +#ifdef EL2NSYNC
> +_S(ERR_MAP(EL2NSYNC), N_("Level 2 not synchronized"))
> +#endif
> +#ifdef EL3HLT
> +_S(ERR_MAP(EL3HLT), N_("Level 3 halted"))
> +#endif
> +#ifdef EL3RST
> +_S(ERR_MAP(EL3RST), N_("Level 3 reset"))
> +#endif
> +#ifdef ELNRNG
> +_S(ERR_MAP(ELNRNG), N_("Link number out of range"))
> +#endif
> +#ifdef EUNATCH
> +_S(ERR_MAP(EUNATCH), N_("Protocol driver not attached"))
> +#endif
> +#ifdef ENOCSI
> +_S(ERR_MAP(ENOCSI), N_("No CSI structure available"))
> +#endif
> +#ifdef EL2HLT
> +_S(ERR_MAP(EL2HLT), N_("Level 2 halted"))
> +#endif
> +#ifdef EBADE
> +_S(ERR_MAP(EBADE), N_("Invalid exchange"))
> +#endif
> +#ifdef EBADR
> +_S(ERR_MAP(EBADR), N_("Invalid request descriptor"))
> +#endif
> +#ifdef EXFULL
> +_S(ERR_MAP(EXFULL), N_("Exchange full"))
> +#endif
> +#ifdef ENOANO
> +_S(ERR_MAP(ENOANO), N_("No anode"))
> +#endif
> +#ifdef EBADRQC
> +_S(ERR_MAP(EBADRQC), N_("Invalid request code"))
> +#endif
> +#ifdef EBADSLT
> +_S(ERR_MAP(EBADSLT), N_("Invalid slot"))
> +#endif
> +#ifdef EBFONT
> +_S(ERR_MAP(EBFONT), N_("Bad font file format"))
> +#endif
> +#ifdef ENONET
> +_S(ERR_MAP(ENONET), N_("Machine is not on the network"))
> +#endif
> +#ifdef ENOPKG
> +_S(ERR_MAP(ENOPKG), N_("Package not installed"))
> +#endif
> +#ifdef EADV
> +_S(ERR_MAP(EADV), N_("Advertise error"))
> +#endif
> +#ifdef ESRMNT
> +_S(ERR_MAP(ESRMNT), N_("Srmount error"))
> +#endif
> +#ifdef ECOMM
> +_S(ERR_MAP(ECOMM), N_("Communication error on send"))
> +#endif
> +#ifdef EDOTDOT
> +_S(ERR_MAP(EDOTDOT), N_("RFS specific error"))
> +#endif
> +#ifdef ENOTUNIQ
> +_S(ERR_MAP(ENOTUNIQ), N_("Name not unique on network"))
> +#endif
> +#ifdef EBADFD
> +_S(ERR_MAP(EBADFD), N_("File descriptor in bad state"))
> +#endif
> +#ifdef EREMCHG
> +_S(ERR_MAP(EREMCHG), N_("Remote address changed"))
> +#endif
> +#ifdef ELIBACC
> +_S(ERR_MAP(ELIBACC), N_("Can not access a needed shared library"))
> +#endif
> +#ifdef ELIBBAD
> +_S(ERR_MAP(ELIBBAD), N_("Accessing a corrupted shared library"))
> +#endif
> +#ifdef ELIBSCN
> +_S(ERR_MAP(ELIBSCN), N_(".lib section in a.out corrupted"))
> +#endif
> +#ifdef ELIBMAX
> +_S(ERR_MAP(ELIBMAX), N_("Attempting to link in too many shared libraries"))
> +#endif
> +#ifdef ELIBEXEC
> +_S(ERR_MAP(ELIBEXEC), N_("Cannot exec a shared library directly"))
> +#endif
> +#ifdef ESTRPIPE
> +_S(ERR_MAP(ESTRPIPE), N_("Streams pipe error"))
> +#endif
> +#ifdef EUCLEAN
> +_S(ERR_MAP(EUCLEAN), N_("Structure needs cleaning"))
> +#endif
> +#ifdef ENOTNAM
> +_S(ERR_MAP(ENOTNAM), N_("Not a XENIX named type file"))
> +#endif
> +#ifdef ENAVAIL
> +_S(ERR_MAP(ENAVAIL), N_("No XENIX semaphores available"))
> +#endif
> +#ifdef EISNAM
> +_S(ERR_MAP(EISNAM), N_("Is a named type file"))
> +#endif
> +#ifdef EREMOTEIO
> +_S(ERR_MAP(EREMOTEIO), N_("Remote I/O error"))
> +#endif
> +#ifdef ENOMEDIUM
> +_S(ERR_MAP(ENOMEDIUM), N_("No medium found"))
> +#endif
> +#ifdef EMEDIUMTYPE
> +_S(ERR_MAP(EMEDIUMTYPE), N_("Wrong medium type"))
> +#endif
> +#ifdef ENOKEY
> +_S(ERR_MAP(ENOKEY), N_("Required key not available"))
> +#endif
> +#ifdef EKEYEXPIRED
> +_S(ERR_MAP(EKEYEXPIRED), N_("Key has expired"))
> +#endif
> +#ifdef EKEYREVOKED
> +_S(ERR_MAP(EKEYREVOKED), N_("Key has been revoked"))
> +#endif
> +#ifdef EKEYREJECTED
> +_S(ERR_MAP(EKEYREJECTED), N_("Key was rejected by service"))
> +#endif
> +#ifdef ERFKILL
> +_S(ERR_MAP(ERFKILL), N_("Operation not possible due to RF-kill"))
> +#endif
> +#ifdef EHWPOISON
> +_S(ERR_MAP(EHWPOISON), N_("Memory page has hardware error"))
> +#endif
> +#ifdef EBADRPC
> +_S(ERR_MAP(EBADRPC), N_("RPC struct is bad"))
> +#endif
> +#ifdef EFTYPE
> +_S(ERR_MAP(EFTYPE), N_("Inappropriate file type or format"))
> +#endif
> +#ifdef EPROCUNAVAIL
> +_S(ERR_MAP(EPROCUNAVAIL), N_("RPC bad procedure for program"))
> +#endif
> +#ifdef EAUTH
> +_S(ERR_MAP(EAUTH), N_("Authentication error"))
> +#endif
> +#ifdef EDIED
> +_S(ERR_MAP(EDIED), N_("Translator died"))
> +#endif
> +#ifdef ERPCMISMATCH
> +_S(ERR_MAP(ERPCMISMATCH), N_("RPC version wrong"))
> +#endif
> +#ifdef EGREGIOUS
> +_S(ERR_MAP(EGREGIOUS), N_("You really blew it this time"))
> +#endif
> +#ifdef EPROCLIM
> +_S(ERR_MAP(EPROCLIM), N_("Too many processes"))
> +#endif
> +#ifdef EGRATUITOUS
> +_S(ERR_MAP(EGRATUITOUS), N_("Gratuitous error"))
> +#endif
> +#if defined (ENOTSUP) && ENOTSUP != EOPNOTSUPP
> +_S(ERR_MAP(ENOTSUP), N_("Not supported"))
> +#endif
> +#ifdef EPROGMISMATCH
> +_S(ERR_MAP(EPROGMISMATCH), N_("RPC program version wrong"))
> +#endif
> +#ifdef EBACKGROUND
> +_S(ERR_MAP(EBACKGROUND), N_("Inappropriate operation for background process"))
> +#endif
> +#ifdef EIEIO
> +_S(ERR_MAP(EIEIO), N_("Computer bought the farm"))
> +#endif
> +#if defined (EWOULDBLOCK) && EWOULDBLOCK != EAGAIN
> +_S(ERR_MAP(EWOULDBLOCK), N_("Operation would block"))
> +#endif
> +#ifdef ENEEDAUTH
> +_S(ERR_MAP(ENEEDAUTH), N_("Need authenticator"))
> +#endif
> +#ifdef ED
> +_S(ERR_MAP(ED), N_("?"))
> +#endif
> +#ifdef EPROGUNAVAIL
> +_S(ERR_MAP(EPROGUNAVAIL), N_("RPC program not available"))
> +#endif
> diff --git a/sysdeps/mach/hurd/err_hurd.sub b/sysdeps/mach/hurd/err_hurd.sub
> index 4a4dee3aa3..3e9b37e155 100644
> --- a/sysdeps/mach/hurd/err_hurd.sub
> +++ b/sysdeps/mach/hurd/err_hurd.sub
> @@ -1,12 +1,11 @@
>  /* This file defines the Mach error system for Hurd server errors.  */
>  
>  #include <errno.h>
> -
> -extern const char *const _hurd_errlist[];
> +#include <stdio.h>  /* For _sys_errlist_internal  */
>  
>  /* Omit `const' because we are included with `static'
>     defined to `static const'.  */
>  static struct error_subsystem err_hurd_sub[] =
>    {
> -    { "(os/hurd)", _HURD_ERRNOS, (const char *const *) _hurd_errlist },
> +    { "(os/hurd)", _HURD_ERRNOS, _sys_errlist_internal },

OK.

>    };
> diff --git a/sysdeps/mach/hurd/errlist.c b/sysdeps/mach/hurd/errlist.c
> index 451e8fa1eb..be752f02b9 100644
> --- a/sysdeps/mach/hurd/errlist.c
> +++ b/sysdeps/mach/hurd/errlist.c
> @@ -15,14 +15,7 @@
>     License along with the GNU C Library; if not, see
>     <https://www.gnu.org/licenses/>.  */
>  
> -/* sys_errlist cannot have Unix semantics on the Hurd, so it is easier just
> -   to rename it.  We also need to remap error codes to array indices by
> -   taking their subcode. */
> -#define _sys_errlist_internal _hurd_errlist
> -#define _sys_nerr_internal _hurd_nerr
> -#define ERRLIST_NO_COMPAT 1
> -
>  #include <mach/error.h>
> -#define ERR_REMAP(n) (err_get_code (n))
>  
> -#include <sysdeps/gnu/errlist.c>
> +#define ERR_MAP(value) err_get_code (value)
> +#include <stdio-common/errlist.c>
> diff --git a/sysdeps/unix/sysv/linux/Versions b/sysdeps/unix/sysv/linux/Versions
> index 9a58dda9f2..c35f783e2a 100644
> --- a/sysdeps/unix/sysv/linux/Versions
> +++ b/sysdeps/unix/sysv/linux/Versions
> @@ -1,9 +1,4 @@
>  libc {
> -  # The comment lines with "#errlist-compat" are magic; see errlist-compat.awk.
> -  # When you get an error from errlist-compat.awk, you need to add a new
> -  # version here.  Don't do this blindly, since this means changing the ABI
> -  # for all GNU/Linux configurations.
> -
>    GLIBC_2.0 {
>      # functions used in inline functions or macros
>      __cmsg_nxthdr;
> @@ -56,7 +51,6 @@ libc {
>      # u*
>      umount; uselib;
>  
> -    #errlist-compat 123
>      _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
>    }
>    GLIBC_2.1 {
> @@ -84,7 +78,6 @@ libc {
>      # u*
>      umount2;
>  
> -    #errlist-compat 125
>      _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
>    }
>    GLIBC_2.2 {
> @@ -102,7 +95,6 @@ libc {
>      # r*
>      readahead;
>  
> -    #errlist-compat 126
>      _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
>    }
>    GLIBC_2.3.2 {
> @@ -120,7 +112,6 @@ libc {
>  
>      unshare;
>  
> -    #errlist-compat 132
>      _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
>    }
>    GLIBC_2.5 {
> @@ -142,7 +133,6 @@ libc {
>      fallocate;
>    }
>    GLIBC_2.12 {
> -    #errlist-compat 135
>      _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
>  
>      ntp_gettimex;

OK. Less magic is better.

> diff --git a/sysdeps/unix/sysv/linux/alpha/Versions b/sysdeps/unix/sysv/linux/alpha/Versions
> index 3b7971c2a3..b90d5f2e5a 100644
> --- a/sysdeps/unix/sysv/linux/alpha/Versions
> +++ b/sysdeps/unix/sysv/linux/alpha/Versions
> @@ -1,12 +1,5 @@
>  libc {
> -  # The comment lines with "#errlist-compat" are magic; see
> -  # sysdeps/gnu/errlist-compat.awk.
> -  # When you get an error from errlist-compat.awk, you need to add a new
> -  # version here.  Don't do this blindly, since this means changing the ABI
> -  # for all GNU/Linux configurations.
> -
>    GLIBC_2.0 {
> -    #errlist-compat 131
>      _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
>  
>      # Unfortunately in wider use.
> @@ -33,7 +26,6 @@ libc {
>      pciconfig_read; pciconfig_write; sethae;
>    }
>    GLIBC_2.1 {
> -    #errlist-compat 131
>      _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
>  
>      # Linux/Alpha 64-bit timeval functions.
> @@ -70,19 +62,15 @@ libc {
>      wordexp;
>    }
>    GLIBC_2.3 {
> -    #errlist-compat 132
>      _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
>    }
>    GLIBC_2.4 {
> -    #errlist-compat 138
>      _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
>    }
>    GLIBC_2.12 {
> -    #errlist-compat 139
>      _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
>    }
>    GLIBC_2.16 {
> -    #errlist-compat 140
>      _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
>    }
>    GLIBC_2.27 {

OK.

> diff --git a/sysdeps/unix/sysv/linux/alpha/errlist-compat.c b/sysdeps/unix/sysv/linux/alpha/errlist-compat.c
> new file mode 100644
> index 0000000000..709807aa6b
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/alpha/errlist-compat.c
> @@ -0,0 +1,43 @@
> +/* Linux sys_errlist compat symbol definitions.  Alpha version.
> +   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 <errlist-compat.h>
> +
> +#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
> +DEFINE_COMPAT_ERRLIST (131, GLIBC_2_0)
> +#endif
> +
> +#if SHLIB_COMPAT (libc, GLIBC_2_1, GLIBC_2_3)
> +DEFINE_COMPAT_ERRLIST (131, GLIBC_2_1)
> +#endif
> +
> +#if SHLIB_COMPAT (libc, GLIBC_2_3, GLIBC_2_4)
> +DEFINE_COMPAT_ERRLIST (132, GLIBC_2_3)
> +#endif
> +
> +#if SHLIB_COMPAT (libc, GLIBC_2_4, GLIBC_2_12)
> +DEFINE_COMPAT_ERRLIST (138, GLIBC_2_4)
> +#endif
> +
> +#if SHLIB_COMPAT (libc, GLIBC_2_12, GLIBC_2_16)
> +DEFINE_COMPAT_ERRLIST (139, GLIBC_2_12)
> +#endif
> +
> +#if SHLIB_COMPAT (libc, GLIBC_2_16, GLIBC_2_32)
> +DEFINE_COMPAT_ERRLIST (140, GLIBC_2_16)
> +#endif

OK.

> diff --git a/sysdeps/unix/sysv/linux/bits/sys_errlist.h b/sysdeps/unix/sysv/linux/errlist-compat.c
> similarity index 56%
> rename from sysdeps/unix/sysv/linux/bits/sys_errlist.h
> rename to sysdeps/unix/sysv/linux/errlist-compat.c
> index d6f5fa0a5e..c4d79b70aa 100644
> --- a/sysdeps/unix/sysv/linux/bits/sys_errlist.h
> +++ b/sysdeps/unix/sysv/linux/errlist-compat.c
> @@ -1,5 +1,5 @@
> -/* Declare sys_errlist and sys_nerr, or don't.  Compatibility (do) version.
> -   Copyright (C) 2002-2020 Free Software Foundation, Inc.
> +/* Linux sys_errlist compat symbol definitions.  Generic version.
> +   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
> @@ -16,17 +16,24 @@
>     License along with the GNU C Library; if not, see
>     <https://www.gnu.org/licenses/>.  */
>  
> -#ifndef _STDIO_H
> -# error "Never include <bits/sys_errlist.h> directly; use <stdio.h> instead."
> +#include <errlist-compat.h>
> +
> +#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
> +DEFINE_COMPAT_ERRLIST (123, GLIBC_2_0)
>  #endif
>  
> -/* sys_errlist and sys_nerr are deprecated.  Use strerror instead.  */
> +#if SHLIB_COMPAT (libc, GLIBC_2_1, GLIBC_2_3)
> +DEFINE_COMPAT_ERRLIST (125, GLIBC_2_1)
> +#endif
>  
> -#ifdef  __USE_MISC
> -extern int sys_nerr;
> -extern const char *const sys_errlist[];
> +#if SHLIB_COMPAT (libc, GLIBC_2_3, GLIBC_2_4)
> +DEFINE_COMPAT_ERRLIST (126, GLIBC_2_3)
>  #endif
> -#ifdef  __USE_GNU
> -extern int _sys_nerr;
> -extern const char *const _sys_errlist[];
> +
> +#if SHLIB_COMPAT (libc, GLIBC_2_4, GLIBC_2_12)
> +DEFINE_COMPAT_ERRLIST (132, GLIBC_2_4)
> +#endif
> +
> +#if SHLIB_COMPAT (libc, GLIBC_2_12, GLIBC_2_32)
> +DEFINE_COMPAT_ERRLIST (135, GLIBC_2_12)
>  #endif
> diff --git a/sysdeps/unix/sysv/linux/errlist-compat.h b/sysdeps/unix/sysv/linux/errlist-compat.h
> new file mode 100644
> index 0000000000..edd35fd4ed
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/errlist-compat.h
> @@ -0,0 +1,43 @@
> +/* Linux sys_errlist compatibility macro definitions.
> +   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/>.  */
> +
> +#ifndef _ERRLIST_COMPAT_H
> +#define _ERRLIST_COMPAT_H
> +
> +#include <shlib-compat.h>
> +
> +/* Define new compat symbols for symbols  _sys_errlist, sys_errlist,
> +   _sys_nerr, and sys_nerr for version VERSION with NUMBERERR times number of
> +   bytes per long int size.
> +   Both _sys_errlist and sys_errlist alias to _sys_errlist_internal symbol
> +   (defined on errlist.c) while _sys_nerr and sys_nerr created new variable
> +   with the expected size.  */
> +#define DEFINE_COMPAT_ERRLIST(NUMBERERR, VERSION)     \
> +  const int __##VERSION##_sys_nerr = NUMBERERR;     \
> +  strong_alias (__##VERSION##_sys_nerr, __##VERSION##__sys_nerr);     \
> +  declare_symbol_alias (__ ## VERSION ## _sys_errlist, _sys_errlist_internal,\
> + object, NUMBERERR * (ULONG_WIDTH / UCHAR_WIDTH));    \
> +  declare_symbol_alias (__ ## VERSION ## __sys_errlist,     \
> + _sys_errlist_internal, object,     \
> + NUMBERERR * (ULONG_WIDTH / UCHAR_WIDTH));     \
> +  compat_symbol (libc, __## VERSION ## _sys_nerr, sys_nerr, VERSION);     \
> +  compat_symbol (libc, __## VERSION ## __sys_nerr, _sys_nerr, VERSION);      \
> +  compat_symbol (libc, __## VERSION ## _sys_errlist, sys_errlist, VERSION);  \
> +  compat_symbol (libc, __## VERSION ## __sys_errlist, _sys_errlist, VERSION);\
> +
> +#endif

OK.

> diff --git a/sysdeps/unix/sysv/linux/hppa/Versions b/sysdeps/unix/sysv/linux/hppa/Versions
> index b5098b2171..9532d207fc 100644
> --- a/sysdeps/unix/sysv/linux/hppa/Versions
> +++ b/sysdeps/unix/sysv/linux/hppa/Versions
> @@ -1,11 +1,5 @@
>  libc {
> -  # The comment lines with "#errlist-compat" are magic; see errlist-compat.awk.
> -  # When you get an error from errlist-compat.awk, you need to add a new
> -  # version here.  Don't do this blindly, since this means changing the ABI
> -  # for all GNU/Linux configurations.
> -
>    GLIBC_2.1 {
> -    #errlist-compat 253
>      _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
>    }
>    GLIBC_2.2 {
> @@ -13,22 +7,18 @@ libc {
>      getrlimit; setrlimit; getrlimit64; setrlimit64;
>    }
>    GLIBC_2.3 {
> -    #errlist-compat 254
>      _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
>    }
>    GLIBC_2.4 {
> -    #errlist-compat 256
>      _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
>    }
>    GLIBC_2.11 {
>      fallocate64;
>    }
>    GLIBC_2.12 {
> -    #errlist-compat 257
>      _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
>    }
>    GLIBC_2.17 {
> -    #errlist-compat 260
>      _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
>      prlimit64;
>    }
> diff --git a/sysdeps/unix/sysv/linux/hppa/errlist-compat.c b/sysdeps/unix/sysv/linux/hppa/errlist-compat.c
> new file mode 100644
> index 0000000000..65860d884c
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/hppa/errlist-compat.c
> @@ -0,0 +1,39 @@
> +/* Linux sys_errlist compat symbol definitions.  HPPA version.
> +   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 <errlist-compat.h>
> +
> +#if SHLIB_COMPAT (libc, GLIBC_2_1, GLIBC_2_3)
> +DEFINE_COMPAT_ERRLIST (253, GLIBC_2_1)
> +#endif
> +
> +#if SHLIB_COMPAT (libc, GLIBC_2_3, GLIBC_2_4)
> +DEFINE_COMPAT_ERRLIST (254, GLIBC_2_3)
> +#endif
> +
> +#if SHLIB_COMPAT (libc, GLIBC_2_4, GLIBC_2_12)
> +DEFINE_COMPAT_ERRLIST (256, GLIBC_2_4)
> +#endif
> +
> +#if SHLIB_COMPAT (libc, GLIBC_2_12, GLIBC_2_17)
> +DEFINE_COMPAT_ERRLIST (257, GLIBC_2_12)
> +#endif
> +
> +#if SHLIB_COMPAT (libc, GLIBC_2_17, GLIBC_2_32)
> +DEFINE_COMPAT_ERRLIST (260, GLIBC_2_17)
> +#endif

OK.

> diff --git a/sysdeps/unix/sysv/linux/mips/Versions b/sysdeps/unix/sysv/linux/mips/Versions
> index 453f276aad..0ec82dc480 100644
> --- a/sysdeps/unix/sysv/linux/mips/Versions
> +++ b/sysdeps/unix/sysv/linux/mips/Versions
> @@ -5,13 +5,7 @@ ld {
>    }
>  }
>  libc {
> -  # The comment lines with "#errlist-compat" are magic; see errlist-compat.awk.
> -  # When you get an error from errlist-compat.awk, you need to add a new
> -  # version here.  Don't do this blindly, since this means changing the ABI
> -  # for all GNU/Linux configurations.
> -
>    GLIBC_2.0 {
> -    #errlist-compat 123
>      _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
>  
>      # Exception handling support functions from libgcc
> @@ -28,7 +22,6 @@ libc {
>      sysmips;
>    }
>    GLIBC_2.2 {
> -    #errlist-compat 1134
>      _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
>  
>      # _*
> diff --git a/bits/sys_errlist.h b/sysdeps/unix/sysv/linux/mips/errlist-compat.c
> similarity index 69%
> rename from bits/sys_errlist.h
> rename to sysdeps/unix/sysv/linux/mips/errlist-compat.c
> index 40425a74c3..b720db9244 100644
> --- a/bits/sys_errlist.h
> +++ b/sysdeps/unix/sysv/linux/mips/errlist-compat.c
> @@ -1,5 +1,5 @@
> -/* Declare sys_errlist and sys_nerr, or don't.  Don't version.
> -   Copyright (C) 2002-2020 Free Software Foundation, Inc.
> +/* Linux sys_errlist compat symbol definitions.  MIPS version.
> +   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
> @@ -16,8 +16,12 @@
>     License along with the GNU C Library; if not, see
>     <https://www.gnu.org/licenses/>.  */
>  
> -#ifndef _STDIO_H
> -# error "Never include <bits/sys_errlist.h> directly; use <stdio.h> instead."
> +#include <errlist-compat.h>
> +
> +#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2)
> +DEFINE_COMPAT_ERRLIST (123, GLIBC_2_0)
>  #endif
>  
> -/* sys_errlist and sys_nerr are deprecated.  Use strerror instead.  */
> +#if SHLIB_COMPAT (libc, GLIBC_2_2, GLIBC_2_32)
> +DEFINE_COMPAT_ERRLIST (1134, GLIBC_2_1)
> +#endif
> diff --git a/sysdeps/unix/sysv/linux/sparc/Versions b/sysdeps/unix/sysv/linux/sparc/Versions
> index f056addee6..61e57fae99 100644
> --- a/sysdeps/unix/sysv/linux/sparc/Versions
> +++ b/sysdeps/unix/sysv/linux/sparc/Versions
> @@ -1,30 +1,20 @@
>  libc {
> -  # The comment lines with "#errlist-compat" are magic; see errlist-compat.awk.
> -  # When you get an error from errlist-compat.awk, you need to add a new
> -  # version here.
> -
>    GLIBC_2.0 {
> -    #errlist-compat 127
>      _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
>    }
>    GLIBC_2.1 {
> -    #errlist-compat 127
>      _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
>    }
>    GLIBC_2.3 {
> -    #errlist-compat 128
>      _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
>    }
>    GLIBC_2.4 {
> -    #errlist-compat 134
>      _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
>    }
>    GLIBC_2.12 {
> -    #errlist-compat 135
>      _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
>    }
>    GLIBC_2.16 {
> -    #errlist-compat 136
>      _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
>  
>      __getshmlba;
> diff --git a/sysdeps/unix/sysv/linux/sparc/errlist-compat.c b/sysdeps/unix/sysv/linux/sparc/errlist-compat.c
> new file mode 100644
> index 0000000000..43fc364add
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/sparc/errlist-compat.c
> @@ -0,0 +1,43 @@
> +/* Linux sys_errlist compat symbol definitions.  Sparc version.
> +   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 <errlist-compat.h>
> +
> +#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
> +DEFINE_COMPAT_ERRLIST (127, GLIBC_2_0)
> +#endif
> +
> +#if SHLIB_COMPAT (libc, GLIBC_2_1, GLIBC_2_3)
> +DEFINE_COMPAT_ERRLIST (127, GLIBC_2_1)
> +#endif
> +
> +#if SHLIB_COMPAT (libc, GLIBC_2_3, GLIBC_2_4)
> +DEFINE_COMPAT_ERRLIST (128, GLIBC_2_3)
> +#endif
> +
> +#if SHLIB_COMPAT (libc, GLIBC_2_4, GLIBC_2_12)
> +DEFINE_COMPAT_ERRLIST (134, GLIBC_2_4)
> +#endif
> +
> +#if SHLIB_COMPAT (libc, GLIBC_2_12, GLIBC_2_16)
> +DEFINE_COMPAT_ERRLIST (135, GLIBC_2_12)
> +#endif
> +
> +#if SHLIB_COMPAT (libc, GLIBC_2_16, GLIBC_2_32)
> +DEFINE_COMPAT_ERRLIST (136, GLIBC_2_16)
> +#endif
>

OK.

--
Cheers,
Carlos.

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

> number of signals non multiple of word is rounded up.

^^^ This sentence needs rewriting for clarity in the commit message.
 
> 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

> syscall which takes a sigset_t.

s/sycall/syscalls/g

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

> ---
>  include/signal.h                           |  2 ++
>  nptl/nptl-init.c                           |  2 +-
>  nptl/pthread_sigmask.c                     |  2 +-
>  sysdeps/unix/sysv/linux/aio_misc.h         |  9 ++++++---
>  sysdeps/unix/sysv/linux/epoll_pwait.c      |  2 +-
>  sysdeps/unix/sysv/linux/internal-signals.h | 10 +++++-----
>  sysdeps/unix/sysv/linux/ppoll.c            |  7 ++++---
>  sysdeps/unix/sysv/linux/pselect.c          |  2 +-
>  sysdeps/unix/sysv/linux/sigaction.c        |  3 ++-
>  sysdeps/unix/sysv/linux/signalfd.c         |  2 +-
>  sysdeps/unix/sysv/linux/sigpending.c       |  2 +-
>  sysdeps/unix/sysv/linux/sigsetops.h        | 18 +++++++++++++-----
>  sysdeps/unix/sysv/linux/sigsuspend.c       |  2 +-
>  sysdeps/unix/sysv/linux/sigtimedwait.c     |  3 ++-
>  sysdeps/unix/sysv/linux/x86/setjmpP.h      |  5 ++---
>  15 files changed, 43 insertions(+), 28 deletions(-)
>
> diff --git a/include/signal.h b/include/signal.h
> index aa68f45886..3d6315b741 100644
> --- a/include/signal.h
> +++ b/include/signal.h
> @@ -2,6 +2,8 @@
>  # include <signal/signal.h>
>  
>  # ifndef _ISOMAC
> +#  include <sigsetops.h>
> +

OK.

>  libc_hidden_proto (sigemptyset)
>  libc_hidden_proto (sigfillset)
>  libc_hidden_proto (sigaddset)
> diff --git a/nptl/nptl-init.c b/nptl/nptl-init.c
> index d4cf20e3d1..95c60a524a 100644
> --- a/nptl/nptl-init.c
> +++ b/nptl/nptl-init.c
> @@ -281,7 +281,7 @@ __pthread_initialize_minimal_internal (void)
>    __sigaddset (&sa.sa_mask, SIGCANCEL);
>    __sigaddset (&sa.sa_mask, SIGSETXID);
>    INTERNAL_SYSCALL_CALL (rt_sigprocmask, SIG_UNBLOCK, &sa.sa_mask,
> - NULL, _NSIG / 8);
> + NULL, __NSIG_BYTES);

OK.

>  
>    /* Get the size of the static and alignment requirements for the TLS
>       block.  */
> diff --git a/nptl/pthread_sigmask.c b/nptl/pthread_sigmask.c
> index d266d296c5..7b65ae1f27 100644
> --- a/nptl/pthread_sigmask.c
> +++ b/nptl/pthread_sigmask.c
> @@ -39,7 +39,7 @@ __pthread_sigmask (int how, const sigset_t *newmask, sigset_t *oldmask)
>  
>    /* We know that realtime signals are available if NPTL is used.  */
>    int result = INTERNAL_SYSCALL_CALL (rt_sigprocmask, how, newmask,
> -      oldmask, _NSIG / 8);
> +      oldmask, __NSIG_BYTES);

OK.

>  
>    return (INTERNAL_SYSCALL_ERROR_P (result)
>    ? INTERNAL_SYSCALL_ERRNO (result)
> diff --git a/sysdeps/unix/sysv/linux/aio_misc.h b/sysdeps/unix/sysv/linux/aio_misc.h
> index 30c3cd778e..e31ca8edbe 100644
> --- a/sysdeps/unix/sysv/linux/aio_misc.h
> +++ b/sysdeps/unix/sysv/linux/aio_misc.h
> @@ -31,7 +31,8 @@ __aio_start_notify_thread (void)
>  {
>    sigset_t ss;
>    sigemptyset (&ss);
> -  INTERNAL_SYSCALL_CALL (rt_sigprocmask, SIG_SETMASK, &ss, NULL, _NSIG / 8);
> +  INTERNAL_SYSCALL_CALL (rt_sigprocmask, SIG_SETMASK, &ss, NULL,
> + __NSIG_BYTES);
>  }
>  
>  extern inline int
> @@ -52,12 +53,14 @@ __aio_create_helper_thread (pthread_t *threadp, void *(*tf) (void *),
>    sigset_t ss;
>    sigset_t oss;
>    sigfillset (&ss);
> -  INTERNAL_SYSCALL_CALL (rt_sigprocmask, SIG_SETMASK, &ss, &oss, _NSIG / 8);
> +  INTERNAL_SYSCALL_CALL (rt_sigprocmask, SIG_SETMASK, &ss, &oss,
> + __NSIG_BYTES);
>  
>    int ret = pthread_create (threadp, &attr, tf, arg);
>  
>    /* Restore the signal mask.  */
> -  INTERNAL_SYSCALL_CALL (rt_sigprocmask, SIG_SETMASK, &oss, NULL, _NSIG / 8);
> +  INTERNAL_SYSCALL_CALL (rt_sigprocmask, SIG_SETMASK, &oss, NULL,
> + __NSIG_BYTES);
>  
>    (void) pthread_attr_destroy (&attr);
>    return ret;
> diff --git a/sysdeps/unix/sysv/linux/epoll_pwait.c b/sysdeps/unix/sysv/linux/epoll_pwait.c
> index 66f04482c7..af6d0fd713 100644
> --- a/sysdeps/unix/sysv/linux/epoll_pwait.c
> +++ b/sysdeps/unix/sysv/linux/epoll_pwait.c
> @@ -38,6 +38,6 @@ int epoll_pwait (int epfd, struct epoll_event *events,
>   const sigset_t *set)
>  {
>    return SYSCALL_CANCEL (epoll_pwait, epfd, events, maxevents,
> - timeout, set, _NSIG / 8);
> + timeout, set, __NSIG_BYTES);
>  }
>  libc_hidden_def (epoll_pwait)
> diff --git a/sysdeps/unix/sysv/linux/internal-signals.h b/sysdeps/unix/sysv/linux/internal-signals.h
> index 3fbd4807d1..35f2de04c5 100644
> --- a/sysdeps/unix/sysv/linux/internal-signals.h
> +++ b/sysdeps/unix/sysv/linux/internal-signals.h
> @@ -68,7 +68,7 @@ static inline void
>  __libc_signal_block_all (sigset_t *set)
>  {
>    INTERNAL_SYSCALL_CALL (rt_sigprocmask, SIG_BLOCK, &sigall_set, set,
> - _NSIG / 8);
> + __NSIG_BYTES);
>  }
>  
>  /* Block all application signals (excluding internal glibc ones).  */
> @@ -78,7 +78,7 @@ __libc_signal_block_app (sigset_t *set)
>    sigset_t allset = sigall_set;
>    __clear_internal_signals (&allset);
>    INTERNAL_SYSCALL_CALL (rt_sigprocmask, SIG_BLOCK, &allset, set,
> - _NSIG / 8);
> + __NSIG_BYTES);
>  }
>  
>  /* Block only SIGTIMER and return the previous set on SET.  */
> @@ -86,7 +86,7 @@ static inline void
>  __libc_signal_block_sigtimer (sigset_t *set)
>  {
>    INTERNAL_SYSCALL_CALL (rt_sigprocmask, SIG_BLOCK, &sigtimer_set, set,
> - _NSIG / 8);
> + __NSIG_BYTES);
>  }
>  
>  /* Unblock only SIGTIMER and return the previous set on SET.  */
> @@ -94,7 +94,7 @@ static inline void
>  __libc_signal_unblock_sigtimer (sigset_t *set)
>  {
>    INTERNAL_SYSCALL_CALL (rt_sigprocmask, SIG_UNBLOCK, &sigtimer_set, set,
> - _NSIG / 8);
> + __NSIG_BYTES);
>  }
>  
>  /* Restore current process signal mask.  */
> @@ -102,7 +102,7 @@ static inline void
>  __libc_signal_restore_set (const sigset_t *set)
>  {
>    INTERNAL_SYSCALL_CALL (rt_sigprocmask, SIG_SETMASK, set, NULL,
> - _NSIG / 8);
> + __NSIG_BYTES);
>  }
>  
>  /* Used to communicate with signal handler.  */
> diff --git a/sysdeps/unix/sysv/linux/ppoll.c b/sysdeps/unix/sysv/linux/ppoll.c
> index 4ffb23710e..0f15636cce 100644
> --- a/sysdeps/unix/sysv/linux/ppoll.c
> +++ b/sysdeps/unix/sysv/linux/ppoll.c
> @@ -41,11 +41,12 @@ __ppoll64 (struct pollfd *fds, nfds_t nfds, const struct __timespec64 *timeout,
>  # ifndef __NR_ppoll_time64
>  #  define __NR_ppoll_time64 __NR_ppoll
>  # endif
> -  return SYSCALL_CANCEL (ppoll_time64, fds, nfds, timeout, sigmask, _NSIG / 8);
> +  return SYSCALL_CANCEL (ppoll_time64, fds, nfds, timeout, sigmask,
> + __NSIG_BYTES);
>  #else
>  # ifdef __NR_ppoll_time64
>    int ret = SYSCALL_CANCEL (ppoll_time64, fds, nfds, timeout, sigmask,
> -                            _NSIG / 8);
> +                            __NSIG_BYTES);
>    if (ret >= 0 || errno != ENOSYS)
>      return ret;
>  # endif
> @@ -62,7 +63,7 @@ __ppoll64 (struct pollfd *fds, nfds_t nfds, const struct __timespec64 *timeout,
>      }
>  
>    return SYSCALL_CANCEL (ppoll, fds, nfds, timeout ? &ts32 : NULL, sigmask,
> -                         _NSIG / 8);
> +                         __NSIG_BYTES);
>  #endif
>  }
>  
> diff --git a/sysdeps/unix/sysv/linux/pselect.c b/sysdeps/unix/sysv/linux/pselect.c
> index d7c6ff8fdb..304db03338 100644
> --- a/sysdeps/unix/sysv/linux/pselect.c
> +++ b/sysdeps/unix/sysv/linux/pselect.c
> @@ -43,7 +43,7 @@ __pselect (int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
>    } data;
>  
>    data.ss = (__syscall_ulong_t) (uintptr_t) sigmask;
> -  data.ss_len = _NSIG / 8;
> +  data.ss_len = __NSIG_BYTES;
>  
>    return SYSCALL_CANCEL (pselect6, nfds, readfds, writefds, exceptfds,
>                           timeout, &data);
> diff --git a/sysdeps/unix/sysv/linux/sigaction.c b/sysdeps/unix/sysv/linux/sigaction.c
> index 4e6d11a6ae..f27349d552 100644
> --- a/sysdeps/unix/sysv/linux/sigaction.c
> +++ b/sysdeps/unix/sysv/linux/sigaction.c
> @@ -57,7 +57,8 @@ __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact)
>       real size of the user-level sigset_t.  */
>    result = INLINE_SYSCALL_CALL (rt_sigaction, sig,
>   act ? &kact : NULL,
> - oact ? &koact : NULL, STUB (act, _NSIG / 8));
> + oact ? &koact : NULL, STUB (act,
> +    __NSIG_BYTES));
>  
>    if (oact && result >= 0)
>      {
> diff --git a/sysdeps/unix/sysv/linux/signalfd.c b/sysdeps/unix/sysv/linux/signalfd.c
> index 64d7bccba9..71d91fdde5 100644
> --- a/sysdeps/unix/sysv/linux/signalfd.c
> +++ b/sysdeps/unix/sysv/linux/signalfd.c
> @@ -24,5 +24,5 @@
>  int
>  signalfd (int fd, const sigset_t *mask, int flags)
>  {
> -  return INLINE_SYSCALL (signalfd4, 4, fd, mask, _NSIG / 8, flags);
> +  return INLINE_SYSCALL (signalfd4, 4, fd, mask, __NSIG_BYTES, flags);
>  }
> diff --git a/sysdeps/unix/sysv/linux/sigpending.c b/sysdeps/unix/sysv/linux/sigpending.c
> index 458a3cf99e..8898fe8b34 100644
> --- a/sysdeps/unix/sysv/linux/sigpending.c
> +++ b/sysdeps/unix/sysv/linux/sigpending.c
> @@ -24,5 +24,5 @@
>  int
>  sigpending (sigset_t *set)
>  {
> -  return INLINE_SYSCALL (rt_sigpending, 2, set, _NSIG / 8);
> +  return INLINE_SYSCALL_CALL (rt_sigpending, set, __NSIG_BYTES);
>  }
> diff --git a/sysdeps/unix/sysv/linux/sigsetops.h b/sysdeps/unix/sysv/linux/sigsetops.h
> index db8f378cf0..3f29ead009 100644

OK. All above is just search and replace refactor.

> --- a/sysdeps/unix/sysv/linux/sigsetops.h
> +++ b/sysdeps/unix/sysv/linux/sigsetops.h
> @@ -20,23 +20,31 @@
>  #define _SIGSETOPS_H 1
>  
>  #include <signal.h>
> +#include <limits.h>
> +#include <libc-pointer-arith.h>

OK.

>  
>  /* Return a mask that includes the bit for SIG only.  */
> -# define __sigmask(sig) \
> -  (((unsigned long int) 1) << (((sig) - 1) % (8 * sizeof (unsigned long int))))
> +#define __sigmask(sig) \
> +  (1UL << (((sig) - 1) % ULONG_WIDTH))

OK.

>  
>  /* Return the word index for SIG.  */
>  static inline unsigned long int
>  __sigword (int sig)
>  {
> -  return (sig - 1) / (8 * sizeof (unsigned long int));
> +  return (sig - 1) / ULONG_WIDTH;

OK.

>  }
>  
>  /* Linux sig* functions only handle up to __NSIG_WORDS words instead of
>     full _SIGSET_NWORDS sigset size.  The signal numbers are 1-based, and
>     bit 0 of a signal mask is for signal 1.  */
> -
> -# define __NSIG_WORDS (_NSIG / (8 * sizeof (unsigned long int )))
> +#define __NSIG_WORDS (ALIGN_UP ((_NSIG - 1), ULONG_WIDTH) / ULONG_WIDTH)
> +_Static_assert (__NSIG_WORDS <= _SIGSET_NWORDS,
> + "__NSIG_WORDS > _SIGSET_WORDS");

OK.

> +
> +/* This macro is used on syscall that takes a sigset_t to specify the expected
> +   size in bytes.  As for glibc, kernel sigset is implemented as an array of
> +   unsigned long.  */
> +#define __NSIG_BYTES (__NSIG_WORDS * (ULONG_WIDTH / UCHAR_WIDTH))

OK.

>  
>  static inline void
>  __sigemptyset (sigset_t *set)
> diff --git a/sysdeps/unix/sysv/linux/sigsuspend.c b/sysdeps/unix/sysv/linux/sigsuspend.c
> index dd5df5af25..b4bf2ec4bc 100644
> --- a/sysdeps/unix/sysv/linux/sigsuspend.c
> +++ b/sysdeps/unix/sysv/linux/sigsuspend.c
> @@ -23,7 +23,7 @@
>  int
>  __sigsuspend (const sigset_t *set)
>  {
> -  return SYSCALL_CANCEL (rt_sigsuspend, set, _NSIG / 8);
> +  return SYSCALL_CANCEL (rt_sigsuspend, set, __NSIG_BYTES);
>  }
>  libc_hidden_def (__sigsuspend)
>  weak_alias (__sigsuspend, sigsuspend)
> diff --git a/sysdeps/unix/sysv/linux/sigtimedwait.c b/sysdeps/unix/sysv/linux/sigtimedwait.c
> index 6b3d8f705f..f2ef3aad45 100644
> --- a/sysdeps/unix/sysv/linux/sigtimedwait.c
> +++ b/sysdeps/unix/sysv/linux/sigtimedwait.c
> @@ -26,7 +26,8 @@ __sigtimedwait (const sigset_t *set, siginfo_t *info,
>  {
>    /* XXX The size argument hopefully will have to be changed to the
>       real size of the user-level sigset_t.  */
> -  int result = SYSCALL_CANCEL (rt_sigtimedwait, set, info, timeout, _NSIG / 8);
> +  int result = SYSCALL_CANCEL (rt_sigtimedwait, set, info, timeout,
> +       __NSIG_BYTES);
>  
>    /* The kernel generates a SI_TKILL code in si_code in case tkill is
>       used.  tkill is transparently used in raise().  Since having
> diff --git a/sysdeps/unix/sysv/linux/x86/setjmpP.h b/sysdeps/unix/sysv/linux/x86/setjmpP.h
> index 1783b8eb78..a5de31bfd6 100644
> --- a/sysdeps/unix/sysv/linux/x86/setjmpP.h
> +++ b/sysdeps/unix/sysv/linux/x86/setjmpP.h
> @@ -21,6 +21,7 @@
>  
>  #include <bits/types/__sigset_t.h>
>  #include <libc-pointer-arith.h>
> +#include <sigsetops.h>
>  
>  /* <setjmp/setjmp.h> has
>  
> @@ -113,11 +114,9 @@ typedef union
>  
>  #include <signal.h>
>  
> -#define _SIGPROCMASK_NSIG_WORDS (_NSIG / (8 * sizeof (unsigned long int)))
> -
>  typedef struct
>    {
> -    unsigned long int __val[_SIGPROCMASK_NSIG_WORDS];
> +    unsigned long int __val[__NSIG_WORDS];
>    } __sigprocmask_sigset_t;
>  
>  extern jmp_buf ___buf;
>

OK.

--
Cheers,
Carlos.

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

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

s/on/via/g

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

>
> It is used only on Hurd, where accessing the thread point in single

s/point in/storage in the/g

> 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

> translated messages (to avoid partial translation) and the resulting
> usage is not thread-safe.

OK for master with fixed up commit message.

Framework seems sensible and we might extend it to include
more data if we need to. The existing use of __libc_key_create is a little
heavy for just a string, and the complex shutdown through a stored function
pointer is always difficult to debug. It is easier as you have it to just
free the memory during the thread's freeres.

No regressions on x86_64 and i686.

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

> Checked on x86-64-linux-gnu, i686-linux-gnu, powerpc64le-linux-gnu,
> and s390x-linux-gnu.
> ---
>  malloc/thread-freeres.c                |   2 +
>  nptl/allocatestack.c                   |   2 +
>  nptl/descr.h                           |   4 +
>  string/strsignal.c                     | 112 +++++--------------------
>  sysdeps/generic/Makefile               |   1 +
>  sysdeps/generic/tls-internal-struct.h  |  27 ++++++
>  sysdeps/generic/tls-internal.c         |  21 +++++
>  sysdeps/generic/tls-internal.h         |  39 +++++++++
>  sysdeps/unix/sysv/linux/tls-internal.c |   1 +
>  sysdeps/unix/sysv/linux/tls-internal.h |  37 ++++++++
>  10 files changed, 155 insertions(+), 91 deletions(-)
>  create mode 100644 sysdeps/generic/tls-internal-struct.h
>  create mode 100644 sysdeps/generic/tls-internal.c
>  create mode 100644 sysdeps/generic/tls-internal.h
>  create mode 100644 sysdeps/unix/sysv/linux/tls-internal.c
>  create mode 100644 sysdeps/unix/sysv/linux/tls-internal.h
>
> diff --git a/malloc/thread-freeres.c b/malloc/thread-freeres.c
> index c71ca4fc33..3408bdbefd 100644
> --- a/malloc/thread-freeres.c
> +++ b/malloc/thread-freeres.c
> @@ -21,6 +21,7 @@
>  #include <resolv/resolv-internal.h>
>  #include <rpc/rpc.h>
>  #include <string.h>
> +#include <tls-internal.h>

OK.

>  
>  /* Thread shutdown function.  Note that this function must be called
>     for threads during shutdown for correctness reasons.  Unlike
> @@ -32,6 +33,7 @@ __libc_thread_freeres (void)
>    call_function_static_weak (__rpc_thread_destroy);
>    call_function_static_weak (__res_thread_freeres);
>    call_function_static_weak (__strerror_thread_freeres);
> +  __glibc_tls_internal_free ();

OK. We remove the use of __libc_key_create and instead of the destructor
used there we use the thread shutdown __libc_thread_freeres to free it.

>  
>    /* This should come last because it shuts down malloc for this
>       thread and the other shutdown functions might well call free.  */
> diff --git a/nptl/allocatestack.c b/nptl/allocatestack.c
> index d16f3d71f8..4ae4b5a986 100644
> --- a/nptl/allocatestack.c
> +++ b/nptl/allocatestack.c
> @@ -237,6 +237,8 @@ get_cached_stack (size_t *sizep, void **memp)
>    /* No pending event.  */
>    result->nextevent = NULL;
>  
> +  result->tls_state = (struct tls_internal_t) { 0 };

OK.

> +
>    /* Clear the DTV.  */
>    dtv_t *dtv = GET_DTV (TLS_TPADJ (result));
>    for (size_t cnt = 0; cnt < dtv[-1].counter; ++cnt)
> diff --git a/nptl/descr.h b/nptl/descr.h
> index e1c7db5473..6a509b6725 100644
> --- a/nptl/descr.h
> +++ b/nptl/descr.h
> @@ -34,6 +34,7 @@
>  #include <unwind.h>
>  #include <bits/types/res_state.h>
>  #include <kernel-features.h>
> +#include <tls-internal-struct.h>

OK.

>  
>  #ifndef TCB_ALIGNMENT
>  # define TCB_ALIGNMENT sizeof (double)
> @@ -398,6 +399,9 @@ struct pthread
>    /* Indicates whether is a C11 thread created by thrd_creat.  */
>    bool c11;
>  
> +  /* Used on strsignal.  */
> +  struct tls_internal_t tls_state;

OK.

> +
>    /* This member must be last.  */
>    char end_padding[];
>  
> diff --git a/string/strsignal.c b/string/strsignal.c
> index 7e3b262c55..701ce20e6e 100644
> --- a/string/strsignal.c
> +++ b/string/strsignal.c
> @@ -20,106 +20,36 @@
>  #include <stdlib.h>
>  #include <string.h>
>  #include <libintl.h>
> -#include <libc-lock.h>
> -
> -static __libc_key_t key;
> -
> -/* If nonzero the key allocation failed and we should better use a
> -   static buffer than fail.  */
> -#define BUFFERSIZ 100
> -static char local_buf[BUFFERSIZ];
> -static char *static_buf;

OK. Good to see this go.

> -
> -/* Destructor for the thread-specific data.  */
> -static void init (void);
> -static void free_key_mem (void *mem);
> -static char *getbuffer (void);
> -
> +#include <tls-internal.h>
> +#include <array_length.h>
>  
>  /* Return a string describing the meaning of the signal number SIGNUM.  */
>  char *
>  strsignal (int signum)
>  {
> -  __libc_once_define (static, once);
> -  const char *desc;
> -
> -  /* If we have not yet initialized the buffer do it now.  */
> -  __libc_once (once, init);
> -
> -  if (
> -#ifdef SIGRTMIN
> -      (signum >= SIGRTMIN && signum <= SIGRTMAX) ||
> -#endif
> -      signum < 0 || signum >= NSIG
> -      || (desc = __sys_siglist[signum]) == NULL)
> -    {
> -      char *buffer = getbuffer ();
> -      int len;
> -#ifdef SIGRTMIN
> -      if (signum >= SIGRTMIN && signum <= SIGRTMAX)
> - len = __snprintf (buffer, BUFFERSIZ - 1, _("Real-time signal %d"),
> -  signum - SIGRTMIN);
> -      else
> -#endif
> - len = __snprintf (buffer, BUFFERSIZ - 1, _("Unknown signal %d"),
> -  signum);
> -      if (len >= BUFFERSIZ)
> - buffer = NULL;
> -      else
> - buffer[len] = '\0';
> -
> -      return buffer;
> -    }
> -
> -  return (char *) _(desc);
> -}
> -
> -
> -/* Initialize buffer.  */
> -static void
> -init (void)
> -{
> -  if (__libc_key_create (&key, free_key_mem))
> -    /* Creating the key failed.  This means something really went
> -       wrong.  In any case use a static buffer which is better than
> -       nothing.  */
> -    static_buf = local_buf;
> -}
> -
> +  const char *desc = NULL;
>  
> -/* Free the thread specific data, this is done if a thread terminates.  */
> -static void
> -free_key_mem (void *mem)
> -{
> -  free (mem);
> -  __libc_setspecific (key, NULL);
> -}
> +  if (signum >= 0 && signum <= NSIG && signum < array_length (__sys_siglist))
> +    desc = __sys_siglist[signum];

OK.

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

OK.

>  
> -/* Return the buffer to be used.  */
> -static char *
> -getbuffer (void)
> -{
> -  char *result;
> +  struct tls_internal_t *tls_internal = __glibc_tls_internal ();
> +  free (tls_internal->strsignal_buf);
>  
> -  if (static_buf != NULL)
> -    result = static_buf;
> +  int r;
> +#ifdef SIGRTMIN
> +  if (signum >= SIGRTMIN && signum <= SIGRTMAX)
> +    r = __asprintf (&tls_internal->strsignal_buf, _("Real-time signal %d"),
> +    signum - SIGRTMIN);

OK. Use asprintf which will call malloc.

>    else
> -    {
> -      /* We don't use the static buffer and so we have a key.  Use it
> - to get the thread-specific buffer.  */
> -      result = __libc_getspecific (key);
> -      if (result == NULL)
> - {
> -  /* No buffer allocated so far.  */
> -  result = malloc (BUFFERSIZ);
> -  if (result == NULL)
> -    /* No more memory available.  We use the static buffer.  */
> -    result = local_buf;
> -  else
> -    __libc_setspecific (key, result);
> - }
> -    }
> +#endif
> +    r = __asprintf (&tls_internal->strsignal_buf, _("Unknown signal %d"),
> +    signum);

OK. Use asptrintf which will call malloc.

> +
> +  if (r == -1)
> +    tls_internal->strsignal_buf = NULL;
>  
> -  return result;
> +  return tls_internal->strsignal_buf;

OK.

>  }
> diff --git a/sysdeps/generic/Makefile b/sysdeps/generic/Makefile
> index bd4f9425ca..1240d99436 100644
> --- a/sysdeps/generic/Makefile
> +++ b/sysdeps/generic/Makefile
> @@ -16,6 +16,7 @@
>  # <https://www.gnu.org/licenses/>.
>  
>  ifeq ($(subdir),string)
> +sysdep_routines += tls-internal

OK.

>  CFLAGS-wordcopy.c += -Wno-uninitialized
>  endif
>  
> diff --git a/sysdeps/generic/tls-internal-struct.h b/sysdeps/generic/tls-internal-struct.h
> new file mode 100644
> index 0000000000..33a9079ee9
> --- /dev/null
> +++ b/sysdeps/generic/tls-internal-struct.h
> @@ -0,0 +1,27 @@
> +/* Per-thread state.  Generic version.
> +   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/>.  */
> +
> +#ifndef _TLS_INTERNAL_STRUCT_H
> +#define _TLS_INTERNAL_STRUCT_H 1
> +
> +struct tls_internal_t
> +{
> +  char *strsignal_buf;
> +};

OK.

> +
> +#endif
> diff --git a/sysdeps/generic/tls-internal.c b/sysdeps/generic/tls-internal.c
> new file mode 100644
> index 0000000000..14b914e5f3
> --- /dev/null
> +++ b/sysdeps/generic/tls-internal.c
> @@ -0,0 +1,21 @@
> +/* Per-thread state.  Generic version.
> +   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 <tls-internal.h>
> +
> +__thread struct tls_internal_t __tls_internal;

OK.

> diff --git a/sysdeps/generic/tls-internal.h b/sysdeps/generic/tls-internal.h
> new file mode 100644
> index 0000000000..1f6a117d76
> --- /dev/null
> +++ b/sysdeps/generic/tls-internal.h
> @@ -0,0 +1,39 @@
> +/* Per-thread state.  Generic version.
> +   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/>.  */
> +
> +#ifndef _TLS_INTERNAL_H
> +#define _TLS_INTERNAL_H 1
> +
> +#include <stdlib.h>
> +#include <tls-internal-struct.h>
> +
> +extern __thread struct tls_internal_t __tls_internal attribute_hidden;

OK. Generic implementation uses __thread to store the structure.

> +
> +static inline struct tls_internal_t *
> +__glibc_tls_internal (void)
> +{
> +  return &__tls_internal;
> +}

OK.

> +
> +static inline void
> +__glibc_tls_internal_free (void)
> +{
> +  free (__tls_internal.strsignal_buf);
> +}

OK.

> +
> +#endif
> diff --git a/sysdeps/unix/sysv/linux/tls-internal.c b/sysdeps/unix/sysv/linux/tls-internal.c
> new file mode 100644
> index 0000000000..6e25b021ab
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/tls-internal.c
> @@ -0,0 +1 @@
> +/* Empty.  */
> diff --git a/sysdeps/unix/sysv/linux/tls-internal.h b/sysdeps/unix/sysv/linux/tls-internal.h
> new file mode 100644
> index 0000000000..5d712abd4a
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/tls-internal.h
> @@ -0,0 +1,37 @@
> +/* Per-thread state.  Linux version.
> +   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/>.  */
> +
> +#ifndef _TLS_INTERNAL_H
> +#define _TLS_INTERNAL_H 1
> +
> +#include <stdlib.h>
> +#include <nptl/pthreadP.h>
> +
> +static inline struct tls_internal_t *
> +__glibc_tls_internal (void)
> +{
> +  return &THREAD_SELF->tls_state;
> +}
> +
> +static inline void
> +__glibc_tls_internal_free (void)
> +{
> +  free (THREAD_SELF->tls_state.strsignal_buf);
> +}

OK.

> +
> +#endif
>


--
Cheers,
Carlos.

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

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.

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.

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


--
Cheers,
Carlos.

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH v5 07/13] string: Use tls-internal on strerror_l

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 buffer allocation uses the same strategy of strsignal.
>
> 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]>

> ---
>  include/string.h                       |  3 ---
>  malloc/thread-freeres.c                |  1 -
>  string/strerror_l.c                    | 21 +++++------------
>  sysdeps/generic/tls-internal-struct.h  |  1 +
>  sysdeps/generic/tls-internal.h         |  1 +
>  sysdeps/mach/strerror_l.c              | 32 +++++++++-----------------
>  sysdeps/unix/sysv/linux/tls-internal.h |  1 +
>  7 files changed, 20 insertions(+), 40 deletions(-)
>
> diff --git a/include/string.h b/include/string.h
> index 3a33327cc0..ce01ad8254 100644
> --- a/include/string.h
> +++ b/include/string.h
> @@ -53,9 +53,6 @@ extern char *__strerror_r (int __errnum, char *__buf, size_t __buflen);
>  
>  extern char *__strerror_l (int __errnum, locale_t __loc);
>  
> -/* Called as part of the thread shutdown sequence.  */
> -void __strerror_thread_freeres (void) attribute_hidden;
> -

OK.

>  /* Get _STRING_ARCH_unaligned.  */
>  #include <string_private.h>
>  #endif
> diff --git a/malloc/thread-freeres.c b/malloc/thread-freeres.c
> index 3408bdbefd..eb29d53310 100644
> --- a/malloc/thread-freeres.c
> +++ b/malloc/thread-freeres.c
> @@ -32,7 +32,6 @@ __libc_thread_freeres (void)
>  {
>    call_function_static_weak (__rpc_thread_destroy);
>    call_function_static_weak (__res_thread_freeres);
> -  call_function_static_weak (__strerror_thread_freeres);

OK.

>    __glibc_tls_internal_free ();
>  
>    /* This should come last because it shuts down malloc for this
> diff --git a/string/strerror_l.c b/string/strerror_l.c
> index 017bd14b99..a203e9e80b 100644
> --- a/string/strerror_l.c
> +++ b/string/strerror_l.c
> @@ -18,11 +18,8 @@
>  #include <libintl.h>
>  #include <locale.h>
>  #include <stdio.h>
> -#include <stdlib.h>
>  #include <string.h>
> -#include <errno.h>
> -
> -static __thread char *last_value;
> +#include <tls-internal.h>
>  
>  
>  static const char *
> @@ -43,12 +40,13 @@ __strerror_l (int errnum, locale_t loc)
>    char *err = (char *) __get_errlist (errnum);
>    if (__glibc_unlikely (err == NULL))
>      {
> -      free (last_value);
> -      if (__asprintf (&last_value, "%s%d",
> +      struct tls_internal_t *tls_internal = __glibc_tls_internal ();
> +      free (tls_internal->strerror_l_buf);
> +      if (__asprintf (&tls_internal->strerror_l_buf, "%s%d",
>        translate ("Unknown error ", loc), errnum) == -1)
> - last_value = NULL;
> + tls_internal->strerror_l_buf = NULL;
>  
> -      err = last_value;
> +      err = tls_internal->strerror_l_buf;

OK.

>      }
>    else
>      err = (char *) translate (err, loc);
> @@ -58,10 +56,3 @@ __strerror_l (int errnum, locale_t loc)
>  }
>  weak_alias (__strerror_l, strerror_l)
>  libc_hidden_def (__strerror_l)
> -
> -void
> -__strerror_thread_freeres (void)
> -{
> -  free (last_value);
> -}
> -text_set_element (__libc_subfreeres, __strerror_thread_freeres);

OK.

> diff --git a/sysdeps/generic/tls-internal-struct.h b/sysdeps/generic/tls-internal-struct.h
> index 33a9079ee9..156e722bd8 100644
> --- a/sysdeps/generic/tls-internal-struct.h
> +++ b/sysdeps/generic/tls-internal-struct.h
> @@ -22,6 +22,7 @@
>  struct tls_internal_t
>  {
>    char *strsignal_buf;
> +  char *strerror_l_buf;
>  };
>  
>  #endif
> diff --git a/sysdeps/generic/tls-internal.h b/sysdeps/generic/tls-internal.h
> index 1f6a117d76..b4b03b4ecf 100644
> --- a/sysdeps/generic/tls-internal.h
> +++ b/sysdeps/generic/tls-internal.h
> @@ -34,6 +34,7 @@ static inline void
>  __glibc_tls_internal_free (void)
>  {
>    free (__tls_internal.strsignal_buf);
> +  free (__tls_internal.strerror_l_buf);

OK. Perfect! Use the same framework.

>  }
>  
>  #endif
> diff --git a/sysdeps/mach/strerror_l.c b/sysdeps/mach/strerror_l.c
> index b6c9fdbe80..72b857f4a0 100644
> --- a/sysdeps/mach/strerror_l.c
> +++ b/sysdeps/mach/strerror_l.c
> @@ -23,11 +23,7 @@
>  #include <string.h>
>  #include <mach/error.h>
>  #include <errorlib.h>
> -#include <sys/param.h>
> -#include <libc-symbols.h>
> -
> -
> -static __thread char *last_value;
> +#include <tls-internal.h>
>  
>  
>  static const char *
> @@ -58,13 +54,14 @@ __strerror_l (int errnum, locale_t loc)
>  
>    if (system > err_max_system || ! __mach_error_systems[system].bad_sub)
>      {
> -      free (last_value);
> -      if (__asprintf (&last_value, "%s%X",
> +      struct tls_internal_t *tls_internal = __glibc_tls_internal ();
> +      free (tls_internal->strerror_l_buf);
> +      if (__asprintf (&tls_internal->strerror_l_buf, "%s%X",
>        translate ("Error in unknown error system: ", loc),
>        errnum) == -1)
> - last_value = NULL;
> + tls_internal->strerror_l_buf = NULL;
>  
> -      return last_value;
> +      return tls_internal->strerror_l_buf;
>      }
>  
>    es = &__mach_error_systems[system];
> @@ -74,25 +71,18 @@ __strerror_l (int errnum, locale_t loc)
>  
>    if (code >= es->subsystem[sub].max_code)
>      {
> -      free (last_value);
> -      if (__asprintf (&last_value, "%s%s %d",
> +      struct tls_internal_t *tls_internal = __glibc_tls_internal ();
> +      free (tls_internal->strerror_l_buf);
> +      if (__asprintf (&tls_internal->strerror_l_buf, "%s%s %d",
>        translate ("Unknown error ", loc),
>        translate (es->subsystem[sub].subsys_name, loc),
>        errnum) == -1)
> - last_value = NULL;
> + tls_internal->strerror_l_buf = NULL;
>  
> -      return last_value;
> +      return tls_internal->strerror_l_buf;
>      }
>  
>    return (char *) translate (es->subsystem[sub].codes[code], loc);
>  }
>  weak_alias (__strerror_l, strerror_l)
>  libc_hidden_def (__strerror_l)
> -
> -/* This is called when a thread is exiting to free the last_value string.  */
> -void
> -__strerror_thread_freeres (void)
> -{
> -  free (last_value);
> -}
> -text_set_element (__libc_subfreeres, __strerror_thread_freeres);

OK.

> diff --git a/sysdeps/unix/sysv/linux/tls-internal.h b/sysdeps/unix/sysv/linux/tls-internal.h
> index 5d712abd4a..d07f4b680d 100644
> --- a/sysdeps/unix/sysv/linux/tls-internal.h
> +++ b/sysdeps/unix/sysv/linux/tls-internal.h
> @@ -32,6 +32,7 @@ static inline void
>  __glibc_tls_internal_free (void)
>  {
>    free (THREAD_SELF->tls_state.strsignal_buf);
> +  free (THREAD_SELF->tls_state.strerror_l_buf);

OK.

>  }
>  
>  #endif
>


--
Cheers,
Carlos.

123