summaryrefslogtreecommitdiff
path: root/sysdeps/unix
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/unix')
-rw-r--r--sysdeps/unix/bsd/bits/signum.h58
-rw-r--r--sysdeps/unix/sysv/linux/Makefile14
-rw-r--r--sysdeps/unix/sysv/linux/alpha/bits/signum.h69
-rw-r--r--sysdeps/unix/sysv/linux/bits/signum.h91
-rw-r--r--sysdeps/unix/sysv/linux/hppa/bits/signum.h110
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/signum.h94
-rw-r--r--sysdeps/unix/sysv/linux/sparc/bits/signum.h70
-rw-r--r--sysdeps/unix/sysv/linux/tst-signal-numbers.sh86
8 files changed, 262 insertions, 330 deletions
diff --git a/sysdeps/unix/bsd/bits/signum.h b/sysdeps/unix/bsd/bits/signum.h
index 268c24a702..f55edc93a3 100644
--- a/sysdeps/unix/bsd/bits/signum.h
+++ b/sysdeps/unix/bsd/bits/signum.h
@@ -16,58 +16,20 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#ifdef _SIGNAL_H
+#ifndef _BITS_SIGNUM_H
+#define _BITS_SIGNUM_H 1
-/* This file defines the fake signal functions and signal
- number constants for 4.2 or 4.3 BSD-derived Unix system. */
-
-/* Fake signal functions. */
-#define SIG_ERR ((__sighandler_t) -1) /* Error return. */
-#define SIG_DFL ((__sighandler_t) 0) /* Default action. */
-#define SIG_IGN ((__sighandler_t) 1) /* Ignore signal. */
-
-#ifdef __USE_XOPEN
-# define SIG_HOLD ((__sighandler_t) 2) /* Add signal to hold mask. */
+#ifndef _SIGNAL_H
+#error "Never include <bits/signum.h> directly; use <signal.h> instead."
#endif
+#include <bits/signum-generic.h>
-/* Signals. */
-#define SIGHUP 1 /* Hangup (POSIX). */
-#define SIGINT 2 /* Interrupt (ANSI). */
-#define SIGQUIT 3 /* Quit (POSIX). */
-#define SIGILL 4 /* Illegal instruction (ANSI). */
-#define SIGABRT SIGIOT /* Abort (ANSI). */
-#define SIGTRAP 5 /* Trace trap (POSIX). */
-#define SIGIOT 6 /* IOT trap (4.2 BSD). */
-#define SIGEMT 7 /* EMT trap (4.2 BSD). */
-#define SIGFPE 8 /* Floating-point exception (ANSI). */
-#define SIGKILL 9 /* Kill, unblockable (POSIX). */
-#define SIGBUS 10 /* Bus error (4.2 BSD). */
-#define SIGSEGV 11 /* Segmentation violation (ANSI). */
-#define SIGSYS 12 /* Bad argument to system call (4.2 BSD). */
-#define SIGPIPE 13 /* Broken pipe (POSIX). */
-#define SIGALRM 14 /* Alarm clock (POSIX). */
-#define SIGTERM 15 /* Termination (ANSI). */
-#define SIGURG 16 /* Urgent condition on socket (4.2 BSD). */
-#define SIGSTOP 17 /* Stop, unblockable (POSIX). */
-#define SIGTSTP 18 /* Keyboard stop (POSIX). */
-#define SIGCONT 19 /* Continue (POSIX). */
-#define SIGCHLD 20 /* Child status has changed (POSIX). */
-#define SIGCLD SIGCHLD /* Same as SIGCHLD (System V). */
-#define SIGTTIN 21 /* Background read from tty (POSIX). */
-#define SIGTTOU 22 /* Background write to tty (POSIX). */
-#define SIGIO 23 /* I/O now possible (4.2 BSD). */
-#define SIGPOLL SIGIO /* Same as SIGIO? (SVID). */
-#define SIGXCPU 24 /* CPU limit exceeded (4.2 BSD). */
-#define SIGXFSZ 25 /* File size limit exceeded (4.2 BSD). */
-#define SIGVTALRM 26 /* Virtual alarm clock (4.2 BSD). */
-#define SIGPROF 27 /* Profiling alarm clock (4.2 BSD). */
-#define SIGWINCH 28 /* Window size change (4.3 BSD, Sun). */
+/* 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 SIGUSR1 30 /* User-defined signal 1 (POSIX). */
-#define SIGUSR2 31 /* User-defined signal 2 (POSIX). */
#define SIGLOST 32 /* Resource lost (Sun); server died (GNU). */
-#endif /* <signal.h> included. */
-
-#define _NSIG 33 /* Biggest signal number + 1. */
+#endif /* bits/signum.h. */
diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
index 1a170c29d6..8b340d4988 100644
--- a/sysdeps/unix/sysv/linux/Makefile
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -128,6 +128,20 @@ sysdep_headers += sys/timex.h bits/timex.h
sysdep_routines += ntp_gettime ntp_gettimex
endif
+ifeq ($(subdir),signal)
+tests-special += $(objpfx)tst-signal-numbers.out
+# Depending on signal.o* is a hack. What we actually want is a dependency
+# on signal.h and everything it includes. That's impractical to write
+# in this context, but signal.c includes signal.h and not much else so it'll
+# be conservatively correct.
+$(objpfx)tst-signal-numbers.out: \
+ ../sysdeps/unix/sysv/linux/tst-signal-numbers.sh \
+ $(objpfx)signal.o*
+ AWK=$(AWK) $(SHELL) ../sysdeps/unix/sysv/linux/tst-signal-numbers.sh \
+ $(CC) $(patsubst -DMODULE_NAME=%,-DMODULE_NAME=testsuite,$(CPPFLAGS)) \
+ < /dev/null > $@; $(evaluate-test)
+endif
+
ifeq ($(subdir),socket)
sysdep_headers += net/if_ppp.h net/ppp-comp.h \
net/ppp_defs.h net/if_arp.h net/route.h net/ethernet.h \
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/signum.h b/sysdeps/unix/sysv/linux/alpha/bits/signum.h
index e5cc5218e3..8227be91b5 100644
--- a/sysdeps/unix/sysv/linux/alpha/bits/signum.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/signum.h
@@ -16,66 +16,25 @@
License along with the GNU C Library. If not, see
<http://www.gnu.org/licenses/>. */
-#ifdef _SIGNAL_H
+#ifndef _BITS_SIGNUM_H
+#define _BITS_SIGNUM_H 1
-/* Fake signal functions. */
-#define SIG_ERR ((__sighandler_t) -1) /* Error return. */
-#define SIG_DFL ((__sighandler_t) 0) /* Default action. */
-#define SIG_IGN ((__sighandler_t) 1) /* Ignore signal. */
-
-#ifdef __USE_XOPEN
-# define SIG_HOLD ((__sighandler_t) 2) /* Add signal to hold mask. */
+#ifndef _SIGNAL_H
+#error "Never include <bits/signum.h> directly; use <signal.h> instead."
#endif
-/*
- * Linux/AXP has different signal numbers that Linux/i386: I'm trying
- * to make it OSF/1 binary compatible, at least for normal binaries.
- */
-#define SIGHUP 1
-#define SIGINT 2
-#define SIGQUIT 3
-#define SIGILL 4
-#define SIGTRAP 5
-#define SIGABRT 6
-#define SIGEMT 7
-#define SIGFPE 8
-#define SIGKILL 9
-#define SIGBUS 10
-#define SIGSEGV 11
-#define SIGSYS 12
-#define SIGPIPE 13
-#define SIGALRM 14
-#define SIGTERM 15
-#define SIGURG 16
-#define SIGSTOP 17
-#define SIGTSTP 18
-#define SIGCONT 19
-#define SIGCHLD 20
-#define SIGCLD SIGCHLD
-#define SIGTTIN 21
-#define SIGTTOU 22
-#define SIGIO 23
-#define SIGXCPU 24
-#define SIGXFSZ 25
-#define SIGVTALRM 26
-#define SIGPROF 27
-#define SIGWINCH 28
-#define SIGINFO 29
-#define SIGUSR1 30
-#define SIGUSR2 31
-
-#define SIGPOLL SIGIO
-#define SIGPWR SIGINFO
-#define SIGIOT SIGABRT
+#include <bits/signum-generic.h>
-#define _NSIG 65 /* Biggest signal number + 1. */
+/* 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 SIGRTMIN (__libc_current_sigrtmin ())
-#define SIGRTMAX (__libc_current_sigrtmax ())
+#define SIGEMT 7 /* Emulator trap (4.2 BSD). */
+#define SIGINFO 29 /* Information request (BSD). */
+#define SIGPWR SIGINFO /* Power failure imminent (System V). */
-/* These are the hard limits of the kernel. These values should not be
- used directly at user level. */
-#define __SIGRTMIN 32
-#define __SIGRTMAX (_NSIG - 1)
+#undef __SIGRTMAX
+#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
index e30efead0d..1a68255d02 100644
--- a/sysdeps/unix/sysv/linux/bits/signum.h
+++ b/sysdeps/unix/sysv/linux/bits/signum.h
@@ -16,64 +16,43 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#ifdef _SIGNAL_H
+#ifndef _BITS_SIGNUM_H
+#define _BITS_SIGNUM_H 1
-/* Fake signal functions. */
-#define SIG_ERR ((__sighandler_t) -1) /* Error return. */
-#define SIG_DFL ((__sighandler_t) 0) /* Default action. */
-#define SIG_IGN ((__sighandler_t) 1) /* Ignore signal. */
-
-#ifdef __USE_XOPEN
-# define SIG_HOLD ((__sighandler_t) 2) /* Add signal to hold mask. */
+#ifndef _SIGNAL_H
+#error "Never include <bits/signum.h> directly; use <signal.h> instead."
#endif
-
-/* Signals. */
-#define SIGHUP 1 /* Hangup (POSIX). */
-#define SIGINT 2 /* Interrupt (ANSI). */
-#define SIGQUIT 3 /* Quit (POSIX). */
-#define SIGILL 4 /* Illegal instruction (ANSI). */
-#define SIGTRAP 5 /* Trace trap (POSIX). */
-#define SIGABRT 6 /* Abort (ANSI). */
-#define SIGIOT 6 /* IOT trap (4.2 BSD). */
-#define SIGBUS 7 /* BUS error (4.2 BSD). */
-#define SIGFPE 8 /* Floating-point exception (ANSI). */
-#define SIGKILL 9 /* Kill, unblockable (POSIX). */
-#define SIGUSR1 10 /* User-defined signal 1 (POSIX). */
-#define SIGSEGV 11 /* Segmentation violation (ANSI). */
-#define SIGUSR2 12 /* User-defined signal 2 (POSIX). */
-#define SIGPIPE 13 /* Broken pipe (POSIX). */
-#define SIGALRM 14 /* Alarm clock (POSIX). */
-#define SIGTERM 15 /* Termination (ANSI). */
-#define SIGSTKFLT 16 /* Stack fault. */
-#define SIGCLD SIGCHLD /* Same as SIGCHLD (System V). */
-#define SIGCHLD 17 /* Child status has changed (POSIX). */
-#define SIGCONT 18 /* Continue (POSIX). */
-#define SIGSTOP 19 /* Stop, unblockable (POSIX). */
-#define SIGTSTP 20 /* Keyboard stop (POSIX). */
-#define SIGTTIN 21 /* Background read from tty (POSIX). */
-#define SIGTTOU 22 /* Background write to tty (POSIX). */
-#define SIGURG 23 /* Urgent condition on socket (4.2 BSD). */
-#define SIGXCPU 24 /* CPU limit exceeded (4.2 BSD). */
-#define SIGXFSZ 25 /* File size limit exceeded (4.2 BSD). */
-#define SIGVTALRM 26 /* Virtual alarm clock (4.2 BSD). */
-#define SIGPROF 27 /* Profiling alarm clock (4.2 BSD). */
-#define SIGWINCH 28 /* Window size change (4.3 BSD, Sun). */
-#define SIGPOLL SIGIO /* Pollable event occurred (System V). */
-#define SIGIO 29 /* I/O now possible (4.2 BSD). */
-#define SIGPWR 30 /* Power failure restart (System V). */
-#define SIGSYS 31 /* Bad system call. */
-#define SIGUNUSED 31
-
-#define _NSIG 65 /* Biggest signal number + 1
- (including real-time signals). */
-
-#define SIGRTMIN (__libc_current_sigrtmin ())
-#define SIGRTMAX (__libc_current_sigrtmax ())
-
-/* These are the hard limits of the kernel. These values should not be
- used directly at user level. */
-#define __SIGRTMIN 32
-#define __SIGRTMAX (_NSIG - 1)
+#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.h b/sysdeps/unix/sysv/linux/hppa/bits/signum.h
index 20c0b60c9f..5f54d1c893 100644
--- a/sysdeps/unix/sysv/linux/hppa/bits/signum.h
+++ b/sysdeps/unix/sysv/linux/hppa/bits/signum.h
@@ -16,74 +16,60 @@
License along with the GNU C Library. If not, see
<http://www.gnu.org/licenses/>. */
-#ifdef _SIGNAL_H
+#ifndef _BITS_SIGNUM_H
+#define _BITS_SIGNUM_H 1
-/* Fake signal functions. */
-#define SIG_ERR ((__sighandler_t) -1) /* Error return. */
-#define SIG_DFL ((__sighandler_t) 0) /* Default action. */
-#define SIG_IGN ((__sighandler_t) 1) /* Ignore signal. */
-
-#ifdef __USE_XOPEN
-# define SIG_HOLD ((__sighandler_t) 2) /* Add signal to hold mask. */
+#ifndef _SIGNAL_H
+#error "Never include <bits/signum.h> directly; use <signal.h> instead."
#endif
+#include <bits/signum-generic.h>
-/* Signals. */
-#define SIGHUP 1 /* Hangup (POSIX). */
-#define SIGINT 2 /* Interrupt (ANSI). */
-#define SIGQUIT 3 /* Quit (POSIX). */
-#define SIGILL 4 /* Illegal instruction (ANSI). */
-#define SIGTRAP 5 /* Trace trap (POSIX). */
-#define SIGABRT 6 /* Abort (ANSI). */
-#define SIGIOT 6 /* IOT trap (4.2 BSD). */
-#define SIGSTKFLT 7 /* Stack fault. */
-#define SIGFPE 8 /* Floating-point exception (ANSI). */
-#define SIGKILL 9 /* Kill, unblockable (POSIX). */
-#define SIGBUS 10 /* BUS error (4.2 BSD). */
-#define SIGSEGV 11 /* Segmentation violation (ANSI). */
-#define SIGXCPU 12 /* CPU limit exceeded (4.2 BSD). */
-#define SIGPIPE 13 /* Broken pipe (POSIX). */
-#define SIGALRM 14 /* Alarm clock (POSIX). */
-#define SIGTERM 15 /* Termination (ANSI). */
-#define SIGUSR1 16 /* User-defined signal 1 (POSIX). */
-#define SIGUSR2 17 /* User-defined signal 2 (POSIX). */
-#define SIGCLD SIGCHLD /* Same as SIGCHLD (System V). */
-#define SIGCHLD 18 /* Child status has changed (POSIX). */
-#define SIGPWR 19 /* Power failure restart (System V). */
-#define SIGVTALRM 20 /* Virtual alarm clock (4.2 BSD). */
-#define SIGPROF 21 /* Profiling alarm clock (4.2 BSD). */
-#define SIGPOLL SIGIO /* Pollable event occurred (System V). */
-#define SIGIO 22 /* I/O now possible (4.2 BSD). */
-#define SIGWINCH 23 /* Window size change (4.3 BSD, Sun). */
-#define SIGSTOP 24 /* Stop, unblockable (POSIX). */
-#define SIGTSTP 25 /* Keyboard stop (POSIX). */
-#define SIGCONT 26 /* Continue (POSIX). */
-#define SIGTTIN 27 /* Background read from tty (POSIX). */
-#define SIGTTOU 28 /* Background write to tty (POSIX). */
-#define SIGURG 29 /* Urgent condition on socket (4.2 BSD). */
-#define SIGXFSZ 30 /* File size limit exceeded (4.2 BSD). */
-#define SIGSYS 31 /* Bad system call. */
-#define SIGUNUSED 31
+/* 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 _NSIG 65 /* Biggest signal number + 1
- (including real-time signals). */
+#define SIGSTKFLT 7 /* Stack fault (obsolete). */
+#define SIGPWR 19 /* Power failure imminent. */
-#define SIGRTMIN (__libc_current_sigrtmin ())
-#define SIGRTMAX (__libc_current_sigrtmax ())
+#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
-/* These are the hard limits of the kernel. These values should not be
- used directly at user level. */
-/* In the Linux kernel version 3.17, and glibc 2.21, the signal numbers
- were rearranged in order to make hppa like every other arch. Previously
- we started __SIGRTMIN at 37, and that meant several pieces of important
- software, including systemd, would fail to build. To support systemd we
- removed SIGEMT and SIGLOST, and rearranged the others according to
- expected values. This is technically an ABI incompatible change, but
- because zero applications use SIGSTKFLT, SIGXCPU, SIGXFSZ and SIGSYS
- nothing broke. Nothing uses SIGEMT and SIGLOST, and they were present
- for HPUX compatibility which is no longer supported. Thus because
- nothing breaks we don't do any compatibility work here. */
-#define __SIGRTMIN 32 /* Kernel > 3.17. */
-#define __SIGRTMAX (_NSIG - 1)
+#undef __SIGRTMAX
+#define __SIGRTMAX 64
#endif /* <signal.h> included. */
diff --git a/sysdeps/unix/sysv/linux/mips/bits/signum.h b/sysdeps/unix/sysv/linux/mips/bits/signum.h
index 6c31e01cd7..1672847212 100644
--- a/sysdeps/unix/sysv/linux/mips/bits/signum.h
+++ b/sysdeps/unix/sysv/linux/mips/bits/signum.h
@@ -1,4 +1,4 @@
-/* Signal number definitions. Linux version.
+/* Signal number definitions. Linux/MIPS version.
Copyright (C) 1995-2017 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -16,63 +16,53 @@
License along with the GNU C Library. If not, see
<http://www.gnu.org/licenses/>. */
-#ifdef _SIGNAL_H
+#ifndef _BITS_SIGNUM_H
+#define _BITS_SIGNUM_H 1
-/* Fake signal functions. */
-#define SIG_ERR ((__sighandler_t) -1) /* Error return. */
-#define SIG_DFL ((__sighandler_t) 0) /* Default action. */
-#define SIG_IGN ((__sighandler_t) 1) /* Ignore signal. */
-
-#ifdef __USE_XOPEN
-# define SIG_HOLD ((__sighandler_t) 2) /* Add signal to hold mask. */
+#ifndef _SIGNAL_H
+#error "Never include <bits/signum.h> directly; use <signal.h> instead."
#endif
+#include <bits/signum-generic.h>
-#define SIGHUP 1 /* Hangup (POSIX). */
-#define SIGINT 2 /* Interrupt (ANSI). */
-#define SIGQUIT 3 /* Quit (POSIX). */
-#define SIGILL 4 /* Illegal instruction (ANSI). */
-#define SIGTRAP 5 /* Trace trap (POSIX). */
-#define SIGIOT 6 /* IOT trap (4.2 BSD). */
-#define SIGABRT SIGIOT /* Abort (ANSI). */
-#define SIGEMT 7
-#define SIGFPE 8 /* Floating-point exception (ANSI). */
-#define SIGKILL 9 /* Kill, unblockable (POSIX). */
-#define SIGBUS 10 /* BUS error (4.2 BSD). */
-#define SIGSEGV 11 /* Segmentation violation (ANSI). */
-#define SIGSYS 12
-#define SIGPIPE 13 /* Broken pipe (POSIX). */
-#define SIGALRM 14 /* Alarm clock (POSIX). */
-#define SIGTERM 15 /* Termination (ANSI). */
-#define SIGUSR1 16 /* User-defined signal 1 (POSIX). */
-#define SIGUSR2 17 /* User-defined signal 2 (POSIX). */
-#define SIGCHLD 18 /* Child status has changed (POSIX). */
-#define SIGCLD SIGCHLD /* Same as SIGCHLD (System V). */
-#define SIGPWR 19 /* Power failure restart (System V). */
-#define SIGWINCH 20 /* Window size change (4.3 BSD, Sun). */
-#define SIGURG 21 /* Urgent condition on socket (4.2 BSD). */
-#define SIGIO 22 /* I/O now possible (4.2 BSD). */
-#define SIGPOLL SIGIO /* Pollable event occurred (System V). */
-#define SIGSTOP 23 /* Stop, unblockable (POSIX). */
-#define SIGTSTP 24 /* Keyboard stop (POSIX). */
-#define SIGCONT 25 /* Continue (POSIX). */
-#define SIGTTIN 26 /* Background read from tty (POSIX). */
-#define SIGTTOU 27 /* Background write to tty (POSIX). */
-#define SIGVTALRM 28 /* Virtual alarm clock (4.2 BSD). */
-#define SIGPROF 29 /* Profiling alarm clock (4.2 BSD). */
-#define SIGXCPU 30 /* CPU limit exceeded (4.2 BSD). */
-#define SIGXFSZ 31 /* File size limit exceeded (4.2 BSD). */
-
+/* Adjustments and additions to the signal number constants for
+ Linux/MIPS. */
-#define _NSIG 128 /* Biggest signal number + 1
- (including real-time signals). */
+#define SIGEMT 7 /* Emulator trap. */
+#define SIGPWR 19 /* Power failure imminent. */
-#define SIGRTMIN (__libc_current_sigrtmin ())
-#define SIGRTMAX (__libc_current_sigrtmax ())
+#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
-/* These are the hard limits of the kernel. These values should not be
- used directly at user level. */
-#define __SIGRTMIN 32
-#define __SIGRTMAX (_NSIG - 1)
+#undef __SIGRTMAX
+#define __SIGRTMAX 127
#endif /* <signal.h> included. */
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/signum.h b/sysdeps/unix/sysv/linux/sparc/bits/signum.h
index a0c5be5fa5..25341ee42b 100644
--- a/sysdeps/unix/sysv/linux/sparc/bits/signum.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/signum.h
@@ -16,68 +16,24 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#ifdef _SIGNAL_H
+#ifndef _BITS_SIGNUM_H
+#define _BITS_SIGNUM_H 1
-/* Fake signal functions. */
-#define SIG_ERR ((__sighandler_t) -1) /* Error return. */
-#define SIG_DFL ((__sighandler_t) 0) /* Default action. */
-#define SIG_IGN ((__sighandler_t) 1) /* Ignore signal. */
-
-#ifdef __USE_XOPEN
-# define SIG_HOLD ((__sighandler_t) 2) /* Add signal to hold mask. */
+#ifndef _SIGNAL_H
+#error "Never include <bits/signum.h> directly; use <signal.h> instead."
#endif
-/*
- * Linux/SPARC has different signal numbers that Linux/i386: I'm trying
- * to make it OSF/1 binary compatible, at least for normal binaries.
- */
-#define SIGHUP 1
-#define SIGINT 2
-#define SIGQUIT 3
-#define SIGILL 4
-#define SIGTRAP 5
-#define SIGABRT 6
-#define SIGIOT 6
-#define SIGEMT 7
-#define SIGFPE 8
-#define SIGKILL 9
-#define SIGBUS 10
-#define SIGSEGV 11
-#define SIGSYS 12
-#define SIGPIPE 13
-#define SIGALRM 14
-#define SIGTERM 15
-#define SIGURG 16
-
-/* SunOS values which deviate from the Linux/i386 ones */
-#define SIGSTOP 17
-#define SIGTSTP 18
-#define SIGCONT 19
-#define SIGCHLD 20
-#define SIGCLD SIGCHLD /* Same as SIGCHLD (System V). */
-#define SIGTTIN 21
-#define SIGTTOU 22
-#define SIGIO 23
-#define SIGPOLL SIGIO /* SysV name for SIGIO */
-#define SIGXCPU 24
-#define SIGXFSZ 25
-#define SIGVTALRM 26
-#define SIGPROF 27
-#define SIGWINCH 28
-#define SIGLOST 29
-#define SIGPWR SIGLOST
-#define SIGUSR1 30
-#define SIGUSR2 31
+#include <bits/signum-generic.h>
-#define _NSIG 65 /* Biggest signal number + 1
- (including real-time signals). */
+/* Adjustments and additions to the signal number constants for
+ Linux/SPARC systems. Signal values on this platform were chosen
+ for SunOS binary compatibility. */
-#define SIGRTMIN (__libc_current_sigrtmin ())
-#define SIGRTMAX (__libc_current_sigrtmax ())
+#define SIGEMT 7 /* Emulator trap. */
+#define SIGLOST 29 /* Resource lost (Sun); server died (GNU). */
+#define SIGPWR SIGLOST /* Power failure imminent (SysV). */
-/* These are the hard limits of the kernel. These values should not be
- used directly at user level. */
-#define __SIGRTMIN 32
-#define __SIGRTMAX (_NSIG - 1)
+#undef __SIGRTMAX
+#define __SIGRTMAX 64
#endif /* <signal.h> included. */
diff --git a/sysdeps/unix/sysv/linux/tst-signal-numbers.sh b/sysdeps/unix/sysv/linux/tst-signal-numbers.sh
new file mode 100644
index 0000000000..bdd75fbc25
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/tst-signal-numbers.sh
@@ -0,0 +1,86 @@
+#! /bin/sh
+# Test that glibc's signal numbers match the kernel's.
+# Copyright (C) 2017 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
+# <http://www.gnu.org/licenses/>.
+
+set -e
+if [ -n "$BASH_VERSION" ]; then set -o pipefail; fi
+LC_ALL=C; export LC_ALL
+
+# We cannot use Linux's asm/signal.h to define signal numbers, because
+# it isn't sufficiently namespace-clean. Instead, this test checks
+# that our signal numbers match the kernel's. This script expects
+# "$@" to be $(CC) $(CPPFLAGS) as set by glibc's Makefiles, and $AWK
+# to be set in the environment.
+
+# Before doing anything else, fail if the compiler doesn't work.
+"$@" -E -xc -dM - < /dev/null > /dev/null
+
+tmpG=`mktemp -t signums_glibc.XXXXXXXXX`
+tmpK=`mktemp -t signums_kernel.XXXXXXXXX`
+trap "rm -f '$tmpG' '$tmpK'" 0
+
+# Filter out constants that aren't signal numbers.
+# If SIGPOLL is defined as SIGIO, swap it around so SIGIO is defined as
+# SIGPOLL. Similarly for SIGABRT and SIGIOT.
+# Discard obsolete signal numbers and unrelated constants:
+# SIGCLD, SIGIOT, SIGSWI, SIGUNUSED.
+# SIGSTKSZ, SIGRTMIN, SIGRTMAX.
+# Then sort the list.
+filter_defines ()
+{
+ $AWK '
+/^#define SIG[A-Z]+ ([0-9]+|SIG[A-Z0-9]+)$/ { signals[$2] = $3 }
+END {
+ if ("SIGPOLL" in signals && "SIGIO" in signals &&
+ signals["SIGPOLL"] == "SIGIO") {
+ signals["SIGPOLL"] = signals["SIGIO"]
+ signals["SIGIO"] = "SIGPOLL"
+ }
+ if ("SIGABRT" in signals && "SIGIOT" in signals &&
+ signals["SIGABRT"] == "SIGIOT") {
+ signals["SIGABRT"] = signals["SIGIOT"]
+ signals["SIGIOT"] = "SIGABRT"
+ }
+ for (sig in signals) {
+ if (sig !~ /^SIG(CLD|IOT|RT(MIN|MAX)|STKSZ|SWI|UNUSED)$/) {
+ printf("#define %s %s\n", sig, signals[sig])
+ }
+ }
+}' | sort
+}
+
+# $CC may contain command-line switches, so it should be word-split.
+printf '%s' '#define _GNU_SOURCE 1
+#include <signal.h>
+' |
+ "$@" -E -xc -dM - |
+ filter_defines > "$tmpG"
+
+printf '%s' '#define _GNU_SOURCE 1
+#define __ASSEMBLER__ 1
+#include <asm/signal.h>
+' |
+ "$@" -E -xc -dM - |
+ filter_defines > "$tmpK"
+
+if cmp -s "$tmpG" "$tmpK"; then
+ exit 0
+else
+ diff -u "$tmpG" "$tmpK"
+ exit 1
+fi