]> git.ipfire.org Git - thirdparty/glibc.git/commit
Don’t include signal.h from sys/wait.h or sys/param.h.
authorZack Weinberg <zackw@panix.com>
Mon, 10 Jun 2019 15:34:41 +0000 (11:34 -0400)
committerZack Weinberg <zackw@panix.com>
Wed, 8 Jan 2020 18:45:44 +0000 (13:45 -0500)
commit39906a3e2c0811b6097ec53cbe7b4d9f2321315e
tree0ca2bfb597ec2277bb2e2139bfb730d97e714c86
parentff9bae2f92e83e9655abd8b32021b0d6407ef560
Don’t include signal.h from sys/wait.h or sys/param.h.

Besides the snarl of debugger/ucontext interfaces, these are the only
public headers that include signal.h.

sys/wait.h includes signal.h only for the definition of siginfo_t.
We already have a single-type header for that, so use it.  siginfo_t
contains a field whose type is uid_t, but sys/wait.h is not specified
to define uid_t, so, as is already done for pid_t, the conformance
test is modified to expect that field to have type __uid_t instead.

It is not clear what subset of the definitions from signal.h are
actually expected by historical users of sys/param.h; I’ve chosen to
take the comment at face value and cut it down to bits/signum.h, which
supplies _NSIG and all of the SIG* constants.  This requires adjusting
every copy of bits/signum.h to permit inclusion by sys/param.h as well
as signal.h.

While I was at it I moved the comment about sys/param.h being obsolete
from sysdeps/mach/hurd/bits/param.h, where it’s not likely to be seen,
to the top-level sys/param.h, and edited it to give more useful advice.

This patch partially fixes Hurd-specific bug 23088; sys/wait.h is now
conformant.

* posix/sys/wait.h: Include bits/types/siginfo_t.h, not signal.h.
* conform/data/sys/wait.h-data: Do not expect a definition of uid_t.

* malloc/tst-mallocfork.c, nptl/tst-fork4.c, nptl/tst-getpid3.c
* nptl/tst-mutex9.c, nptl/tst-rwlock12.c
* resolv/tst-resolv-res_init-skeleton.c
* sysdeps/unix/sysv/linux/s390/tst-ptrace-singleblock.c:
        Include signal.h.

* nptl/tst-cancel4.c, rt/tst-mqueue1.c
* support/tst-support_capture_subprocess.c
* sysdeps/unix/sysv/linux/tst-align-clone.c:
Include signal.h.  Sort includes.

* misc/sys/param.h: Include bits/signum.h, not signal.h.
Add comment explaining that this header is obsolete, based on
a similar comment in Hurd bits/param.h.

* bits/param.h: Add multiple inclusion guard and defensive #error.
* sysdeps/mach/hurd/bits/param.h: Add multiple inclusion guard.
Remove comment explaining that this header is obsolete (see above).
* sysdeps/mach/i386/bits/mach/param.h: Add multiple inclusion guard.
* sysdeps/unix/sysv/linux/bits/param.h: Add multiple inclusion guard.

* bits/signum-generic.h, bits/signum.h
* sysdeps/unix/bsd/bits/signum.h
* sysdeps/unix/sysv/linux/alpha/bits/signum.h
* sysdeps/unix/sysv/linux/bits/signum.h
* sysdeps/unix/sysv/linux/hppa/bits/signum.h
* sysdeps/unix/sysv/linux/mips/bits/signum.h:
Allow inclusion by sys/param.h as well as signal.h.

* scripts/check-obsolete-constructs.py (HEADER_ALLOWED_INCLUDES):
Update.

        * sysdeps/mach/hurd/i386/Makefile: Remove XFAILs for sys/wait.h.
28 files changed:
bits/param.h
bits/signum-generic.h
bits/signum.h
conform/data/sys/wait.h-data
malloc/tst-mallocfork.c
misc/sys/param.h
nptl/tst-cancel4.c
nptl/tst-fork4.c
nptl/tst-getpid3.c
nptl/tst-mutex9.c
nptl/tst-rwlock12.c
posix/sys/wait.h
resolv/tst-resolv-res_init-skeleton.c
rt/tst-mqueue1.c
scripts/check-obsolete-constructs.py
support/tst-support_capture_subprocess.c
sysdeps/mach/hurd/bits/param.h
sysdeps/mach/hurd/i386/Makefile
sysdeps/mach/i386/bits/mach/param.h
sysdeps/unix/bsd/bits/signum.h
sysdeps/unix/sysv/linux/alpha/bits/signum.h
sysdeps/unix/sysv/linux/bits/param.h
sysdeps/unix/sysv/linux/bits/signum.h
sysdeps/unix/sysv/linux/hppa/bits/signum.h
sysdeps/unix/sysv/linux/mips/bits/signum.h
sysdeps/unix/sysv/linux/s390/tst-ptrace-singleblock.c
sysdeps/unix/sysv/linux/sparc/bits/signum.h
sysdeps/unix/sysv/linux/tst-align-clone.c