public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc/zack/no-nested-includes] (20 commits) fixup: hurd sys/socket.h is now conformant
@ 2019-06-20 16:05 Zack Weinberg
0 siblings, 0 replies; only message in thread
From: Zack Weinberg @ 2019-06-20 16:05 UTC (permalink / raw)
To: glibc-cvs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="us-ascii", Size: 166294 bytes --]
The branch 'zack/no-nested-includes' was updated to point to:
7a6b0dc... fixup: hurd sys/socket.h is now conformant
It previously pointed to:
41d479c... Rename sys/ucontext.h to bits/ucontext.h
Diff:
!!! WARNING: THE FOLLOWING COMMITS ARE NO LONGER ACCESSIBLE (LOST):
-------------------------------------------------------------------
41d479c... Rename sys/ucontext.h to bits/ucontext.h
a8394a5... Donât include signal.h from sys/param.h.
d6c6b6f... termio.h is also a compatibility wrapper
a3ec450... Donât include signal.h from sys/wait.h
16253d0... Minimize inclusion of netinet/in.h from public headers
5eb63b5... relocate yet another compatibility wrapper header
2848de2... fixup: hurd sys/socket.h is now conformant
0747e34... fixup: hurd sys/sem.h is now conformant
cbbe8df... fixup: hurd fcntl.h is now conformant
65ad516... Avoid including sys/socket.h from other public headers
a6978b8... Donât include sys/types.h or stdint.h n/n: bits headers
c405bb1... Minimize includes by networking headers 3/3: netinet
852c072... Minimize includes by networking headers 2/3: ipx, rose, pro
5dfe776... Minimize includes by networking headers 1/n: resolv, ethern
cac916a... sys/timex.h: donât include sys/time.h
1e18d1a... fixup: another trivial wrapper header move
7541148... fixup: consolidation of MIPS-specific trivial wrapper heade
4bd679a... Donât include stdint.h 1/n: easy cases
3d3bf6a... fixup: further consolidation of trivial wrapper headers
6e806d0... Donât rely on stddef.h or stdarg.h for individual type de
6c353fa... Add bits/types/ wrappers for stddef.h and stdarg.h types.
f051b61... fixup for whichever patch took sys/types.h out of sys/xattr
a1ec7ee... Clarify status of wait.h and sys/bitypes.h
29d6f4e... Don't include sys/types.h 8/n: Linux debugger headers
7745a3e... Don't include sys/types.h 7/n: Linux misc
30013aa... Don't include sys/types.h 6/n: sys/epoll.h
eaf9d41... Don't include sys/types.h 5/n: misc nonstandard headers
732e0f4... Fixup for Don't include sys/types.h 1/n
a149c44... fixup for an uncertain patch
0c5751d... fixup probably for Don't include sys/select.h from sys/type
c52e60d... fixup for sys/un.h: don't include string.h
f4fd9e9... Don't include sys/types.h 3a/n: fixups for utmp{,x}.h
5c525ac... Don't include sys/types.h 4/n: sys/mtio.h
ef00adf... Donât include sys/types.h 3/n: utmp{,x}.h
7c7d910... sys/un.h: Donât include string.h for strlen.
353b8ef... Donât include sys/types.h from POSIX headers (2/n): net,
b54843a... Don't include sys/types.h from POSIX headers (1/n)
d19f158... Donât include sys/select.h from sys/types.h.
8c09a07... Split up endian.h to minimize exposure of BYTE_ORDER.
03c4218... Limit the set of strings.h functions also exposed in string
e465c78... Donât include sys/cdefs.h directly from public headers.
c6e65ff... Swap sys/poll.h with poll.h.
284d3eb... Swap sys/syslog.h with syslog.h.
829dd01... Add check-obsolete-constructs checker for nested includes.
commit 41d479ceb0269ff18999e8332d82ea73cf6a8115
Author: Zack Weinberg <zackw@panix.com>
Date: Tue Jun 11 13:05:02 2019 -0400
Rename sys/ucontext.h to bits/ucontext.h
sys/ucontext.h is effectively a bits header. Its contents are
extremely system-specific, and itâs strongly associated with a
specific public header (ucontext.h) that provides a superset of its
definitions, but there are other public headers that also require some
of its definitions. This patch therefore moves it into the bits/
namespace and adjusts all the headers that refer to it. In case there
are external users, a stub is added that includes ucontext.h.
Most of the fallout changes are trivial, but ia64 and riscv need a
little more work. ia64 bits/ptrace.h and bits/procfs.h were both
including bits/sigcontext.h, which is only licensed to be included
from signal.h. (Iâm not sure how this ever worked, or why it broke
with this patch and not some previous one.) This is fixed by creating
another single-type header, bits/types/__ia64_fpreg.h, which provides
the only thing they need from bits/sigcontext.h.
s/u/s/l/riscv/makecontext.c was defining makecontext with a function
head that didnât agree with its official prototype (in ucontext.h);
formerly that file did not include ucontext.h, only sys/ucontext.h,
so we were getting away with it, but itâs still wrong. Making the
function head match the prototype actually simplifies the code.
* sysdeps/generic/sys/ucontext.h: Move to top level bits/ucontext.h.
Adjust multiple inclusion guard.
* sysdeps/arm/sys/ucontext.h: Move to sysdeps/arm/bits/ucontext.h.
Adjust multiple inclusion guard.
* sysdeps/i386/sys/ucontext.h: Similarly.
* sysdeps/m68k/sys/ucontext.h: Similarly.
* sysdeps/mips/sys/ucontext.h: Similarly.
* sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h: Similarly.
* sysdeps/unix/sysv/linux/alpha/sys/ucontext.h: Similarly.
* sysdeps/unix/sysv/linux/arm/sys/ucontext.h: Similarly.
* sysdeps/unix/sysv/linux/csky/sys/ucontext.h: Similarly.
* sysdeps/unix/sysv/linux/hppa/sys/ucontext.h: Similarly.
* sysdeps/unix/sysv/linux/ia64/sys/ucontext.h: Similarly.
* sysdeps/unix/sysv/linux/m68k/sys/ucontext.h: Similarly.
* sysdeps/unix/sysv/linux/microblaze/sys/ucontext.h: Similarly.
* sysdeps/unix/sysv/linux/mips/sys/ucontext.h: Similarly.
* sysdeps/unix/sysv/linux/nios2/sys/ucontext.h: Similarly.
* sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h: Similarly.
* sysdeps/unix/sysv/linux/riscv/sys/ucontext.h: Similarly.
* sysdeps/unix/sysv/linux/s390/sys/ucontext.h: Similarly.
* sysdeps/unix/sysv/linux/sh/sys/ucontext.h: Similarly.
* sysdeps/unix/sysv/linux/sparc/sys/ucontext.h: Similarly.
* sysdeps/unix/sysv/linux/x86/sys/ucontext.h: Similarly.
* stdlib/Makefile: Install bits/ucontext.h.
* stdlib/sys/ucontext.h: New backward compatibility stub header,
includes ucontext.h.
* include/sys/ucontext.h: New wrapper.
* sysdeps/unix/sysv/linux/ia64/bits/types/__ia64_fpreg.h:
New file, contents factored out of ia64/bits/sigcontext.h and
ia64/bits/ucontext.h.
* sysdeps/unix/sysv/linux/ia64/Makefile:
Install bits/types/__ia64_fpreg.h. Merge subdir=misc blocks.
* sysdeps/unix/sysv/linux/ia64/bits/sigcontext.h
* sysdeps/unix/sysv/linux/ia64/bits/ucontext.h:
Include bits/types/__ia64_fpreg.h for struct ia64_fpreg.
* sysdeps/unix/sysv/linux/ia64/bits/procfs.h:
Include bits/types/__ia64_fpreg.h for struct ia64_fpreg.
Donât include bits/sigcontext.h or bits/ucontext.h.
* sysdeps/unix/sysv/linux/ia64/sys/ptrace.h:
Donât include bits/sigcontext.h.
* sysdeps/unix/sysv/linux/riscv/makecontext.c: Include
ucontext.h, not sys/ucontext.h. Correct function head to match
prototype in ucontext.h. Use va_arg to retrieve all arguments
past argc.
* sysdeps/unix/sysv/linux/s390/tst-ptrace-singleblock.c:
Include signal.h. Sort list of includes.
* signal/signal.h, stdlib/ucontext.h
* sysdeps/unix/sysv/linux/alpha/bits/procfs-prregset.h
* sysdeps/unix/sysv/linux/ia64/sys/ptrace.h
* sysdeps/unix/sysv/linux/riscv/bits/procfs.h
* sysdeps/unix/sysv/linux/s390/bits/procfs.h:
Include bits/ucontext.h, not sys/ucontext.h.
* sysdeps/unix/sysv/linux/aarch64/sigcontextinfo.h
* sysdeps/unix/sysv/linux/arm/sigcontextinfo.h
* sysdeps/unix/sysv/linux/nios2/sigcontextinfo.h
* sysdeps/unix/sysv/linux/riscv/sigcontextinfo.h:
Include signal.h, not sys/ucontext.h.
* sysdeps/unix/sysv/linux/arm/register-dump.h
* sysdeps/unix/sysv/linux/csky/register-dump.h:
Include ucontext.h, not sys/ucontext.h.
* sysdeps/unix/sysv/linux/aarch64/ucontext_i.sym
* sysdeps/unix/sysv/linux/alpha/ucontext-offsets.sym
* sysdeps/unix/sysv/linux/arm/ucontext_i.sym
* sysdeps/unix/sysv/linux/csky/abiv2/ucontext_i.sym
* sysdeps/unix/sysv/linux/hppa/ucontext_i.sym
* sysdeps/unix/sysv/linux/i386/ucontext_i.sym
* sysdeps/unix/sysv/linux/ia64/sigcontext-offsets.sym
* sysdeps/unix/sysv/linux/m68k/m680x0/ucontext_i.sym
* sysdeps/unix/sysv/linux/powerpc/powerpc32/ucontext_i.sym
* sysdeps/unix/sysv/linux/powerpc/powerpc64/ucontext_i.sym
* sysdeps/unix/sysv/linux/mips/ucontext_i.sym
* sysdeps/unix/sysv/linux/nios2/ucontext_i.sym
* sysdeps/unix/sysv/linux/riscv/ucontext_i.sym
* sysdeps/unix/sysv/linux/s390/ucontext_i.sym
* sysdeps/unix/sysv/linux/sh/sh3/ucontext_i.sym
* sysdeps/unix/sysv/linux/sh/sh4/ucontext_i.sym
* sysdeps/unix/sysv/linux/sparc/sparc32/ucontext_i.sym
* sysdeps/unix/sysv/linux/x86_64/ucontext_i.sym:
Include stddef.h and signal.h; donât include any other headers.
* scripts/check-obsolete-constructs.py (HEADER_ALLOWED_INCLUDES)
(SYSDEP_ALLOWED_INCLUDES): Update.
commit a8394a5777c3a078565681c23015aae09feea80a
Author: Zack Weinberg <zackw@panix.com>
Date: Mon Jun 10 12:34:36 2019 -0400
Donât include signal.h from sys/param.h.
sys/param.h is the last public header that includes signal.h. 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.
bits/procfs.h ceased to include signal.h as of several patches ago but
I didnât realize Iâd done that until now.
* 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.
commit d6c6b6f3f26391249ca05340bf3bfb330ed1beb8
Author: Zack Weinberg <zackw@panix.com>
Date: Mon Jun 10 11:35:40 2019 -0400
termio.h is also a compatibility wrapper
commit a3ec45030d104903c3aabd7a087ab3f70d1bf5a0
Author: Zack Weinberg <zackw@panix.com>
Date: Mon Jun 10 11:34:41 2019 -0400
Donât include signal.h from sys/wait.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.
* 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: 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.
* scripts/check-obsolete-constructs.py (HEADER_ALLOWED_INCLUDES):
Update.
commit 16253d0b43d92a7c3f7013080199cd23fc7b2118
Author: Zack Weinberg <zackw@panix.com>
Date: Mon Jun 10 09:07:10 2019 -0400
Minimize inclusion of netinet/in.h from public headers
As with sys/socket.h and struct sockaddr, most of the files including
netinet/in.h just want struct sockaddr_in or a related type, so
introduce bits/types headers for these. POSIX specifically allows
arpa/inet.h to include netinet/in.h and I think it makes sense to
preserve that. The definition of struct sockaddr_in had a dependence
on the definition of struct sockaddr; to avoid that, bits/sockaddr.h
grows a new macro, __SOCKADDR_DATA_SIZE, which is the declared size of
struct sockaddr.sa_data.
On Linux, some kernel headers (notably linux/in.h and linux/in6.h)
attempt to cooperate with a C libraryâs headers in defining types such
as struct sockaddr_in. There is a set of macros whose names begin
with __UAPI_DEF_ that indicate that a type has already been defined.
This mechanism doesnât actually work with the kernel headers as they
are in 5.0, as far as I can tell, but it could be made to work with
straightforward changes, so it makes sense for us to support it to the
extent we can. To do this sensibly I need to introduce a new bits
header called bits/uapi-compat.h, with a trivial definition for
non-Linux. This replaces the existing __USE_KERNEL_IPV6_DEFS macro.
* bits/sockaddr.h (__SOCKADDR_DATA_SIZE): New macro.
* sysdeps/unix/bsd/bits/sockaddr.h: Likewise.
* sysdeps/unix/sysv/linux/m68k/bits/sockaddr.h: Likewise.
* socket/bits/types/struct_sockaddr.h: Use __SOCKADDR_DATA_SIZE as
array length of sa_data.
* bits/in.h: Add multiple inclusion guard.
(__USE_KERNEL_IPV6_DEFS): Donât define.
* sysdeps/unix/sysv/linux/bits/in.h: Similarly.
(IPV6_ADD_MEMBERSHIP, IPV6_DROP_MEMBERSHIP): Define when not
already defined, not conditional on __USE_KERNEL_IPV6_DEFS.
* bits/uapi-compat.h: New file, trivial generic version.
* sysdeps/unix/sysv/linux/bits/uapi-compat.h: New file,
Linux-specific version which recognizes kernel header guard macros
and defines __UAPI_DEF_* macros as appropriate.
* misc/Makefile: Install bits/uapi-compat.h.
* include/bits/types/in_addr_t.h, include/bits/types/in_port_t.h
* include/bits/types/struct_in_addr.h
* include/bits/types/struct_in6_addr.h
* include/bits/types/struct_sockaddr_in.h
* include/bits/types/struct_sockaddr_in6.h:
New wrapper headers.
* inet/bits/types/in_addr_t.h, inet/bits/types/in_port_t.h
* inet/bits/types/struct_in_addr.h
* inet/bits/types/struct_in6_addr.h
* inet/bits/types/struct_sockaddr_in.h
* inet/bits/types/struct_sockaddr_in6.h
New single-type headers, factored out of inet/netinet/in.h.
Add __UAPI_DEF_* conditionals where appropriate, and verify that
all conditionalized definitions agree with the relevant
OS-supplied header. Use __SOCKADDR_DATA_SIZE to set size of sin_zero.
* inet/Makefile: Install the new single-type headers.
* inet/netinet/in.h: Include bits/uapi-compat.h.
Define in_addr_t, in_port_t, struct in_addr, struct in6_addr,
struct sockaddr_in, and struct sockaddr_in6 by including the
above single-type headers, not directly. Replace all
__USE_KERNEL_IPV6_DEFS conditionals with appropriate __UAPI_DEF_*
conditionals. Add appropriate __UAPI_DEF_* conditionals around
the definitions of the IPPROTO_* constants, the IN_CLASS
macros, and struct ip_mreq. Import IN_LOOPBACK macro from
Linux 5.0 linux/in.h and verify all other conditionalized
definitions agree with the relevant linux/ header.
Define IPPORT_RESERVED only if not already defined, and make it a
macro so we can tell.
* inet/netinet/igmp.h, inet/netinet/ip.h, inet/netinet/ip_icmp.h:
Include bits/types/struct_in_addr.h, not netinet/in.h.
* inet/netinet/ip_icmp.h: Hoist all #includes to the top of the file.
* inet/netinet/icmp6.h, inet/netinet/ip6.h
* sysdeps/unix/sysv/linux/net/route.h:
Include bits/types/struct_in6_addr.h, not netinet/in.h.
* sysdeps/mach/hurd/net/route.h: Include bits/types.h and
bits/types/struct_in6_addr.h, not netinet/in.h. Use __uint16_t
and __uint32_t instead of uint16_t and uint32_t.
* resolv/bits/types/res_state.h: Include bits/types/struct_in_addr.h
and bits/types/struct_sockaddr_in.h. Forward declare struct
sockaddr_in6. Donât include netinet/in.h.
* resolv/netdb.h: Donât include netinet/in.h. Use socklen_t
instead of __socklen_t. Define IPPORT_RESERVED only if not
already defined, with definition matching netinet/in.h.
When __USE_MISC, include bits/sockaddr.h.
* resolv/resolv.h: Donât include netinet/in.h.
* inet/tst-getni1.c, inet/tst-getni2.c
* nss/tst-nss-files-hosts-erange.c, nss/tst-nss-files-hosts-getent.c
* nss/tst-nss-files-hosts-multi.c, posix/tst-getaddrinfo2.c
* resolv/tst-bug18665-tcp.c, resolv/tst-resolv-ai_idn-common.c
* resolv/tst-resolv-canonname.c, resolv/tst-resolv-edns.c
* resolv/tst-resolv-network.c, resolv/tst-resolv-nondecimal.c
* resolv/tst-resolv-search.c, support/tst-support-namespace.c:
Include netinet/in.h.
* support/resolv_test.h: Include stdint.h, not sys/cdefs.h.
* scripts/check-obsolete-constructs.py (HEADER_ALLOWED_INCLUDES):
Update.
commit 5eb63b581a57e340c70ddbc6062f2f0312925ed7
Author: Zack Weinberg <zackw@panix.com>
Date: Thu Jun 6 11:14:20 2019 -0400
relocate yet another compatibility wrapper header
commit 2848de2d6f8e8089755cb3681fa9ae06a53a4ec4
Author: Zack Weinberg <zackw@panix.com>
Date: Thu Jun 6 10:43:37 2019 -0400
fixup: hurd sys/socket.h is now conformant
commit 0747e34bc93865e8242a26e8d31f766280239101
Author: Zack Weinberg <zackw@panix.com>
Date: Thu Jun 6 10:43:21 2019 -0400
fixup: hurd sys/sem.h is now conformant
commit cbbe8dfdcc719d9eae0e6deb73d0e481e4deb61a
Author: Zack Weinberg <zackw@panix.com>
Date: Thu Jun 6 10:42:55 2019 -0400
fixup: hurd fcntl.h is now conformant
commit 65ad516a79abf8837c280240206dd804d2161c0e
Author: Zack Weinberg <zackw@panix.com>
Date: Thu Jun 6 09:49:54 2019 -0400
Avoid including sys/socket.h from other public headers
No standard public header is required to include sys/socket.h,
although some are allowed to. Several public headers need the
definitions of socklen_t, struct sockaddr, and/or struct
sockaddr_storage, but nothing else from sys/socket.h. We already have
a single-type header for socklen_t, so this patch adds single-type
headers for struct sockaddr and struct sockaddr_storage.
The definition of struct sockaddr_storage is subtly different on Linux
than on the Hurd; in order to not need two copies of
bits/types/struct_sockaddr_storage.h, bits/sockaddr.h is now
responsible for defining __ss_aligntype if âunsigned long intâ is not
the correct definition.
I also added a single-type header for struct linger, even though only
sys/socket.h is expected to define that, just because all three copies
of bits/socket.h were defining it exactly the same way. There would
also be a case for defining it directly in sys/socket.h but this
seemed tidier.
I did *not* create single-type headers for struct msghdr and struct
cmsghdr, because those and their helper macros are not consistent
among the three copies of bits/socket.h, and, again, only sys/socket.h
is expected to define them.
The large number of .c files that add an `#include <sys/socket.h>`
might make this look like itâs not worth doing. However, after this
change, only half of the files in the glibc source tree that include
netinet/in.h also need to include sys/socket.h, and only a third of
the files that include netdb.h need to include sys/socket.h. Before,
all of the files in both groups were getting sys/socket.h. That seems
like enough justification to me.
While I was at it I noticed that sys/socketvar.h is yet another
backward compatibility header that does nothing but include some other
header (sys/socket.h, in this case) and also doesnât need to be
system-dependent.
* socket/bits/types/struct_linger.h
* socket/bits/types/struct_sockaddr.h
* socket/bits/types/struct_sockaddr_storage.h:
New single-type headers, factored out of the various bits/socket.h
headers.
* include/bits/types/struct_linger.h
* include/bits/types/struct_sockaddr.h
* include/bits/types/struct_sockaddr_storage.h:
New wrappers.
* socket/Makefile (headers): Add bits/types/struct_linger.h,
bits/types/struct_sockaddr.h, and bits/types/struct_sockaddr_storage.h.
Alphabetize the list.
* bits/socket.h, sysdeps/mach/hurd/bits/socket.h
* sysdeps/unix/sysv/linux/bits/socket.h:
Donât define struct sockaddr, struct sockaddr_storage,
__ss_aligntype, or struct linger here. Minimize inclusions.
* sysdeps/unix/bsd/bits/sockaddr.h: Define __ss_aligntype here.
* socket/sys/socket.h: Include bits/types/struct_linger.h,
bits/sockaddr.h, bits/types/struct_sockaddr.h, and
bits/types/struct_sockaddr_storage.h. Move inclusion of
bits/socket.h below forward declaration of struct timespec,
and update commentary.
* inet/ifaddrs.h, socket/net/if.h
* sysdeps/mach/hurd/net/if_arp.h
* sysdeps/mach/hurd/net/route.h
* sysdeps/unix/sysv/linux/errqueue.h
* sysdeps/unix/sysv/linux/net/if_arp.h
* sysdeps/unix/sysv/linux/net/route.h:
Include bits/types/struct_sockaddr.h and possibly also bits/types.h,
not sys/socket.h or sys/types.h.
* sysdeps/unix/sysv/linux/errqueue.h:
* sysdeps/unix/sysv/linux/net/route.h:
Use __uint8_t and __uint32_t instead of uint8_t and uint32_t.
* inet/arpa/inet.h: Include bits/types/size_t.h.
* inet/netinet/in.h: Include bits/sockaddr.h,
bits/types/struct_sockaddr.h, and
bits/types/struct_sockaddr_storage.h,
not sys/socket.h. Use __socklen_t instead of socklen_t.
* inet/netinet/tcp.h: Include bits/types.h and
bits/types/struct_sockaddr_storage.h, not sys/socket.h or
bits/stdint-uintn.h. Use __uint8_t, __uint16_t, and __uint32_t
instead of uint8_t, uint16_t and uint32_t.
* inet/protocols/routed.h: Include features.h and
bits/types/struct_sockaddr.h, not sys/socket.h.
* resolv/netdb.h: Include bits/types/socklen_t.h.
* sysdeps/unix/sysv/linux/netatalk/at.h: Donât include sys/socket.h.
* include/ifaddrs.h: Include stddef.h for size_t.
* include/netdb.h: Use __socklen_t instead of socklen_t.
* inet/check_pf.c, inet/gethstbynm.c, inet/gethstbynm_r.c
* inet/getsourcefilter.c, inet/inet6_opt.c, inet/inet6_option.c
* inet/inet6_rth.c, inet/setsourcefilter.c, inet/test-ifaddrs.c
* inet/test-inet6_opt.c, inet/tst-inet6_rth.c
* inet/tst-inet6_scopeid_pton.c, nis/nss_nis/nis-hosts.c
* nis/nss_nisplus/nisplus-hosts.c, nscd/aicache.c, nscd/cache.c
* nscd/hstcache.c, nscd/initgrcache.c, nscd/netgroupcache.c
* nscd/nscd_gethst_r.c, nscd/servicescache.c, nss/digits_dots.c
* nss/nss_files/files-hosts.c, nss/nss_files/files-network.c
* nss/tst-nss-files-hosts-erange.c, nss/tst-nss-files-hosts-getent.c
* nss/tst-nss-files-hosts-multi.c, posix/tst-getaddrinfo3.c
* resolv/nss_dns/dns-network.c, resolv/resolv_conf.c
* resolv/tst-bug18665-tcp.c, resolv/tst-bug18665.c
* resolv/tst-inet_ntop.c, resolv/tst-inet_pton.c
* resolv/tst-resolv-ai_idn-common.c, resolv/tst-resolv-basic.c
* resolv/tst-resolv-edns.c, resolv/tst-resolv-network.c
* resolv/tst-resolv-nondecimal.c, resolv/tst-resolv-search.c
* resolv/tst-resolv-threads.c, resolv/tst-resolv-trailing.c
* sunrpc/rpc_gethostbyname.c
* support/support_format_address_family.c
* support/support_format_addrinfo.c
* support/support_format_dns_packet.c
* support/support_format_hostent.c, support/support_format_netent.c
* sysdeps/mach/hurd/if_index.c
* sysdeps/unix/sysv/linux/check_native.c: Include sys/socket.h.
* resolv/tst-resolv-binary.c: Include sys/types.h.
* sysdeps/generic/sys/socketvar.h: Move to socket/sys/socketvar.h.
* include/sys/socketvar.h: New wrapper.
* scripts/check-obsolete-constructs.py (HEADER_ALLOWED_INCLUDES):
Update.
* sysdeps/mach/hurd/i386/Makefile: Remove netdb.h, netinet/in.h,
and arpa/inet.h from the list of headers expected to fail
conformance tests.
commit a6978b8c2ae3ec3b8b3d6a361d3e50843c8fa8ff
Author: Zack Weinberg <zackw@panix.com>
Date: Wed Jun 5 08:24:27 2019 -0400
Donât include sys/types.h or stdint.h n/n: bits headers
Itâs especially troublesome for bits headers to include headers that
define unrelated public symbols, because it means whether or not
youâre getting e.g. sys/types.h when you include fcntl.h is
architecture- and/or OS-specific.
I suspect we do not need as many copies of bits/fcntl.h and bits/sem.h
as we have, but thatâs complicated enough that it deserves its own patchset.
* bits/fcntl.h: Add multiple include guard. Hoist inclusion of
bits/types.h to top of file.
* sysdeps/mach/hurd/bits/fcntl.h: Add multiple include guard.
Include bits/types.h, not sys/types.h; remove redundant inclusion
of bits/types.h in middle of file.
* bits/sem.h: Add multiple include guard. Include bits/types.h,
not sys/types.h.
* sysdeps/gnu/bits/sem.h: Likewise.
* sysdeps/unix/sysv/linux/bits/sem.h: Likewise.
* sysdeps/unix/sysv/linux/ia64/bits/ipc.h: Likewise.
* sysvipc/sys/sem.h: Include bits/types/pid_t.h and
bits/types/time_t.h.
* resolv/bits/types/res_state.h: Include bits/types.h, not
sys/types.h. Use __uint32_t and __uint16_t, not uint32_t and
uint16_t.
* sysdeps/mach/hurd/bits/socket.h: Include bits/types.h, not
sys/types.h.
* sysdeps/unix/sysv/linux/bits/socket.h: Likewise. Use __pid_t,
__uid_t, and __gid_t, not pid_t, uid_t, and gid_t.
* socket/sys/socket.h: Include bits/types.h, bits/types/ssize_t.h,
and bits/types/socklen_t.h.
* inet/htonl.c, include/htons.c: Include endian.h.
* include/netinet/ether.h: Include bits/types/size_t.h.
* scripts/check-obsolete-constructs.py (HEADER_ALLOWED_INCLUDES):
Update.
commit c405bb113a34dd3347e03025d9bdccce71d274fb
Author: Zack Weinberg <zackw@panix.com>
Date: Mon Jun 3 10:59:30 2019 -0400
Minimize includes by networking headers 3/3: netinet
Much the same as the other two, except for two things: the only copies
of ip_icmp.h and udp.h in the source tree are moved from sysdeps/gnu
to inet (after which there are no longer any netinet/ headers in
sysdeps/gnu), and much as sys/un.h needs to duplicate the prototype
for strlen, netinet/icmp6.h needs to duplicate the prototype for
memset. I am open to better ideas on that front.
Many netinet/*.h headers continue to include netinet/in.h even if they do
not technically need to. I suspect removing it would cause more trouble
than itâs worth.
* inet/netinet/icmp6.h: Include features.h, bits/endian.h,
bits/types.h, and bits/types/size_t.h. Donât include inttypes.h,
string.h, or sys/types.h. Duplicate prototype of memset here.
Use __uintN_t instead of uintN_t types.
* inet/netinet/igmp.h: Include bits/types.h. Donât include sys/types.h.
Use __uintN_t instead of uintN_t types.
* inet/netinet/ip.h: Include bits/types.h. Donât include
bits/stdint-uintn.h. Use __uintN_t instead of uintN_t types.
* inet/netinet/ip6.h: Include features.h, bits/endian.h, and
bits/types.h. Donât include inttypes.h. Use __uintN_t instead of
uintN_t types.
* inet/netinet/ip_icmp.h: Include features.h and bits/types.h.
Donât include sys/types.h or stdint.h. Use __uintN_t instead of
uintN_t types.
* inet/netinet/udp.h: Likewise.
* sysdeps/generic/netinet/if_ether.h: Likewise.
* sysdeps/unix/sysv/linux/netinet/if_ether.h: Likewise.
* sysdeps/unix/sysv/linux/netinet/if_fddi.h: Likewise.
* sysdeps/unix/sysv/linux/netinet/if_tr.h: Likewise.
* scripts/check-obsolete-constructs.py (HEADER_ALLOWED_INCLUDES):
Update.
* sysdeps/gnu/netinet/ip_icmp.h: Move to inet/netinet/ip_icmp.h.
* sysdeps/gnu/netinet/udp.h: Move to inet/netinet/udp.h.
* include/netinet/ip_icmp.h, include/netinet/udp.h: New wrappers.
* sysdeps/gnu/Makefile: Remove $(subdir)==inet stanza.
* inet/Makefile (headers): Add netinet/ip_icmp.h and
netinet/udp.h. Donât use $(wildcard *.h) for arpa and protocols
headers. Sort list.
commit 852c0727b2568265f6b0a52bb4ce46d5854a714b
Author: Zack Weinberg <zackw@panix.com>
Date: Sun Jun 2 11:17:36 2019 -0400
Minimize includes by networking headers 2/3: ipx, rose, protocols
In this chunk, we do everything that sorts alphabetically _after_
netinet/. Note that Rose and NetROM are based on AX.25 so it
makes practical sense for netrose/rose.h and netrom/netrom.h to
continue including netax25/ax25.h.
* inet/protocols/rwhod.h: Include features.h and bits/types.h.
Donât include sys/types.h. Use __int32_t instead of int32_t.
* inet/protocols/talkd.h: Include features.h and bits/types.h.
Donât include sys/types.h, sys/socket.h, or stdint.h. Use
__int32_t and __uint32_t instead of int32_t and uint32_t.
* inet/protocols/timed.h: Include features.h, bits/types.h,
and bits/types/struct_timeval.h. Donât include sys/types.h or
sys/time.h.
* sysdeps/unix/sysv/linux/netipx/ipx.h: Include features.h and
bits/types.h. Donât include sys/types.h or stdint.h. Use
__uint16_t and __uint32_t instead of uint16_t and uint32_t.
* sysdeps/unix/sysv/linux/netrose/rose.h: Include features.h.
Donât include sys/socket.h.
* scripts/check-obsolete-constructs.py (HEADER_ALLOWED_INCLUDES):
Update.
commit 5dfe7764f0cd3a2a5165e53497a0efeedc99ae2c
Author: Zack Weinberg <zackw@panix.com>
Date: Sat Jun 1 19:32:01 2019 -0400
Minimize includes by networking headers 1/n: resolv, ethernet, atalk
The networking headers are messy and complicated so Iâm doing the
inclusion minimization in small batches. This does everything that
sorts alphabetically before netinet/.
* resolv/resolv.h: Include bits/types.h, bits/types/FILE.h,
and bits/types/size_t.h; donât include sys/param.h, sys/types.h,
or stdio.h. Use __uint16_t and __uint32_t instead of uint16_t and
uint32_t.
* resolv/arpa/nameser.h: Include features.h, bits/types.h, and
bits/types/size_t.h; donât include sys/param.h, sys/types.h, or
stdint.h. Use __uint16_t and __uint32_t instead of uint16_t and
uint32_t.
* resolv/arpa/nameser_compat.h: Include features.h.
* sysdeps/mach/hurd/net/ethernet.h: Include bits/types.h;
donât include sys/types.h or stdint.h. Use __uint8_t and
__uint16_t instead of uint8_t and uint16_t.
* sysdeps/unix/sysv/linux/net/ethernet.h: Include features.h and
bits/types.h; donât include sys/types.h or stdint.h.
Use __uint8_t and __uint16_t instead of uint8_t and uint16_t.
* sysdeps/unix/sysv/linux/netinet/if_ether.h: Include features.h
and bits/types.h. Use __uint8_t instead of uint8_t.
* sysdeps/mach/hurd/net/if_arp.h: Donât include sys/types.h or
stdint.h. Use __uint32_t instead of uint32_t.
* sysdeps/unix/sysv/linux/net/if_arp.h: Include features.h.
Donât include sys/types.h or stdint.h. Use __uint32_t instead of
uint32_t.
* sysdeps/mach/hurd/net/route.h: Donât include sys/types.h.
* sysdeps/unix/sysv/linux/net/route.h: Donât include sys/types.h.
* sysdeps/unix/sysv/linux/net/if_ppp.h: Include features.h and
bits/types.h. Donât include sys/types.h or stdint.h. Use
__uint8_t and __uint32_t instead of uint8_t and uint32_t.
* sysdeps/unix/sysv/linux/net/if_shaper.h: Include features.h and
bits/types.h. Donât include sys/types.h or stdint.h. Use
__uint16_t and __uint32_t instead of uint16_t and uint32_t.
* sysdeps/unix/sysv/linux/netatalk/at.h: Include features.h,
bits/types.h, and sys/ioctl.h. Donât include asm/types.h or
linux/atalk.h. Copy over all user-appropriate definitions from
linux/atalk.h with adjustments for glibc context.
* grp/initgroups.c, nscd/initgrcache.c, nss/nss_db/db-XXX.c
* resolv/ns_print.c, resolv/tst-ns_name_compress.c
* resolv/tst-res_hnok.c, support/resolv_test.c:
Include stdio.h.
* nscd/initgrcache.c, nscd/netgroupcache.c
* nss/nss_compat/compat-grp.c, nss/nss_compat/compat-pwd.c
* nss/nss_compat/compat-spwd.c, resolv/ns_print.c:
Include sys/param.h for MIN and/or MAX.
* resolv/tst-resolv-res_init-skeleton.c: Include signal.h.
* scripts/check-obsolete-constructs.py
(HEADER_ALLOWED_INCLUDES, SYSDEP_ALLOWED_INCLUDES): Update.
commit cac916ad1186265356ce9890ab0ae6c54f15e945
Author: Zack Weinberg <zackw@panix.com>
Date: Fri May 31 10:30:38 2019 -0400
sys/timex.h: donât include sys/time.h
The interfaces defined in sys/timex.h only need struct timeval, not
any of the other things defined in sys/time.h.
While I was at it I moved stuff around so that sysdeps/â¦/linux/bits/timex.h
defines everything that linux/timex.h defines (as of version 5.0;
alas, we still cannot use uapi linux/timex.h directly) plus the
MOD_CLKA and MOD_CLKB constants. In particular, the TIME_* constants
are relevant to users of clock_adjtime as well as adjtimex (I presumeâ
clock_adjtime is not very well documented) so they should be visible
from time.h as well as sys/timex.h. Conversely, as far as I can tell,
struct ntptimeval was never a kernel interface on Linux, and MAXTC is
not part of the exposed API and also has the wrong value for current
kernels. Also I removed a thoroughly obsolete bug workaround from
ntp_gettime.c and ntp_gettimex.c.
* sysdeps/unix/sysv/linux/sys/timex.h: Donât include sys/time.h.
Update commentary. Donât define MAXTC. Move definition of
NTP_API and the TIME_* constants...
* sysdeps/unix/sysv/linux/bits/timex.h: ...here.
Allow inclusion only by sys/timex.h and bits/time.h.
Update commentary.
* sysdeps/unix/sysv/linux/ntp_gettime.c
* sysdeps/unix/sysv/linux/ntp_gettimex.c: Remove obsolete
check for MOD_OFFSET not being defined.
* scripts/check-obsolete-constructs.py (HEADER_ALLOWED_INCLUDES):
Update.
commit 1e18d1ae9b31a88dff36a5d04aac294f0f0249fa
Author: Zack Weinberg <zackw@panix.com>
Date: Thu May 30 13:42:28 2019 -0400
fixup: another trivial wrapper header move
commit 7541148b47f5c01b7e3f963eede7c5017d3331a3
Author: Zack Weinberg <zackw@panix.com>
Date: Thu May 30 13:38:37 2019 -0400
fixup: consolidation of MIPS-specific trivial wrapper headers
commit 4bd679afb49a7b126c2c21ea2684222e3934c712
Author: Zack Weinberg <zackw@panix.com>
Date: Thu May 30 12:47:06 2019 -0400
Donât include stdint.h 1/n: easy cases
These headers are all including <stdint.h> for a small number of
specific [u]intN_t types. I chose to change them to use
<bits/types.h> and __[u]intN_t types; this is the option which
minimizes the absolute number of names added to the user namespace by
each header. An alternative would be to have them use
<bits/stdint-[u]intn.h> and continue using user namespace types; this
option would be more conservative (less likely to break existing
application code).
* nss/nss.h
* sysdeps/powerpc/sys/platform/ppc.h
* sysdeps/unix/sysv/linux/sys/eventfd.h
* sysdeps/unix/sysv/linux/sys/fanotify.h
* sysdeps/unix/sysv/linux/sys/inotify.h
* sysdeps/unix/sysv/linux/sys/raw.h
* sysdeps/unix/sysv/linux/sys/signalfd.h:
Include bits/types.h, not stdint.h.
Include features.h where not already doing so.
Use __(u)intN_t types instead of (u)intN_t types in all
declarations.
* sysdeps/unix/sysv/linux/powerpc/bits/powerpc.h:
Use __uint64_t instead of uint64_t.
* nss/tst-nss-test4.c: Include stdint.h.
* scripts/check-obsolete-constructs.py (HEADER_ALLOWED_INCLUDES):
Update.
commit 3d3bf6ad0cec24f338633dc16391cb4f655255ab
Author: Zack Weinberg <zackw@panix.com>
Date: Wed May 29 15:17:45 2019 -0400
fixup: further consolidation of trivial wrapper headers
into one stanza each of HEADER_ALLOWED_INCLUDES and SYSDEP_ALLOWED_INCLUDES
commit 6e806d03cac552313ac7284772ed735ad5dd5962
Author: Zack Weinberg <zackw@panix.com>
Date: Wed May 29 14:23:32 2019 -0400
Donât rely on stddef.h or stdarg.h for individual type definitions.
In the course of developing earlier patches in this series I
discovered that clangâs stddef.h does not implement the __need_*
convention correctly: in C++, under some circumstances __need_NULL
will also cause a definition of nullptr_t, and when the âmodulesâ
feature is enabled, all of the __need macros are ignored and all of
stddef.h is exposed. (Iâm not sure how to actually make either of
these things happen, I discovered the problem by reading the file.)
Worse, clangâs stdarg.h does not implement __need___va_list *at all*;
including its stdarg.h will always expose all of its definitions.
These are bugs in clang but it seems prudent to work around them, and
the simplest way to do so is to have the bits/types/ headers
introduced in the previous patch make definitions themselves, when
possible. For size_t, ptrdiff_t, and wchar_t, we can use the
predefined macros __SIZE_TYPE__, __PTRDIFF_TYPE__, and __WCHAR_TYPE__,
when available, falling back to the old approach. For __gnuc_va_list,
we have a whitelist of compilers known to provide __builtin_va_list,
falling back to the old approach. NULL and va_list are defined
ab initio.
An additional complication is that we must be able to tell stddef.h
and stdarg.h _not_ to define again things we have already defined. It
appears to me, based on inspection of clang, GCC, and icc stddef.h and
stdarg.h, that we can use the macros _SIZE_T, _PTRDIFF_T, _WCHAR_T,
_VA_LIST, and __GNUC_VA_LIST to accomplish this.
Since we are no longer relying on stdarg.h to define an
implementation-namespace alias for us, I thought it would make sense
also to stop calling it __gnuc_va_list. The bulk of this patch is
a mechanical substitution of __va_list for __gnuc_va_list throughout
our headers.
Copyright boilerplate is added to stdlib/bits/NULL.h and stdlib/bits/types/*.h
because they now contain enough commentary and code that they could
plausibly be copyrightable.
* stdlib/bits/NULL.h: Do not use stddef.h to define NULL.
Define NULL ab initio if not already defined, as `((void *)0)` for C,
and either `__null` or 0 for C++, depending on compiler support.
* stdlib/bits/types/__va_list.h: If __builtin_va_list is known to
be available, use it to define __va_list without including
stdarg.h. Otherwise use __need___va_list to request a definition
of __gnuc_va_list and nothing else from stdarg.h, then use that to
define __va_list.
* stdlib/bits/types/va_list.h: Use __va_list, not __gnuc_va_list,
to define va_list. Improve commentary.
* stdlib/bits/types/ptrdiff_t.h: If __PTRDIFF_TYPE__ is defined,
use it to define ptrdiff_t without including stddef.h. Otherwise
use __need_ptrdiff_t to request a definition of ptrdiff_t and
nothing else from stddef.h. Use _PTRDIFF_T as guard macro to
match behavior of common stddef.h implementations.
* stdlib/bits/types/size_t.h: Similarly for size_t, with
__SIZE_TYPE__, __need_size_t, and _SIZE_T.
* stdlib/bits/types/wchar_t.h: Similarly for wchar_t, with
__WCHAR_TYPE__, __need_wchar_t, and _WCHAR_T. If __cplusplus
is defined, do nothing; wchar_t is built-in in C++.
* conform/data/stdio.h-data, conform/data/wchar.h-data
* include/err.h, include/stdio.h, include/syslog.h, include/wchar.h
* libio/bits/stdio.h, libio/bits/stdio2.h, libio/iolibio.h
* libio/libio.h, libio/stdio.h, libio/vwprintf.c, misc/bits/syslog.h
* misc/err.c, misc/err.h, misc/syslog.h, stdio-common/printf.h
* sysdeps/ieee754/ldbl-opt/nldbl-compat.c
* sysdeps/ieee754/ldbl-opt/nldbl-compat.h
* wcsmbs/bits/wchar2.h, wcsmbs/wchar.h:
Replace all uses of __gnuc_va_list with __va_list.
* scripts/check-obsolete-constructs.py (HEADER_ALLOWED_INCLUDES):
bits/NULL.h is no longer allowed to include stddef.h.
commit 6c353fa980f023cc10d492c0c560381af1dede9b
Author: Zack Weinberg <zackw@panix.com>
Date: Tue May 28 13:59:08 2019 -0400
Add bits/types/ wrappers for stddef.h and stdarg.h types.
We rely on the compiler's stddef.h and stdarg.h to define size_t,
ptrdiff_t, wchar_t, NULL, and __gnuc_va_list, and to implement a
convention that allows us to request the definition of a specific one:
for instance
#define __need_size_t
#include <stddef.h>
is expected to define size_t but not any of the other things stddef.h
defines.
This patch hides that convention behind a set of bits/types/ headers,
which allows check-obsolete-constructs.py to verify that none of our
headers include these headers unconditionally. (Both of them define
at least one item in the user namespace that no other header is
supposed to expose.) It will also facilitate coping with compilers
that donât implement the __need convention. (That scenario is not
hypothetical, see the next patch.)
Only public headers use the new bits headers. Non-public headers and
.c files in our codebase, that were formerly defining __need macros,
now just include stddef.h and/or stdarg.h without any __need macros.
A few files didnât need to be including stddef.h / stdarg.h at all.
Uses of NULL in public headers that arenât expected to define NULL
are changed to a bare 0. bits/NULL.h is only used by headers that
are expected to define NULL.
malloc.h and printf.h were, in fact, including stddef.h and/or
stdarg.h unconditionally; they no longer do that. This broke a few of
our test cases, which are fixed by adding appropriate inclusions to
the relevant .c files.
* stdlib/bits/NULL.h
* stdlib/bits/types/__va_list.h
* stdlib/bits/types/ptrdiff_t.h
* stdlib/bits/types/size_t.h
* stdlib/bits/types/va_list.h
* stdlib/bits/types/wchar_t.h:
New headers defining a single type or macro each.
* stdlib/Makefile: Install new headers.
* include/bits/NULL.h
* include/bits/types/__va_list.h
* include/bits/types/ptrdiff_t.h
* include/bits/types/size_t.h
* include/bits/types/va_list.h
* include/bits/types/wchar_t.h:
New wrapper headers.
* malloc/malloc.h: Donât include stdio.h or stddef.h.
Include bits/NULL.h, bits/types/size_t.h, bits/types/ptrdiff_t.h,
and bits/types/FILE.h.
* stdio-common/printf.h: Donât include stddef.h or stdarg.h.
Include bits/types/size_t.h, bits/types/wchar_t.h, and
bits/types/__va_list.h. Use __gnuc_va_list instead of va_list
in prototypes.
* libio/bits/types/struct_FILE.h: Include bits/types/size_t.h.
* misc/sys/param.h: Include features.h.
* sysvipc/sys/msg.h: Include bits/msq.h after all bits/types/ headers.
* sysvipc/sys/sem.h: Include bits/sem.h after all bits/types/ headers.
* sysvipc/sys/shm.h: Include bits/shm.h after all bits/types/ headers.
* hurd/hurd/signal.h: Donât use NULL.
* hurd/hurd/ioctl.h: Donât include stdarg.h.
* hurd/hurd/userlink.h: Donât include stddef.h. Donât use NULL.
* intl/libintl.h: Donât include stddef.h. Donât use NULL.
* intl/gettext.c, intl/ngettext.c: Include stddef.h
unconditionally. Donât define any __need macros first.
Donât include stdlib.h.
* sysdeps/posix/sigignore.c:, sysdeps/posix/sigset.c:
Donât include errno.h or string.h.
* malloc/tst-malloc-thread-fail.c: Include stddef.h.
* malloc/tst-malloc_info.c: Include stdio.h.
* stdio-common/tst-vfprintf-user-type.c: Include stdarg.h.
* string/tst-cmp.c: Include stdio.h.
* debug/wcpcpy_chk.c, iconv/loop.c, iconv/skeleton.c
* signal/sighold.c, signal/sigrelse.c, stdio-common/tempname.c
* sysdeps/generic/ldsodefs.h, sysdeps/nptl/libc-lock.h
* sysdeps/nptl/libc-lockP.h, sysdeps/posix/waitid.c
* wcsmbs/wcstol_l.c, wcsmbs/wcstoll_l.c, wcsmbs/wcstoul_l.c
* wcsmbs/wcstoull_l.c, sysdeps/posix/sigignore.c
* sysdeps/posix/sigset.c: Donât define __need macros before
including stddef.h.
* bits/socket.h, bits/types/stack_t.h, dirent/dirent.h
* dlfcn/dlfcn.h, elf/link.h, gmon/sys/profil.h, grp/grp.h
* gshadow/gshadow.h, hurd/hurd/signal.h
* hurd/hurd/sigpreempt.h, iconv/gconv.h, include/set-hooks.h
* include/stdio.h, inet/aliases.h, io/sys/sendfile.h
* libio/stdio.h, misc/bits/types/struct_iovec.h
* misc/search.h, misc/sys/mman.h, misc/sys/uio.h
* misc/sys/xattr.h, misc/syslog.h, posix/glob.h
* posix/sched.h, posix/sys/types.h, posix/unistd.h
* posix/wordexp.h, pwd/pwd.h, rt/aio.h, rt/mqueue.h
* shadow/shadow.h, signal/signal.h, socket/sys/socket.h
* socket/sys/un.h, stdlib/alloca.h, stdlib/monetary.h
* stdlib/stdlib.h, stdlib/sys/random.h, string/string.h
* string/strings.h, sunrpc/rpc/netdb.h
* sysdeps/htl/bits/types/struct___pthread_attr.h
* sysdeps/mach/hurd/bits/socket.h
* sysdeps/nptl/proc_service.h
* sysdeps/unix/sysv/linux/alpha/sys/user.h
* sysdeps/unix/sysv/linux/bits/socket.h
* sysdeps/unix/sysv/linux/bits/types/stack_t.h
* sysdeps/unix/sysv/linux/ia64/bits/sigcontext.h
* sysdeps/unix/sysv/linux/ia64/sys/user.h
* sysdeps/unix/sysv/linux/mips/bits/types/stack_t.h
* sysdeps/unix/sysv/linux/mips/sys/user.h
* sysdeps/unix/sysv/linux/powerpc/sys/user.h
* sysdeps/unix/sysv/linux/scsi/sg.h
* sysdeps/unix/sysv/linux/sh/sys/user.h
* sysdeps/unix/sysv/linux/sparc/sys/user.h
* sysdeps/unix/sysv/linux/sys/sysctl.h, sysvipc/sys/msg.h
* sysvipc/sys/sem.h, sysvipc/sys/shm.h, time/time.h
* wcsmbs/uchar.h, wcsmbs/wchar.h:
Use bits/types/size_t.h instead of __need_size_t.
* iconv/gconv.h, iconv/iconv.h, libio/libio.h
* stdlib/inttypes.h, stdlib/stdlib.h, wcsmbs/wchar.h:
Use bits/types/wchar_t.h instead of __need_wchar_t.
* libio/stdio.h, locale/locale.h, misc/sys/param.h
* posix/sched.h, posix/unistd.h, stdlib/stdlib.h
* string/string.h, sysdeps/unix/sysv/linux/bits/sigcontext.h
* time/time.h, wcsmbs/wchar.h: Use bits/NULL.h instead of __need_NULL.
* libio/stdio.h, misc/err.h: Use bits/types/__va_list.h instead
of __need___va_list.
* libio/stdio.h: Use bits/types/va_list.h instead of manually
defining va_list.
* hurd/hurd/userlink.h, misc/sys/mman.h, posix/sched.h
* sysdeps/mach/hurd/bits/socket.h
* sysdeps/unix/sysv/linux/ia64/bits/sigcontext.h
* wcsmbs/wchar.h: Reorganize includes; no semantic effect.
* stdlib/stdlib.h: Normalize format of multiple include guard.
* sysdeps/unix/sysv/linux/bits/sigcontext.h: Annotate workarounds
for kernel header bugs.
* scripts/check-obsolete-constructs.py
(UNIVERSAL_ALLOWED_INCLUDES): Remove stddef.h and stdarg.h.
(HEADER_ALLOWED_INCLUDES): Update.
commit f051b6176c939f47f25c2245fd8407bcb9bcc9df
Author: Zack Weinberg <zackw@panix.com>
Date: Sun May 26 12:36:09 2019 -0400
fixup for whichever patch took sys/types.h out of sys/xattr.h
commit a1ec7ee5e3e185485b43b72c43d9ca703a0de0ef
Author: Zack Weinberg <zackw@panix.com>
Date: Sun May 26 12:31:23 2019 -0400
Clarify status of wait.h and sys/bitypes.h
These headers are like sys/poll.h and sys/syslog.h: they are backward
compatibility names for other headers. Clarify this by adjusting their
position within the HEADER_ALLOWED_INCLUDES table.
* scripts/check-obsolete-constructs.py (HEADER_ALLOWED_INCLUDES):
Move entries for sys/bitypes.h and wait.h next to entries for
sys/poll.h and sys/syslog.h, and update the commentary for that
group of headers.
commit 29d6f4e7d12a2607317654e1f5813e4a37155432
Author: Zack Weinberg <zackw@panix.com>
Date: Sun May 26 12:30:46 2019 -0400
Don't include sys/types.h 8/n: Linux debugger headers
The debugger interface headers are a mess and I only have so much
patience for them. This does the bare minimum required for
thread_db.h, sys/procfs.h, and sys/user.h, which are at least
nominally cross-platform interfaces, to avoid including sys/types.h,
sys/time.h, and/or signal.h. Exposure of sys/ucontext.h is reduced
but not eliminated. Cross-architecture consistency should be improved.
* sysdeps/nptl/sys/procfs.h: Include features.h and bits/types.h,
not sys/types.h.
* sysdeps/nptl/thread_db.h: Donât include sys/types.h.
* sysdeps/nptl/proc_service.h: Include stddef.h for size_t.
Include bits/types/pid_t.h.
* sysdeps/unix/sysv/linux/sys/procfs.h: Include bits/types.h and
bits/types/struct_timeval.h, not sys/time.h or sys/types.h.
* sysdeps/unix/sysv/linux/aarch64/bits/procfs.h: Add multiple
inclusion guard. Include bits/types.h. Correct a comment.
* sysdeps/unix/sysv/linux/aarch64/sys/user.h: Include features.h.
* sysdeps/unix/sysv/linux/alpha/bits/procfs-prregset.h:
Add multiple inclusion guard. Include sys/ucontext.h.
* sysdeps/unix/sysv/linux/alpha/bits/procfs.h:
Add multiple inclusion guard. Donât include signal.h or
sys/ucontext.h.
* sysdeps/unix/sysv/linux/alpha/sys/user.h:
Include features.h. Include stddef.h for size_t. Move
inclusion of asm/reg.h above documentation comment.
* sysdeps/unix/sysv/linux/arm/bits/procfs.h: Add multiple
inclusion guard. Improve commentary.
* sysdeps/unix/sysv/linux/arm/sys/user.h: Include features.h.
* sysdeps/unix/sysv/linux/csky/bits/procfs.h: Add multiple
inclusion guard.
* sysdeps/unix/sysv/linux/hppa/bits/procfs.h: Add multiple
inclusion guard.
* sysdeps/unix/sysv/linux/ia64/bits/procfs.h: Add multiple
inclusion guard. Include sys/ucontext.h, not signal.h.
* sysdeps/unix/sysv/linux/ia64/sys/user.h: Donât include
sys/types.h. Include stddef.h for size_t.
* sysdeps/unix/sysv/linux/m68k/bits/procfs.h: Add multiple
inclusion guard. Improve commentary.
* sysdeps/unix/sysv/linux/m68k/sys/user.h: Include features.h.
* sysdeps/unix/sysv/linux/microblaze/bits/procfs.h: Add multiple
inclusion guard. Improve commentary.
* sysdeps/unix/sysv/linux/microblaze/sys/user.h: Include features.h.
* sysdeps/unix/sysv/linux/mips/bits/procfs.h: Add multiple
inclusion guard.
* sysdeps/unix/sysv/linux/mips/sys/user.h: Include features.h.
Define __need_size_t before including stddef.h. Move inclusion
of sgidefs.h below standard headers.
* sysdeps/unix/sysv/linux/nios2/bits/procfs.h: Add multiple
inclusion guard.
* sysdeps/unix/sysv/linux/nios2/sys/user.h: Include features.h.
* sysdeps/unix/sysv/linux/powerpc/bits/procfs.h: Add multiple
inclusion guard. Donât include signal.h or sys/ucontext.h.
Include bits/wordsize.h and asm/elf.h. Adjust conditional for
whether to provide various fallback definitions.
* sysdeps/unix/sysv/linux/powerpc/sys/user.h: Include features.h.
Define __need_size_t before including stddef.h.
* sysdeps/unix/sysv/linux/riscv/bits/procfs.h: Add multiple
inclusion guard. Add comment noting potential problems with
use of sys/ucontext.h.
* sysdeps/unix/sysv/linux/s390/bits/procfs.h: Add multiple
inclusion guard. Add comment noting potential problems with
use of sys/ucontext.h.
* sysdeps/unix/sysv/linux/s390/sys/user.h: Include features.h.
* sysdeps/unix/sysv/linux/sh/bits/procfs.h: Add multiple
inclusion guard.
* sysdeps/unix/sysv/linux/sh/sys/user.h: Include features.h.
Define __need_size_t before including stddef.h. Include
asm/ptrace after above two headers.
* sysdeps/unix/sysv/linux/sparc/bits/procfs.h: Add multiple
inclusion guard. Donât include signal.h or sys/ucontext.h.
* sysdeps/unix/sysv/linux/sparc/sys/user.h: Include features.h.
Define __need_size_t before including stddef.h.
* sysdeps/unix/sysv/linux/x86/bits/procfs.h: Add multiple
inclusion guard.
* sysdeps/unix/sysv/linux/x86/sys/user.h: Include features.h.
* scripts/check-obsolete-constructs.py
(HEADER_ALLOWED_INCLUDES, SYSDEP_ALLOWED_INCLUDES): Update.
commit 7745a3e5bcdec44a82dae5dd7897eef8ebfde605
Author: Zack Weinberg <zackw@panix.com>
Date: Sun May 26 12:08:40 2019 -0400
Don't include sys/types.h 7/n: Linux misc
These headers only have Linux-specific incarnations and can easily
avoid including sys/types.h.
* sysdeps/unix/sysv/linux/alpha/sys/acct.h: Style fix.
* sysdeps/unix/sysv/linux/sys/acct.h: Include features.h
and bits/stdint-uintn.h. Don't include sys/types.h, stdint.h,
or bits/types/time_t.h.
* sysdeps/unix/sysv/linux/sys/fsuid.h
* sysdeps/unix/sysv/linux/sys/quota.h
Include bits/types.h, not sys/types.h.
* scripts/check-obsolete-constructs.py (HEADER_ALLOWED_INCLUDES):
Update.
commit 30013aae10293b1fb384c643866be410718978af
Author: Zack Weinberg <zackw@panix.com>
Date: Sun May 26 12:06:13 2019 -0400
Don't include sys/types.h 6/n: sys/epoll.h
I thought I was going to need to change all of the arch-specific
bits/epoll.h headers as well, but it turned out not to be necessary.
I still took the opportunity to give them all multiple inclusion
guards.
* sysdeps/unix/sysv/linux/sys/epoll.h: Donât include stdint.h
or sys/types.h. Do include features.h and bits/types.h.
(union epoll_data, struct epoll_event): Use __uint32_t and
__uint64_t for field types.
* sysdeps/unix/sysv/linux/alpha/bits/epoll.h
* sysdeps/unix/sysv/linux/bits/epoll.h
* sysdeps/unix/sysv/linux/hppa/bits/epoll.h
* sysdeps/unix/sysv/linux/mips/bits/epoll.h
* sysdeps/unix/sysv/linux/sparc/bits/epoll.h
* sysdeps/unix/sysv/linux/x86/bits/epoll.h:
Add multiple inclusion guard.
* scripts/check-obsolete-constructs.py (HEADER_ALLOWED_INCLUDES):
Update.
commit eaf9d41cbf79ae4299caa25e6d72a523c6908ac8
Author: Zack Weinberg <zackw@panix.com>
Date: Sun May 26 11:49:25 2019 -0400
Don't include sys/types.h 5/n: misc nonstandard headers
Many nonstandard headers can also easily avoid including sys/types.h.
* elf/link.h, inet/aliases.h, misc/sys/xattr.h:
Don't include sys/types.h. Include stddef.h for size_t.
* gmon/sys/gmon.h: Don't include sys/types.h.
* gmon/sys/profil.h: Don't include sys/types.h.
Include stddef.h for size_t. Include bits/types/struct_timeval.h.
* io/fts.h: Don't include sys/types.h.
Include bits/types/dev_t.h, bits/types/ino_t.h, bits/types/ino64_t.h,
and bits/types/nlink_t.h.
* io/sys/sendfile.h: Don't include sys/types.h.
Include stddef.h for size_t.
Include bits/types.h, bits/types/off_t.h, and bits/types/ssize_t.h.
* stdlib/sys/random.h: Don't include sys/types.h.
Include stddef.h for size_t.
Include bits/types/ssize_t.h.
* gmon/tst-sprofil.h: Include sys/time.h.
* sysdeps/mach/hurd/sendfile.c: Include sys/types.h.
* scripts/check-obsolete-constructs.py (HEADER_ALLOWED_INCLUDES): Update.
commit 732e0f4b782b572f16a7ac6e84975bdf4de0b86a
Author: Zack Weinberg <zackw@panix.com>
Date: Sun May 26 11:14:13 2019 -0400
Fixup for Don't include sys/types.h 1/n
1/n partially mitigates Hurd-specific bug 23088 and therefore some
xfail annotations can be removed.
* sysdeps/mach/hurd/i386/Makefile: Remove test-xfail-*/*/conform
for semaphore.h, ftw.h, and sys/uio.h.
commit a149c444a8a2f4774cdec0b538b54f0fc68a01e7
Author: Zack Weinberg <zackw@panix.com>
Date: Sun May 26 11:11:33 2019 -0400
fixup for an uncertain patch
I'm not sure which public header change requires dl-fileid.h to change
in this way.
* sysdeps/posix/dl-fileid.h (r_file_id): Use __dev_t and __ino64_t
for field types.
commit 0c5751db624599feabff3831891b5a74f5629c39
Author: Zack Weinberg <zackw@panix.com>
Date: Sun May 26 11:07:20 2019 -0400
fixup probably for Don't include sys/select.h from sys/types.h
Not including sys/select.h from sys/types.h means that sys/types.h
also no longer defines anything from sys/time.h, and a couple of
files were relying on that.
(pthread_join_common.c should be using clock_gettime instead of
gettimeofday, but that's out of scope for this patch series.)
* nptl/pthread_join_common.c, sysdeps/unix/sysv/linux/dl-vdso.h:
Include sys/time.h.
commit c52e60d2d7fd286c65d76c67eec04ae6e37775b1
Author: Zack Weinberg <zackw@panix.com>
Date: Sun May 26 11:02:27 2019 -0400
fixup for sys/un.h: don't include string.h
1) For a valid prototype of strlen, sys/un.h must define size_t.
2) Some old RPC code was relying on sys/un.h to provide all of string.h.
* socket/sys/un.h: Include stddef.h for size_t.
* nis/nis_domain_of.c, nis/yp_xdr.c, sunrpc/svc.c: Include string.h.
commit f4fd9e948e38fe90d9cd652ee1813d88b1a19b60
Author: Zack Weinberg <zackw@panix.com>
Date: Sun May 26 10:44:34 2019 -0400
Don't include sys/types.h 3a/n: fixups for utmp{,x}.h
The conform tests expect utmpx.h to define time_t and suseconds_t.
These are the public names for the types of the fields of struct timeval,
and utmpx.h is required to define struct timeval, so this is a reasonable
expectation even though POSIX doesn't _explicitly_ say it's also required
to define time_t and suseconds_t.
utmp.h is not a standard header but it makes sense for it to be as consistent
with utmpx.h as possible, especially in our implementation where /var/log/utmp
and /var/log/utmpx have the same format.
* login/utmp.h, login/utmpx.h: Include bits/types/suseconds_t.h
and bits/types/time_t.h.
commit 5c525ac27dbef621388d9f8dc338aa770265a81c
Author: Zack Weinberg <zackw@panix.com>
Date: Sun May 26 10:43:50 2019 -0400
Don't include sys/types.h 4/n: sys/mtio.h
sys/mtio.h is another header that's unnecessarily in sysdeps/; the
only version we have is sysdeps/gnu/sys/mtio.h. Move to misc, and
remove its unnecessary inclusion of sys/types.h while we're at it.
This header uses the _IO* macros and therefore needs to continue
including sys/ioctl.h for now.
* sysdeps/gnu/sys/mtio.h: Move to misc/sys/mtio.h.
Don't include sys/types.h.
* sysdeps/gnu/Makefile: Don't add anything to sysdep_headers
for the misc directory.
* misc/Makefile (headers): Add sys/mtio.h.
* include/sys/mtio.h: New wrapper.
* scripts/check-obsolete-constructs.py (HEADER_ALLOWED_INCLUDES): Update.
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# On branch zack/no-nested-includes
# Your branch and 'origin/zack/no-nested-includes' have diverged,
# and have 35 and 16 different commits each, respectively.
# (use "git pull" to merge the remote branch into yours)
#
# Changes to be committed:
# new file: include/sys/mtio.h
# modified: misc/Makefile
# renamed: sysdeps/gnu/sys/mtio.h -> misc/sys/mtio.h
# modified: sysdeps/gnu/Makefile
#
# Changes not staged for commit:
# modified: elf/link.h
# modified: gmon/sys/gmon.h
# modified: gmon/sys/profil.h
# modified: gmon/tst-sprofil.c
# modified: inet/aliases.h
# modified: io/fts.h
# modified: io/sys/sendfile.h
# modified: login/utmp.h
# modified: login/utmpx.h
# modified: misc/sys/xattr.h
# modified: nis/nis_domain_of.c
# modified: nis/yp_xdr.c
# modified: nptl/pthread_join_common.c
# modified: scripts/check-obsolete-constructs.py
# modified: socket/sys/un.h
# modified: stdlib/sys/random.h
# modified: sunrpc/svc.c
# modified: sysdeps/mach/hurd/i386/Makefile
# modified: sysdeps/mach/hurd/sendfile.c
# modified: sysdeps/nptl/proc_service.h
# modified: sysdeps/nptl/sys/procfs.h
# modified: sysdeps/nptl/thread_db.h
# modified: sysdeps/posix/dl-fileid.h
# modified: sysdeps/unix/sysv/linux/aarch64/bits/procfs.h
# modified: sysdeps/unix/sysv/linux/aarch64/sys/user.h
# modified: sysdeps/unix/sysv/linux/alpha/bits/epoll.h
# modified: sysdeps/unix/sysv/linux/alpha/bits/procfs-prregset.h
# modified: sysdeps/unix/sysv/linux/alpha/bits/procfs.h
# modified: sysdeps/unix/sysv/linux/alpha/sys/acct.h
# modified: sysdeps/unix/sysv/linux/alpha/sys/user.h
# modified: sysdeps/unix/sysv/linux/arm/bits/procfs.h
# modified: sysdeps/unix/sysv/linux/arm/sys/user.h
# modified: sysdeps/unix/sysv/linux/bits/epoll.h
# modified: sysdeps/unix/sysv/linux/csky/bits/procfs.h
# modified: sysdeps/unix/sysv/linux/dl-vdso.h
# modified: sysdeps/unix/sysv/linux/hppa/bits/epoll.h
# modified: sysdeps/unix/sysv/linux/hppa/bits/procfs.h
# modified: sysdeps/unix/sysv/linux/ia64/bits/procfs.h
# modified: sysdeps/unix/sysv/linux/ia64/sys/user.h
# modified: sysdeps/unix/sysv/linux/m68k/bits/procfs.h
# modified: sysdeps/unix/sysv/linux/m68k/sys/user.h
# modified: sysdeps/unix/sysv/linux/microblaze/bits/procfs.h
# modified: sysdeps/unix/sysv/linux/microblaze/sys/user.h
# modified: sysdeps/unix/sysv/linux/mips/bits/epoll.h
# modified: sysdeps/unix/sysv/linux/mips/bits/procfs.h
# modified: sysdeps/unix/sysv/linux/mips/sys/user.h
# modified: sysdeps/unix/sysv/linux/nios2/bits/procfs.h
# modified: sysdeps/unix/sysv/linux/nios2/sys/user.h
# modified: sysdeps/unix/sysv/linux/powerpc/bits/procfs.h
# modified: sysdeps/unix/sysv/linux/powerpc/sys/user.h
# modified: sysdeps/unix/sysv/linux/riscv/bits/procfs.h
# modified: sysdeps/unix/sysv/linux/s390/bits/procfs.h
# modified: sysdeps/unix/sysv/linux/s390/sys/user.h
# modified: sysdeps/unix/sysv/linux/sh/bits/procfs.h
# modified: sysdeps/unix/sysv/linux/sh/sys/user.h
# modified: sysdeps/unix/sysv/linux/sparc/bits/epoll.h
# modified: sysdeps/unix/sysv/linux/sparc/bits/procfs.h
# modified: sysdeps/unix/sysv/linux/sparc/sys/user.h
# modified: sysdeps/unix/sysv/linux/sys/acct.h
# modified: sysdeps/unix/sysv/linux/sys/epoll.h
# modified: sysdeps/unix/sysv/linux/sys/fsuid.h
# modified: sysdeps/unix/sysv/linux/sys/procfs.h
# modified: sysdeps/unix/sysv/linux/sys/quota.h
# modified: sysdeps/unix/sysv/linux/x86/bits/epoll.h
# modified: sysdeps/unix/sysv/linux/x86/bits/procfs.h
# modified: sysdeps/unix/sysv/linux/x86/sys/user.h
#
commit ef00adfb5765a2b8c596b0c54f3d9d95b004e195
Author: Zack Weinberg <zackw@panix.com>
Date: Wed May 22 15:37:30 2019 -0400
Donât include sys/types.h 3/n: utmp{,x}.h
utmp.h and utmpx.h are also set up for system-dependence that is no
longer necessary. In fact, I think we might be able to fold their
respective bits headers into the primary headers and make them not
system-dependent at all. The remaining variation is between
s390*-*-linux* and everything else, and it appears to me that the s390
versions of the bits headers are actually the headers that everyone
should be using. The only difference is that the s390 headers
unconditionally use 64-bit quantities for lastlog.ll_time,
utmp{,x}.ut_tv, and utmp{,x}.ut_session, whereas the generic headers
use either 64- or 32-bit quantities depending on __WORDSIZE_TIME64_COMPAT32.
I could be wrong, but I donât think it makes sense for programs with
64-bit and 32-bit time_t to have different ideas of the layout of a
structures that are copied directly to and from a shared file on disk.
Anyway, I didnât fix that now; it should be its own patch. What I did
do, in addition to pruning the headers included by utmp.h, utmpx.h,
bits/utmp.h, and bits/utmpx.h, is some cleanup of a distinction
between GNU and non-GNU systems that is no longer relevant. This
patch is smaller than it looks, because git doesnât understand what
actually happened with bits/utmp.h and sysdeps/gnu/bits/utmp.h. The
true set of deletions and renames is:
rm bits/utmp.h
mv sysdeps/gnu/bits/utmp.h bits/utmp.h
mv sysdeps/gnu/bits/utmpx.h bits/utmpx.h
mv sysdeps/gnu/utmpx.h login/utmpx.h
I also made the inclusion of utmpx.h and the utmpx routines
unconditional in login/Makefile.
* bits/utmp.h: Delete file.
* sysdeps/gnu/bits/utmp.h: Move to bits/utmp.h.
Add multiple include guard.
Donât include paths.h, sys/time.h, or sys/types.h.
Donât use struct timeval.
Use __intN_t for consistency with bits/utmpx.h.
* sysdeps/unix/sysv/linux/s390/bits/utmp.h: Add multiple include guard.
Donât include paths.h, sys/time.h, sys/types.h, or bits/wordsize.h.
Donât use struct timeval.
Use __intN_t for consistency with bits/utmpx.h.
Use __time64_t unconditionally for lastlog.ll_time.
Use __int64_t unconditionally for utmp.ut_session.
Adjust indentation and blank lines to match bits/utmp.h.
* sysdeps/gnu/bits/utmpx.h: Move to bits/utmpx.h.
Add multiple include guard.
Donât include paths.h, sys/time.h, bits/types.h, or bits/wordsize.h.
Donât define _PATH_UTMPX or _PATH_WTMPX.
Donât use struct timeval.
Use pid_t for consistency with bits/utmp.h.
* sysdeps/unix/sysv/linux/s390/bits/utmpx.h: Add multiple include guard.
Donât define _PATH_UTMPX or _PATH_WTMPX.
Donât include paths.h, sys/time.h, bits/types.h, or bits/wordsize.h.
Donât define _PATH_UTMPX or _PATH_WTMPX.
Donât use struct timeval.
Use pid_t for consistency with bits/utmp.h.
Use __int64_t unconditionally for utmpx.ut_session.
* login/utmp.h: Donât include sys/types.h.
Do include paths.h, bits/types.h, bits/types/pid_t.h, and
bits/types/struct_timeval.h.
Move __BEGIN_DECLS to enclose only prototypes.
* sysdeps/gnu/utmpx.h: Move to login/utmpx.h.
Donât include sys/time.h.
Do include bits/types.h and bits/types/struct_timeval.h.
When __USE_GNU, include paths.h and define _PATH_UTMPX and _PATH_WTMPX.
* login/Makefile (headers): Add utmpx.h and bits/utmpx.h.
(routines): Add endutxent, getutmp, getutmpx, getutxent,
getutxid, getutxline, pututxline, setutxent, updwtmpx, and
utmpxname. Reorganize.
* sysdeps/gnu/Makefile: Do not add anything to sysdep_routines
or sysdep_headers when subdir == login.
* scripts/check-obsolete-constructs.py (HEADER_ALLOWED_INCLUDES): Update.
commit 7c7d9104db972481622a2297084ca0351869c7e3
Author: Zack Weinberg <zackw@panix.com>
Date: Wed May 22 12:03:57 2019 -0400
sys/un.h: Donât include string.h for strlen.
sys/un.h needs strlen in order to define SUN_LEN, but does not need
any of the other things declared by string.h; the path of least
resistance is to prototype strlen locally.
Also, the construct being used to get the size of everything up to the
sun_path member contains a formal dereference of a null pointer and
therefore has undefined behavior. Replace with __SOCKADDR_COMMON_SIZE.
* sys/un.h [__USE_MISC]: Donât include string.h. Prototype
strlen locally. Use __SOCKADDR_COMMON_SIZE for size of
leading members of struct sockaddr_un.
* scripts/check-obsolete-constructs.py (HEADER_ALLOWED_INCLUDES): Update.
commit 353b8eff84e9a356cbd494a177eeb81f5aca56c9
Author: Zack Weinberg <zackw@panix.com>
Date: Wed May 22 09:32:46 2019 -0400
Donât include sys/types.h from POSIX headers (2/n): net, netinet
This patch changes net/if.h, netinet/in_systm.h, netinet/ip.h, and
netinet/tcp.h to avoid including sys/types.h and/or stdint.h. They
primarily wanted these headers for the uintN_t types; all of them
except net/if.h now include <bits/stdint-uintn.h> instead, which means
they expose the uintN_t types. We could go further and have them use
__uintN_t types instead but Iâm not sure that would be better.
None of these headers are supposed to include <sys/socket.h> or
<netinet/in.h> either, but they all need struct sockaddr and/or
struct sockaddr_in. I am not sure whether I will get to that in
this patch series.
While I was at it, I noticed that all of these headers exist only in
sysdeps/generic and sysdeps/gnu. This means they arenât really
system-dependent and can be repatriated to the directories that
install them.
* sysdeps/generic/netinet/in_systm.h: Rename to
inet/netinet/in_systm.h. Include bits/stdint-uintn.h,
not sys/types.h or stdint.h.
* sysdeps/generic/netinet/ip.h: Rename to
inet/netinet/ip.h. Include bits/stdint-uintn.h and
bits/endian.h, not sys/types.h.
* sysdeps/gnu/netinet/tcp.h: Rename to
inet/netinet/tcp.h. Include bits/stdint-uintn.h and
bits/endian.h, not sys/types.h or stdint.h.
* sydeps/gnu/net/if.h: Rename to socket/net/if.h.
Donât include sys/types.h.
* include/net/if.h: Include socket/net/if.h, rather than
whatever the next net/if.h on the include path is.
* include/netinet/in_systm.h, include/netinet/ip.h
* include/netinet/tcp.h: New trivial wrappers.
* sysdeps/generic/net/if.h: Delete, never used.
* sysdeps/generic/netinet/tcp.h: Delete, never used.
* scripts/check-obsolete-constructs.py (HEADER_ALLOWED_INCLUDES): Update.
commit b54843a67a873ef2a00aec83f2ec4e82d1bc86db
Author: Zack Weinberg <zackw@panix.com>
Date: Tue May 21 19:05:39 2019 -0400
Don't include sys/types.h from POSIX headers (1/n)
Many POSIX headers are including sys/types.h when they are only supposed
to expose a small number of types from that header. There will be several
patches in this sub-series; this one does the easiest cases.
* io/ftw.h: Don't include sys/types.h.
* misc/sys/uio.h: Don't include sys/types.h.
Include bits/types.h and bits/types/ssize_t.h.
Include stddef.h for size_t.
* posix/spawn.h: Don't include sys/types.h.
Include bits/types.h, bits/types/mode_t.h, and bits/types/pid_t.h.
* rt/aio.h: Don't include sys/types.h.
Include bits/types.h, bits/pthreadtypes.h, and bits/types/ssize_t.h.
Include stddef.h for size_t.
* sysdeps/pthread/semaphore.h: Don't include sys/types.h.
* sysdeps/unix/sysv/linux/bits/uio-ext.h: Use __pid_t, not pid_t.
* scripts/check-obsolete-constructs.py
(HEADER_ALLOWED_INCLUDES): Update.
commit d19f158c2b06f162b8297c5560a28d9b7bb7c9f4
Author: Zack Weinberg <zackw@panix.com>
Date: Sat Mar 16 12:35:25 2019 -0400
Donât include sys/select.h from sys/types.h.
This is supposedly present for BSD compatibility, but the current
generation of BSDs is not consistent about it: FreeBSD does, OpenBSD
doesnât, NetBSD exposes only fd_set and the FD_* macros. Programs
that need to wait for any of multiple I/O events have several
alternatives to select nowadays, so I think it makes sense to expose
select only to programs that specifically want it.
Only a few places within our own code are affected. A few test
programs need to include sys/select.h explicitly, as does rpc/svc.h.
sysdeps/nptl/thread_db.h needs to declare sigset_t, and
sysdeps/unix/sysv/linux/pselect.c was including sys/poll.h instead of
sys/select.h, which is probably a copy-and-paste error. sys/socket.h
needs to forward-declare struct timespec under __USE_GNU, because
recvmmsg has a struct timespec * argument; Iâm open to the possibility
of having it fully declare struct timespec.
I considered taking sys/select.h out of sys/time.h as well, but POSIX
not only explicitly allows this inclusion, it requires sys/time.h to
declare almost everything that sys/select.h declares. It doesnât seem
worth creating another bits header just to prevent sys/time.h from
declaring pselect, sigset_t, and struct timespec.
* posix/sys/types.h: Donât include sys/select.h.
* scripts/check-obsolete-constructs.py: Remove whitelist entry
for sys/types.h -> sys/select.h. Adjust commentary re
sys/time.h -> sys/select.h.
* socket/sys/socket.h: When __USE_GNU, forward-declare struct timespec.
* misc/tst-fdset.c, nptl/tst-cancel4.c, scripts/check-c++-types.sh
* sunrpc/rpc/svc.h: Include sys/select.h.
* sysdeps/nptl/thread_db.h: Include bits/types/sigset_t.h.
* sysdeps/unix/sysv/linux/pselect.c: Include sys/select.h,
not sys/poll.h.
commit 8c09a078436ba689e15a055025d9dc699f263a49
Author: Zack Weinberg <zackw@panix.com>
Date: Fri Mar 15 09:02:24 2019 -0400
Split up endian.h to minimize exposure of BYTE_ORDER.
With only two exceptions (sys/types.h and sys/param.h, both of which
historically might have defined BYTE_ORDER) the public headers that
include <endian.h> only want to be able to test __BYTE_ORDER against
__*_ENDIAN.
This patch creates a new bits/endian.h that can be included by any
header that wants to be able to test __BYTE_ORDER and/or
__FLOAT_WORD_ORDER against the __*_ENDIAN constants, or needs
__LONG_LONG_PAIR. It only defines macros in the implementation
namespace.
The existing bits/endian.h (which could not be included independently
of endian.h, and only defines __BYTE_ORDER and maybe __FLOAT_WORD_ORDER)
is renamed to bits/endianness.h. I also took the opportunity to
canonicalize the form of this header, which we are stuck with having
one copy of per architecture. Since they are so short, this means git
doesnât understand that they were renamed from existing headers, sigh.
endian.h itself is a nonstandard header and its only remaining use
from a standard header is guarded by __USE_MISC, so I dropped the
__USE_MISC conditionals from around all of the public-namespace things
it defines. (This means, an application that requests strict library
conformance but includes endian.h will still see the definition of
BYTE_ORDER.)
A few changes to specific bits/endian(ness).h variants deserve
mention:
- sysdeps/unix/sysv/linux/ia64/bits/endian.h is moved to
sysdeps/ia64/bits/endianness.h. If I remember correctly, ia64 did
have selectable endianness, but we have assembly code in
sysdeps/ia64 that assumes itâs little-endian, so there is no reason
to treat the ia64 endianness.h as linux-specific.
- The C-SKY port does not fully support big-endian mode, but I do
not think this is sufficient reason to make csky/bits/endian(ness).h
error out if __CSKYBE__ is defined, so it now defines __BYTE_ORDER
appropriately for whichever mode the compiler is in.
- The PowerPC port had extra logic in its bits/endian.h to detect a
broken compiler, which strikes me as unnecessary, so I removed it.
- The only files that defined __FLOAT_WORD_ORDER always defined it to
the same value as __BYTE_ORDER, so I removed those definitions.
The SH bits/endian(ness).h had comments inconsistent with the
actual setting of __FLOAT_WORD_ORDER, which I also removed.
- I *removed* copyright boilerplate from the few bits/endian(ness).h
headers that had it; these files record a single fact in a fashion
dictated by an external spec, so I do not think they are copyrightable.
As long as I was changing every copy of ieee754.h in the tree, I
noticed that only the MIPS variant includes float.h, because it uses
LDBL_MANT_DIG to decide among three different versions of
ieee854_long_double. This patch makes it not include float.h when
GCCâs intrinsic __LDBL_MANT_DIG__ is available.
* string/endian.h: Unconditionally define LITTLE_ENDIAN,
BIG_ENDIAN, PDP_ENDIAN, and BYTE_ORDER. Condition byteswapping
macros only on !__ASSEMBLER__. Move the definitions of
__BIG_ENDIAN, __LITTLE_ENDIAN, __PDP_ENDIAN, __FLOAT_WORD_ORDER,
and __LONG_LONG_PAIR to...
* string/bits/endian.h: ...this new file, which includes
the renamed header bits/endianness.h for the definition of
__BYTE_ORDER and possibly __FLOAT_WORD_ORDER.
* string/Makefile: Install bits/endianness.h.
* include/bits/endian.h: New wrapper.
* bits/endian.h: Rename to bits/endianness.h.
Add multiple-include guard. Rewrite the comment explaining what
the machine-specific variants of this file should do.
* sysdeps/unix/sysv/linux/ia64/bits/endian.h:
Move to sysdeps/ia64.
* sysdeps/aarch64/bits/endian.h
* sysdeps/alpha/bits/endian.h
* sysdeps/arm/bits/endian.h
* sysdeps/csky/bits/endian.h
* sysdeps/hppa/bits/endian.h
* sysdeps/ia64/bits/endian.h
* sysdeps/m68k/bits/endian.h
* sysdeps/microblaze/bits/endian.h
* sysdeps/mips/bits/endian.h
* sysdeps/nios2/bits/endian.h
* sysdeps/powerpc/bits/endian.h
* sysdeps/riscv/bits/endian.h
* sysdeps/s390/bits/endian.h
* sysdeps/sh/bits/endian.h
* sysdeps/sparc/bits/endian.h
* sysdeps/x86/bits/endian.h:
Rename to endianness.h; canonicalize form of file; remove
redundant definitions of __FLOAT_WORD_ORDER.
* sysdeps/csky/bits/endianness.h: Do not error out if __CSKYEB__
is defined.
* sysdeps/powerpc/bits/endianness.h: Remove logic to check for
broken compilers.
* ctype/ctype.h
* inet/netinet/in.h
* resolv/arpa/nameser_compat.h
* sysdeps/aarch64/nptl/bits/pthreadtypes-arch.h
* sysdeps/arm/nptl/bits/pthreadtypes-arch.h
* sysdeps/csky/nptl/bits/pthreadtypes-arch.h
* sysdeps/ia64/ieee754.h
* sysdeps/ieee754/ieee754.h
* sysdeps/ieee754/ldbl-128/ieee754.h
* sysdeps/ieee754/ldbl-128ibm/ieee754.h
* sysdeps/m68k/nptl/bits/pthreadtypes-arch.h
* sysdeps/microblaze/nptl/bits/pthreadtypes-arch.h
* sysdeps/mips/ieee754/ieee754.h
* sysdeps/mips/nptl/bits/pthreadtypes-arch.h
* sysdeps/nios2/nptl/bits/pthreadtypes-arch.h
* sysdeps/nptl/pthread.h
* sysdeps/riscv/nptl/bits/pthreadtypes-arch.h
* sysdeps/sh/nptl/bits/pthreadtypes-arch.h
* sysdeps/sparc/sparc32/ieee754.h
* sysdeps/unix/sysv/linux/generic/bits/stat.h
* sysdeps/unix/sysv/linux/generic/bits/statfs.h
* sysdeps/unix/sysv/linux/sys/acct.h
* wctype/bits/wctype-wchar.h:
Include bits/endian.h, not endian.h.
* sysdeps/unix/sysv/linux/hppa/pthread.h: Donât include endian.h.
* sysdeps/mips/ieee754/ieee754.h: Use __LDBL_MANT_DIG__
in ifdefs, instead of LDBL_MANT_DIG. Only include float.h
when __LDBL_MANT_DIG__ is not predefined, in which case
define __LDBL_MANT_DIG__ to equal LDBL_MANT_DIG.
* scripts/check-obsolete-constructs.h: Remove most of the
whitelist entries for endian.h and float.h.
commit 03c421800dcba44e692d4187650f65bd2a3000ba
Author: Zack Weinberg <zackw@panix.com>
Date: Sat Mar 16 21:01:12 2019 -0400
Limit the set of strings.h functions also exposed in string.h.
As someone who can remember when you might not be able to include both
string.h and strings.h at the same time, it annoys me that strings.h
still exists and is the only standard source for str(n)casecmp(_l) and
ffs. I think itâs right that we expose those functions from string.h.
However, thereâs no reason we need to keep exposing the other obsolete
functions that strings.h declares from string.h.
This patch creates <bits/strings_x2k8.h>, which declares the
non-obsolete functions whose official home is strings.h. strings.h
includes it unconditionally, and string.h includes it under
__USE_MISC, instead of strings.h.
Two tests of the obsolete strings.h functions had to be adjusted.
* string/strings.h (strcasecmp, strncasecmp, strcasecmp_l)
(strncasecmp_l, ffs, ffsl, ffsll): Move declarations to...
* string/bits/strings_x2k8.h: ... this new file.
* string/Makefile: Install bits/strings_x2k8.h.
* include/bits/strings_x2k8h: New wrapper.
* string/string.h: Include bits/strings_x2k8.h instead of
strings.h.
* debug/tst-chk1.c, string/test-string.h: Include strings.h.
* scripts/check-obsolete-constructs.py: string.h is no longer
expected to include strings.h.
* sysdeps/i386/i686/multiarch/bcopy.c
* sysdeps/i386/i686/multiarch/bzero.c
* sysdeps/i386/i686/multiarch/ifunc-impl-list.c
* sysdeps/powerpc/powerpc32/power4/multiarch/ifunc-impl-list.c
* sysdeps/powerpc/powerpc64/multiarch/bcopy-ppc64.c
* sysdeps/powerpc/powerpc64/multiarch/bcopy.c
* sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c
* sysdeps/s390/bzero.c
* sysdeps/s390/multiarch/ifunc-impl-list.c
* sysdeps/sparc/sparc64/multiarch/bzero.c
* sysdeps/sparc/sparc64/multiarch/ifunc-impl-list.c:
Include strings.h.
commit e465c78bded048077a318a73931099aed0bc544f
Author: Zack Weinberg <zackw@panix.com>
Date: Sat Mar 16 14:31:08 2019 -0400
Donât include sys/cdefs.h directly from public headers.
The convention throughout glibc is that every public header includes
features.h directly, as its first action, and relies on features.h to
include sys/cdefs.h. In a few places, though, itâs been done the
other way around, usually in headers that were copied from a BSD
source (where the convention is exactly the opposite). This patch
makes all installed headers match the glibc convention.
This patch also corrects a bug in glob.h: it may declare size_t
without notifying stddef.h that it has done this, so e.g.
#define _XOPEN_SOURCE 700
#include <glob.h>
#include <stddef.h>
int dummy;
declares size_t twice, which is invalid prior to C2011. I wasnât able
to persuade gcc 8 to issue an error, even with -std=c89 -Wsystem-headers,
but clang is not so lenient.
* posix/glob.h: Include features.h, not sys/cdefs.h.
When __USE_XOPEN || USE_XOPEN2K8, include stddef.h for size_t;
otherwise, issue an immediate #error if __SIZE_TYPE__ is not
available. Use __gsize_t, not __size_t, as an impl-namespace
alternative name for size_t.
* conform/data/glob.h-data: Adjust to match.
* inet/netinet/igmp.h, mach/lock-intern.h, misc/ar.h
* misc/sys/auxv.h, resolv/resolv.h, socket/sys/un.h
* sunrpc/rpc/auth_des.h, sunrpc/rpc/rpc_msg.h
* sysdeps/generic/memcopy.h, sysdeps/generic/netinet/tcp.h
* sysdeps/htl/pthread.h, sysdeps/mach/hurd/net/ethernet.h
* sysdeps/mach/hurd/net/if_arp.h: Include features.h, not sys/cdefs.h.
* scripts/check-obsolete-constructs.py: Remove most whitelist
entries for sys/cdefs.h.
commit c6e65ff0f05c3e9bd2d8c5e5556c083487186c1c
Author: Zack Weinberg <zackw@panix.com>
Date: Sun Mar 17 09:50:36 2019 -0400
Swap sys/poll.h with poll.h.
Similarly to (sys/)syslog.h, poll.h is the header standardized by
POSIX, but we had all of its contents in sys/, for historical reasons.
This patch exchanges the contents of the two headers, and adds
multiple-include guards to all of poll.hâs bits headers.
* io/poll.h: Exchange contents with...
* io/sys/poll.h: ...this file. Adjust guard macros.
* include/poll.h: Exchange contents with...
* include/sys/poll.h: ...this file. Adjust guard macros.
* bits/poll.h, io/bits/poll2.h
* sysdeps/unix/sysv/linux/bits/poll.h
* sysdeps/unix/sysv/linux/m68k/bits/poll.h
* sysdeps/unix/sysv/linux/mips/bits/poll.h
* sysdeps/unix/sysv/linux/sparc/bits/poll.h:
Allow inclusion by poll.h, not sys/poll.h. Add multiple-
include guards where not already present.
* scripts/check-obsolete-constructs.py (HEADER_ALLOWED_INCLUDES):
Remove entry for poll.h; add entry for sys/poll.h.
commit 284d3eb37acbc48b655b8a953595cf4adb4acc29
Author: Zack Weinberg <zackw@panix.com>
Date: Sun Mar 17 09:31:56 2019 -0400
Swap sys/syslog.h with syslog.h.
Our installed syslog.h is a trivial wrapper around sys/syslog.h, which
is where all the actual declarations are. This is backward from
POSIX, which specifies syslog.h and its contents, and does not specify
sys/syslog.h. This arrangement appears to have been inherited from
some BSD-phylum C library, and probably pre-dates any standardization
of syslog.
This patch swaps the contents of syslog.h and sys/syslog.h, so that
the actual declarations appear under the standardized name. Since it
is necessary to adjust all of syslog.hâs bits headers, I also added
multiple-include guards to those files that didnât already have
them. (All installed headers should have multiple-include guards,
even if they are internal and only used in one public header. The
ânever include this file directlyâ #error convention doesnât protect
against including the internal header a second time after its parent
header has already been included.)
* misc/sys/syslog.h: Exchange contents with...
* misc/syslog.h: ...this file. Adjust multiple-include guards.
* include/sys/syslog.h: Exchange contents with...
* include/syslog.h: ...this file. Adjust multiple-include guards.
* bits/syslog-path.h, misc/bits/syslog-ldbl.h
* misc/bits/syslog.h: Allow inclusion by syslog.h, not sys/syslog.h.
Add multiple-include guard where not already present.
* scripts/check-obsolete-constructs.py (HEADER_ALLOWED_INCLUDES):
Add new group for sys/ headers that do nothing but include a
top-level header with the same basename, containing entry for
sys/syslog.h; remove entry for syslog.h.
commit 829dd01c3b8060893b213b36d6f930bbf1eb4b64
Author: Zack Weinberg <zackw@panix.com>
Date: Thu Mar 14 21:03:23 2019 -0400
Add check-obsolete-constructs checker for nested includes.
As a first step toward minimizing the number of public headers that
include other public headers, add a checker to check-obsolete-constructs
that will error out on any such inclusion thatâs not on a whitelist.
The whitelist is initialized to all of the nested inclusions that
already exist; subsequent patches will remove nested inclusions and
shrink the whitelist, hopefully to the point where we only have
nested inclusions as mandated by the relevant standards.
Hurd headers and Sun RPC headers and interface definitions are exempt
from these checks. The former is because minimizing their
cross-inclusions would require making Hurd-specific design decisions,
which I feel is best left to the Hurd maintainers. The latter is
because they are obsolete in glibc; cleanups should be done under the
auspices of TIRPC.
* scripts/check-obsolete-constructs.py
(UNIVERSAL_ALLOWED_INCLUDES, HEADER_ALLOWED_INCLUDES)
(SYSDEP_ALLOWED_INCLUDES, NESTED_INCLUDES_EXEMPT_RE)
(get_allowed_nested, NestedIncludeCheckerWhitelistOnly)
(NestedIncludeChecker): New.
(HeaderChecker): Instantiate and run a NestedIncludeChecker
for each header.
Summary of changes (added commits):
-----------------------------------
7a6b0dc... fixup: hurd sys/socket.h is now conformant
016e4f1... fixup: hurd sys/sem.h is now conformant
c499e0b... fixup: hurd fcntl.h is now conformant
9370e55... Rename sys/ucontext.h to bits/ucontext.h.
348d640... Minimize inclusion of netinet/in.h from public headers.
aa20ecc... Donât include sys/socket.h from other public headers.
efe2a5f... Minimize includes of unrelated public headers by networking
a465d6a... Donât include sys/types.h or stdint.h from other headers.
2cd8dcd... Donât include sys/time.h from sys/timex.h.
fd0a272... Donât include string.h from sys/un.h.
b761b91... Donât include signal.h from sys/wait.h or sys/param.h.
b423937... Donât include sys/select.h from sys/types.h.
f6480a0... Limit the set of strings.h functions also exposed in string
3f4e35e... Donât rely on stddef.h or stdarg.h for individual type de
b571a66... Add bits/types/ wrappers for stddef.h and stdarg.h types.
367ac2b... Split up endian.h to minimize exposure of BYTE_ORDER.
c93470c... Donât include sys/cdefs.h directly from public headers.
bb486ef... Swap sys/poll.h with poll.h.
034a98b... Swap sys/syslog.h with syslog.h.
e91def0... Add check-obsolete-constructs checker for nested includes.
commit 7a6b0dc807fc681aad8d36cfa7427e5ccb55785c
Author: Zack Weinberg <zackw@panix.com>
Date: Thu Jun 6 10:43:37 2019 -0400
fixup: hurd sys/socket.h is now conformant
commit 016e4f1a0aed1c7860c49046158b276e8f55e0f6
Author: Zack Weinberg <zackw@panix.com>
Date: Thu Jun 6 10:43:21 2019 -0400
fixup: hurd sys/sem.h is now conformant
commit c499e0b2d4df9fb708d045e8c4f5c61888a9bec5
Author: Zack Weinberg <zackw@panix.com>
Date: Thu Jun 6 10:42:55 2019 -0400
fixup: hurd fcntl.h is now conformant
commit 9370e5520fa8bbab8ac1690e603bc13559672184
Author: Zack Weinberg <zackw@panix.com>
Date: Tue Jun 11 13:05:02 2019 -0400
Rename sys/ucontext.h to bits/ucontext.h.
sys/ucontext.h is effectively a bits header. Its contents are
extremely system-specific, and itâs strongly associated with a
specific public header (ucontext.h) that provides a superset of its
definitions, but there are other public headers that also require some
of its definitions. This patch therefore moves it into the bits/
namespace and adjusts all the headers that refer to it. In case there
are external users, a stub is added that includes ucontext.h.
Most of the fallout changes are trivial, but ia64 and riscv need a
little more work. ia64 bits/ptrace.h and bits/procfs.h were both
including bits/sigcontext.h, which is only licensed to be included
from signal.h. (Iâm not sure how this ever worked, or why it broke
with this patch and not some previous one.) This is fixed by creating
another single-type header, bits/types/__ia64_fpreg.h, which provides
the only thing they need from bits/sigcontext.h.
s/u/s/l/riscv/makecontext.c was defining makecontext with a function
head that didnât agree with its official prototype (in ucontext.h);
formerly that file did not include ucontext.h, only sys/ucontext.h,
so we were getting away with it, but itâs still wrong. Making the
function head match the prototype actually simplifies the code.
* sysdeps/generic/sys/ucontext.h: Move to top level bits/ucontext.h.
Adjust multiple inclusion guard.
* sysdeps/arm/sys/ucontext.h: Move to sysdeps/arm/bits/ucontext.h.
Adjust multiple inclusion guard.
* sysdeps/i386/sys/ucontext.h: Similarly.
* sysdeps/m68k/sys/ucontext.h: Similarly.
* sysdeps/mips/sys/ucontext.h: Similarly.
* sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h: Similarly.
* sysdeps/unix/sysv/linux/alpha/sys/ucontext.h: Similarly.
* sysdeps/unix/sysv/linux/arm/sys/ucontext.h: Similarly.
* sysdeps/unix/sysv/linux/csky/sys/ucontext.h: Similarly.
* sysdeps/unix/sysv/linux/hppa/sys/ucontext.h: Similarly.
* sysdeps/unix/sysv/linux/ia64/sys/ucontext.h: Similarly.
* sysdeps/unix/sysv/linux/m68k/sys/ucontext.h: Similarly.
* sysdeps/unix/sysv/linux/microblaze/sys/ucontext.h: Similarly.
* sysdeps/unix/sysv/linux/mips/sys/ucontext.h: Similarly.
* sysdeps/unix/sysv/linux/nios2/sys/ucontext.h: Similarly.
* sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h: Similarly.
* sysdeps/unix/sysv/linux/riscv/sys/ucontext.h: Similarly.
* sysdeps/unix/sysv/linux/s390/sys/ucontext.h: Similarly.
* sysdeps/unix/sysv/linux/sh/sys/ucontext.h: Similarly.
* sysdeps/unix/sysv/linux/sparc/sys/ucontext.h: Similarly.
* sysdeps/unix/sysv/linux/x86/sys/ucontext.h: Similarly.
* stdlib/Makefile: Install bits/ucontext.h.
* stdlib/sys/ucontext.h: New backward compatibility stub header,
includes ucontext.h.
* include/sys/ucontext.h: New wrapper.
* sysdeps/unix/sysv/linux/ia64/bits/types/__ia64_fpreg.h:
New file, contents factored out of ia64/bits/sigcontext.h and
ia64/bits/ucontext.h.
* sysdeps/unix/sysv/linux/ia64/Makefile:
Install bits/types/__ia64_fpreg.h. Merge subdir=misc blocks.
* sysdeps/unix/sysv/linux/ia64/bits/sigcontext.h
* sysdeps/unix/sysv/linux/ia64/bits/ucontext.h:
Include bits/types/__ia64_fpreg.h for struct ia64_fpreg.
* sysdeps/unix/sysv/linux/ia64/bits/procfs.h:
Include bits/types/__ia64_fpreg.h for struct ia64_fpreg.
Donât include bits/sigcontext.h or bits/ucontext.h.
* sysdeps/unix/sysv/linux/ia64/sys/ptrace.h:
Donât include bits/sigcontext.h.
* sysdeps/unix/sysv/linux/riscv/makecontext.c: Include
ucontext.h, not sys/ucontext.h. Correct function head to match
prototype in ucontext.h. Use va_arg to retrieve all arguments
past argc.
* sysdeps/unix/sysv/linux/s390/tst-ptrace-singleblock.c:
Sort list of includes.
* signal/signal.h, stdlib/ucontext.h
* sysdeps/unix/sysv/linux/alpha/bits/procfs-prregset.h
* sysdeps/unix/sysv/linux/ia64/sys/ptrace.h
* sysdeps/unix/sysv/linux/riscv/bits/procfs.h
* sysdeps/unix/sysv/linux/s390/bits/procfs.h:
Include bits/ucontext.h, not sys/ucontext.h.
* sysdeps/unix/sysv/linux/aarch64/sigcontextinfo.h
* sysdeps/unix/sysv/linux/arm/sigcontextinfo.h
* sysdeps/unix/sysv/linux/nios2/sigcontextinfo.h
* sysdeps/unix/sysv/linux/riscv/sigcontextinfo.h:
Include signal.h, not sys/ucontext.h.
* sysdeps/unix/sysv/linux/arm/register-dump.h
* sysdeps/unix/sysv/linux/csky/register-dump.h:
Include ucontext.h, not sys/ucontext.h.
* sysdeps/unix/sysv/linux/aarch64/ucontext_i.sym
* sysdeps/unix/sysv/linux/alpha/ucontext-offsets.sym
* sysdeps/unix/sysv/linux/arm/ucontext_i.sym
* sysdeps/unix/sysv/linux/csky/abiv2/ucontext_i.sym
* sysdeps/unix/sysv/linux/hppa/ucontext_i.sym
* sysdeps/unix/sysv/linux/i386/ucontext_i.sym
* sysdeps/unix/sysv/linux/ia64/sigcontext-offsets.sym
* sysdeps/unix/sysv/linux/m68k/m680x0/ucontext_i.sym
* sysdeps/unix/sysv/linux/powerpc/powerpc32/ucontext_i.sym
* sysdeps/unix/sysv/linux/powerpc/powerpc64/ucontext_i.sym
* sysdeps/unix/sysv/linux/mips/ucontext_i.sym
* sysdeps/unix/sysv/linux/nios2/ucontext_i.sym
* sysdeps/unix/sysv/linux/riscv/ucontext_i.sym
* sysdeps/unix/sysv/linux/s390/ucontext_i.sym
* sysdeps/unix/sysv/linux/sh/sh3/ucontext_i.sym
* sysdeps/unix/sysv/linux/sh/sh4/ucontext_i.sym
* sysdeps/unix/sysv/linux/sparc/sparc32/ucontext_i.sym
* sysdeps/unix/sysv/linux/x86_64/ucontext_i.sym:
Include stddef.h and signal.h; donât include any other headers.
* scripts/check-obsolete-constructs.py (HEADER_ALLOWED_INCLUDES)
(SYSDEP_ALLOWED_INCLUDES): Update.
commit 348d640b8790d83002a82a20ddc623b1efb3116e
Author: Zack Weinberg <zackw@panix.com>
Date: Mon Jun 10 09:07:10 2019 -0400
Minimize inclusion of netinet/in.h from public headers.
As with sys/socket.h and struct sockaddr, most of the files including
netinet/in.h just want struct sockaddr_in or a related type, so
introduce bits/types headers for these. POSIX specifically allows
arpa/inet.h to include netinet/in.h and I think it makes sense to
preserve that. The definition of struct sockaddr_in had a dependence
on the definition of struct sockaddr; to avoid that, bits/sockaddr.h
grows a new macro, __SOCKADDR_DATA_SIZE, which is the declared size of
struct sockaddr.sa_data.
On Linux, some kernel headers (notably linux/in.h and linux/in6.h)
attempt to cooperate with a C libraryâs headers in defining types such
as struct sockaddr_in. There is a set of macros whose names begin
with __UAPI_DEF_ that indicate that a type has already been defined.
This mechanism doesnât actually work with the kernel headers as they
are in 5.0, as far as I can tell, but it could be made to work with
straightforward changes, so it makes sense for us to support it to the
extent we can. To do this sensibly I need to introduce a new bits
header called bits/uapi-compat.h, with a trivial definition for
non-Linux. This replaces the existing __USE_KERNEL_IPV6_DEFS macro.
* bits/sockaddr.h (__SOCKADDR_DATA_SIZE): New macro.
* sysdeps/unix/bsd/bits/sockaddr.h: Likewise.
* sysdeps/unix/sysv/linux/m68k/bits/sockaddr.h: Likewise.
* socket/bits/types/struct_sockaddr.h: Use __SOCKADDR_DATA_SIZE as
array length of sa_data.
* bits/in.h: Add multiple inclusion guard.
(__USE_KERNEL_IPV6_DEFS): Donât define.
* sysdeps/unix/sysv/linux/bits/in.h: Similarly.
(IPV6_ADD_MEMBERSHIP, IPV6_DROP_MEMBERSHIP): Define when not
already defined, not conditional on __USE_KERNEL_IPV6_DEFS.
* bits/uapi-compat.h: New file, trivial generic version.
* sysdeps/unix/sysv/linux/bits/uapi-compat.h: New file,
Linux-specific version which recognizes kernel header guard macros
and defines __UAPI_DEF_* macros as appropriate.
* misc/Makefile: Install bits/uapi-compat.h.
* include/bits/types/in_addr_t.h, include/bits/types/in_port_t.h
* include/bits/types/struct_in_addr.h
* include/bits/types/struct_in6_addr.h
* include/bits/types/struct_sockaddr_in.h
* include/bits/types/struct_sockaddr_in6.h:
New wrapper headers.
* inet/bits/types/in_addr_t.h, inet/bits/types/in_port_t.h
* inet/bits/types/struct_in_addr.h
* inet/bits/types/struct_in6_addr.h
* inet/bits/types/struct_sockaddr_in.h
* inet/bits/types/struct_sockaddr_in6.h
New single-type headers, factored out of inet/netinet/in.h.
Add __UAPI_DEF_* conditionals where appropriate, and verify that
all conditionalized definitions agree with the relevant
OS-supplied header. Use __SOCKADDR_DATA_SIZE to set size of sin_zero.
* inet/Makefile: Install the new single-type headers.
* inet/netinet/in.h: Include bits/uapi-compat.h.
Define in_addr_t, in_port_t, struct in_addr, struct in6_addr,
struct sockaddr_in, and struct sockaddr_in6 by including the
above single-type headers, not directly. Replace all
__USE_KERNEL_IPV6_DEFS conditionals with appropriate __UAPI_DEF_*
conditionals. Add appropriate __UAPI_DEF_* conditionals around
the definitions of the IPPROTO_* constants, the IN_CLASS
macros, and struct ip_mreq. Import IN_LOOPBACK macro from
Linux 5.0 linux/in.h and verify all other conditionalized
definitions agree with the relevant linux/ header.
Define IPPORT_RESERVED only if not already defined, and make it a
macro so we can tell.
* inet/netinet/igmp.h, inet/netinet/ip.h, inet/netinet/ip_icmp.h:
Include bits/types/struct_in_addr.h, not netinet/in.h.
* inet/netinet/ip_icmp.h: Hoist all #includes to the top of the file.
* inet/netinet/icmp6.h, inet/netinet/ip6.h
* sysdeps/unix/sysv/linux/net/route.h:
Include bits/types/struct_in6_addr.h, not netinet/in.h.
* sysdeps/mach/hurd/net/route.h: Include bits/types.h and
bits/types/struct_in6_addr.h, not netinet/in.h. Use __uint16_t
and __uint32_t instead of uint16_t and uint32_t.
* resolv/bits/types/res_state.h: Include bits/types/struct_in_addr.h
and bits/types/struct_sockaddr_in.h. Forward declare struct
sockaddr_in6. Donât include netinet/in.h.
* resolv/netdb.h: Donât include netinet/in.h. Use socklen_t
instead of __socklen_t. Define IPPORT_RESERVED only if not
already defined, with definition matching netinet/in.h.
When __USE_MISC, include bits/sockaddr.h.
* resolv/resolv.h: Donât include netinet/in.h.
* inet/tst-getni1.c, inet/tst-getni2.c
* nss/tst-nss-files-hosts-erange.c, nss/tst-nss-files-hosts-getent.c
* nss/tst-nss-files-hosts-multi.c, posix/tst-getaddrinfo2.c
* resolv/tst-bug18665-tcp.c, resolv/tst-resolv-ai_idn-common.c
* resolv/tst-resolv-canonname.c, resolv/tst-resolv-edns.c
* resolv/tst-resolv-network.c, resolv/tst-resolv-nondecimal.c
* resolv/tst-resolv-search.c, support/tst-support-namespace.c:
Include netinet/in.h.
* support/resolv_test.h: Include stdint.h, not sys/cdefs.h.
* scripts/check-obsolete-constructs.py (HEADER_ALLOWED_INCLUDES):
Update.
commit aa20eccf796bf44c1d6b79f06f4158dfc8e0b8c3
Author: Zack Weinberg <zackw@panix.com>
Date: Thu Jun 6 09:49:54 2019 -0400
Donât include sys/socket.h from other public headers.
No standard public header is required to include sys/socket.h,
although some are allowed to. Several public headers need the
definitions of socklen_t, struct sockaddr, and/or struct
sockaddr_storage, but nothing else from sys/socket.h. We already have
a single-type header for socklen_t, so this patch adds single-type
headers for struct sockaddr and struct sockaddr_storage.
The definition of struct sockaddr_storage is subtly different on Linux
than on the Hurd; in order to not need two copies of
bits/types/struct_sockaddr_storage.h, bits/sockaddr.h is now
responsible for defining __ss_aligntype if âunsigned long intâ is not
the correct definition.
I also added a single-type header for struct linger, even though only
sys/socket.h is expected to define that, just because all three copies
of bits/socket.h were defining it exactly the same way. There would
also be a case for defining it directly in sys/socket.h but this
seemed tidier.
I did *not* create single-type headers for struct msghdr and struct
cmsghdr, because those and their helper macros are not consistent
among the three copies of bits/socket.h, and, again, only sys/socket.h
is expected to define them.
The large number of .c files that add an `#include <sys/socket.h>`
might make this look like itâs not worth doing. However, after this
change, only half of the files in the glibc source tree that include
netinet/in.h also need to include sys/socket.h, and only a third of
the files that include netdb.h need to include sys/socket.h. Before,
all of the files in both groups were getting sys/socket.h. That seems
like enough justification to me.
While I was at it I noticed that sys/socketvar.h is yet another
backward compatibility header that does nothing but include some other
header (sys/socket.h, in this case) and also doesnât need to be
system-dependent.
This patch also partially mitigates Hurd-specific bug 23088.
* socket/bits/types/struct_linger.h
* socket/bits/types/struct_sockaddr.h
* socket/bits/types/struct_sockaddr_storage.h:
New single-type headers, factored out of the various bits/socket.h
headers.
* include/bits/types/struct_linger.h
* include/bits/types/struct_sockaddr.h
* include/bits/types/struct_sockaddr_storage.h:
New wrappers.
* socket/Makefile (headers): Add bits/types/struct_linger.h,
bits/types/struct_sockaddr.h, and bits/types/struct_sockaddr_storage.h.
Alphabetize the list.
* bits/socket.h, sysdeps/mach/hurd/bits/socket.h
* sysdeps/unix/sysv/linux/bits/socket.h:
Donât define struct sockaddr, struct sockaddr_storage,
__ss_aligntype, or struct linger here. Minimize inclusions.
* sysdeps/unix/bsd/bits/sockaddr.h: Define __ss_aligntype here.
* socket/sys/socket.h: Include bits/types/struct_linger.h,
bits/sockaddr.h, bits/types/struct_sockaddr.h, and
bits/types/struct_sockaddr_storage.h. Move inclusion of
bits/socket.h below forward declaration of struct timespec,
and update commentary.
* inet/ifaddrs.h, socket/net/if.h
* sysdeps/mach/hurd/net/if_arp.h
* sysdeps/mach/hurd/net/route.h
* sysdeps/unix/sysv/linux/errqueue.h
* sysdeps/unix/sysv/linux/net/if_arp.h
* sysdeps/unix/sysv/linux/net/route.h:
Include bits/types/struct_sockaddr.h and possibly also bits/types.h,
not sys/socket.h or sys/types.h.
* sysdeps/unix/sysv/linux/errqueue.h:
* sysdeps/unix/sysv/linux/net/route.h:
Use __uint8_t and __uint32_t instead of uint8_t and uint32_t.
* inet/arpa/inet.h: Include bits/types/size_t.h.
* inet/netinet/in.h: Include bits/sockaddr.h,
bits/types/struct_sockaddr.h, and
bits/types/struct_sockaddr_storage.h,
not sys/socket.h. Use __socklen_t instead of socklen_t.
* inet/netinet/tcp.h: Include bits/types.h and
bits/types/struct_sockaddr_storage.h, not sys/socket.h or
bits/stdint-uintn.h. Use __uint8_t, __uint16_t, and __uint32_t
instead of uint8_t, uint16_t and uint32_t.
* inet/protocols/routed.h: Include features.h and
bits/types/struct_sockaddr.h, not sys/socket.h.
* resolv/netdb.h: Include bits/types/socklen_t.h.
* sysdeps/unix/sysv/linux/netatalk/at.h: Donât include sys/socket.h.
* include/ifaddrs.h: Include stddef.h for size_t.
* include/netdb.h: Use __socklen_t instead of socklen_t.
* inet/check_pf.c, inet/gethstbynm.c, inet/gethstbynm_r.c
* inet/getsourcefilter.c, inet/inet6_opt.c, inet/inet6_option.c
* inet/inet6_rth.c, inet/setsourcefilter.c, inet/test-ifaddrs.c
* inet/test-inet6_opt.c, inet/tst-inet6_rth.c
* inet/tst-inet6_scopeid_pton.c, nis/nss_nis/nis-hosts.c
* nis/nss_nisplus/nisplus-hosts.c, nscd/aicache.c, nscd/cache.c
* nscd/hstcache.c, nscd/initgrcache.c, nscd/netgroupcache.c
* nscd/nscd_gethst_r.c, nscd/servicescache.c, nss/digits_dots.c
* nss/nss_files/files-hosts.c, nss/nss_files/files-network.c
* nss/tst-nss-files-hosts-erange.c, nss/tst-nss-files-hosts-getent.c
* nss/tst-nss-files-hosts-multi.c, posix/tst-getaddrinfo3.c
* resolv/nss_dns/dns-network.c, resolv/resolv_conf.c
* resolv/tst-bug18665-tcp.c, resolv/tst-bug18665.c
* resolv/tst-inet_ntop.c, resolv/tst-inet_pton.c
* resolv/tst-resolv-ai_idn-common.c, resolv/tst-resolv-basic.c
* resolv/tst-resolv-edns.c, resolv/tst-resolv-network.c
* resolv/tst-resolv-nondecimal.c, resolv/tst-resolv-search.c
* resolv/tst-resolv-threads.c, resolv/tst-resolv-trailing.c
* sunrpc/rpc_gethostbyname.c
* support/support_format_address_family.c
* support/support_format_addrinfo.c
* support/support_format_dns_packet.c
* support/support_format_hostent.c, support/support_format_netent.c
* sysdeps/mach/hurd/if_index.c
* sysdeps/unix/sysv/linux/check_native.c: Include sys/socket.h.
* resolv/tst-resolv-binary.c: Include sys/types.h.
* sysdeps/generic/sys/socketvar.h: Move to socket/sys/socketvar.h.
* include/sys/socketvar.h: New wrapper.
* scripts/check-obsolete-constructs.py (HEADER_ALLOWED_INCLUDES):
Update.
* sysdeps/mach/hurd/i386/Makefile: Remove netdb.h, netinet/in.h,
and arpa/inet.h from the list of headers expected to fail
conformance tests.
commit efe2a5f2a9e6d000a0d3a6a503fb9bc7fbb888f2
Author: Zack Weinberg <zackw@panix.com>
Date: Sat Jun 1 19:32:01 2019 -0400
Minimize includes of unrelated public headers by networking headers.
Stop including sys/param.h, sys/types.h, stdint.h, inttypes.h,
stdio.h, and string.h from network-related headers. This is done
separately from earlier patches because the network headers are extra
messy, and are also more likely to contain quirks inherited verbatim
from 4.xBSD than the bulk of our public headers.
Rose and NetROM are based on AX.25 so it makes practical sense for
netrose/rose.h and netrom/netrom.h to continue including netax25/ax25.h.
The only copies of ip_icmp.h and udp.h in the source tree are moved
from sysdeps/gnu to inet (after which there are no longer any netinet/
headers in sysdeps/gnu).
Much as sys/un.h needs to duplicate the prototype for strlen,
netinet/icmp6.h needs to duplicate the prototype for memset. I am
open to better ideas on that front.
* resolv/resolv.h: Include bits/types.h, bits/types/FILE.h,
and bits/types/size_t.h; donât include sys/param.h, sys/types.h,
or stdio.h. Use __uint16_t and __uint32_t instead of uint16_t and
uint32_t.
* resolv/arpa/nameser.h: Include features.h, bits/types.h, and
bits/types/size_t.h; donât include sys/param.h, sys/types.h, or
stdint.h. Use __uint16_t and __uint32_t instead of uint16_t and
uint32_t.
* resolv/arpa/nameser_compat.h: Include features.h.
* sysdeps/mach/hurd/net/ethernet.h: Include bits/types.h;
donât include sys/types.h or stdint.h. Use __uint8_t and
__uint16_t instead of uint8_t and uint16_t.
* sysdeps/unix/sysv/linux/net/ethernet.h: Include features.h and
bits/types.h; donât include sys/types.h or stdint.h.
Use __uint8_t and __uint16_t instead of uint8_t and uint16_t.
* sysdeps/unix/sysv/linux/netinet/if_ether.h: Include features.h
and bits/types.h. Use __uint8_t instead of uint8_t.
* sysdeps/mach/hurd/net/if_arp.h: Donât include sys/types.h or
stdint.h. Use __uint32_t instead of uint32_t.
* sysdeps/unix/sysv/linux/net/if_arp.h: Include features.h.
Donât include sys/types.h or stdint.h. Use __uint32_t instead of
uint32_t.
* sysdeps/mach/hurd/net/route.h: Donât include sys/types.h.
* sysdeps/unix/sysv/linux/net/route.h: Donât include sys/types.h.
* sysdeps/unix/sysv/linux/net/if_ppp.h: Include features.h and
bits/types.h. Donât include sys/types.h or stdint.h. Use
__uint8_t and __uint32_t instead of uint8_t and uint32_t.
* sysdeps/unix/sysv/linux/net/if_shaper.h: Include features.h and
bits/types.h. Donât include sys/types.h or stdint.h. Use
__uint16_t and __uint32_t instead of uint16_t and uint32_t.
* sysdeps/unix/sysv/linux/netatalk/at.h: Include features.h,
bits/types.h, and sys/ioctl.h. Donât include asm/types.h or
linux/atalk.h. Copy over all user-appropriate definitions from
linux/atalk.h with adjustments for glibc context.
* grp/initgroups.c, nscd/initgrcache.c, nss/nss_db/db-XXX.c
* resolv/ns_print.c, resolv/tst-ns_name_compress.c
* resolv/tst-res_hnok.c, support/resolv_test.c:
Include stdio.h.
* nscd/initgrcache.c, nscd/netgroupcache.c
* nss/nss_compat/compat-grp.c, nss/nss_compat/compat-pwd.c
* nss/nss_compat/compat-spwd.c, resolv/ns_print.c:
Include sys/param.h for MIN and/or MAX.
* resolv/tst-resolv-res_init-skeleton.c: Include signal.h.
* inet/protocols/rwhod.h: Include features.h and bits/types.h.
Donât include sys/types.h. Use __int32_t instead of int32_t.
* inet/protocols/talkd.h: Include features.h and bits/types.h.
Donât include sys/types.h, sys/socket.h, or stdint.h. Use
__int32_t and __uint32_t instead of int32_t and uint32_t.
* inet/protocols/timed.h: Include features.h, bits/types.h,
and bits/types/struct_timeval.h. Donât include sys/types.h or
sys/time.h.
* sysdeps/unix/sysv/linux/netipx/ipx.h: Include features.h and
bits/types.h. Donât include sys/types.h or stdint.h. Use
__uint16_t and __uint32_t instead of uint16_t and uint32_t.
* sysdeps/unix/sysv/linux/netrose/rose.h: Include features.h.
Donât include sys/socket.h.
* inet/netinet/icmp6.h: Include features.h, bits/endian.h,
bits/types.h, and bits/types/size_t.h. Donât include inttypes.h,
string.h, or sys/types.h. Duplicate prototype of memset here.
Use __uintN_t instead of uintN_t types.
* inet/netinet/igmp.h: Include bits/types.h. Donât include sys/types.h.
Use __uintN_t instead of uintN_t types.
* inet/netinet/ip.h: Include bits/types.h. Donât include
bits/stdint-uintn.h. Use __uintN_t instead of uintN_t types.
* inet/netinet/ip6.h: Include features.h, bits/endian.h, and
bits/types.h. Donât include inttypes.h. Use __uintN_t instead of
uintN_t types.
* inet/netinet/ip_icmp.h: Include features.h and bits/types.h.
Donât include sys/types.h or stdint.h. Use __uintN_t instead of
uintN_t types.
* inet/netinet/udp.h: Likewise.
* sysdeps/generic/netinet/if_ether.h: Likewise.
* sysdeps/unix/sysv/linux/netinet/if_ether.h: Likewise.
* sysdeps/unix/sysv/linux/netinet/if_fddi.h: Likewise.
* sysdeps/unix/sysv/linux/netinet/if_tr.h: Likewise.
* sysdeps/gnu/netinet/ip_icmp.h: Move to inet/netinet/ip_icmp.h.
* sysdeps/gnu/netinet/udp.h: Move to inet/netinet/udp.h.
* include/netinet/ip_icmp.h, include/netinet/udp.h: New wrappers.
* sysdeps/gnu/Makefile: Remove $(subdir)==inet stanza.
* inet/Makefile (headers): Add netinet/ip_icmp.h and
netinet/udp.h. Donât use $(wildcard *.h) for arpa and protocols
headers. Sort list.
* scripts/check-obsolete-constructs.py
(HEADER_ALLOWED_INCLUDES, SYSDEP_ALLOWED_INCLUDES): Update.
commit a465d6ac43d4d6880b655661d4aaa7bd8324cf83
Author: Zack Weinberg <zackw@panix.com>
Date: Tue May 21 19:05:39 2019 -0400
Donât include sys/types.h or stdint.h from other headers.
Many headers include sys/types.h and/or stdint.h when they only need
and/or are supposed to define a small number of types from that
header. This patch changes as many of them as practical to include
only the single-type headers for the types they are actually specified
to define, and use the impl-namespace aliases for any types they need
but are not specified to define. In most cases, where a header has
historically used uintN_t types, I changed it to use __uintN_t types;
in a few cases I chose to have it continue to define the complete set
of those types (using <bits/stdint-uintn.h>).
Itâs especially troublesome for bits headers to include headers that
define unrelated public symbols, because it means whether or not
youâre getting e.g. sys/types.h when you include fcntl.h is
architecture- and/or OS-specific.
While I was at it, I moved headers out of sysdeps where possible: If
we have only a sysdeps/generic/something.h or sysdeps/gnu/something.h,
no other sysdeps variants, it is not really system-dependent and can
be moved to the directory that installs it. If we have both
sysdeps/generic/ and gnu/something.h, the generic version is never
used (since we support only GNUish systems these days) and can be
deleted, and the gnu-version can be moved to the directory that
installs it. If the only copy of a bits header is in the
top-level bits directory, it is not system-dependent.
For utmp.h and utmpx.h, I think we might be able to fold their
respective bits headers into the primary headers and make them not
system-dependent at all. The remaining variation is between
s390*-*-linux* and everything else, and it appears to me that the s390
versions of the bits headers are actually the headers that everyone
should be using. The only difference is that the s390 headers
unconditionally use 64-bit quantities for lastlog.ll_time,
utmp{,x}.ut_tv, and utmp{,x}.ut_session, whereas the generic headers
use either 64- or 32-bit quantities depending on
__WORDSIZE_TIME64_COMPAT32. I could be wrong, but I donât think it
makes sense for programs with 64-bit and 32-bit time_t to have
different ideas of the layout of a structures that are copied directly
to and from a shared file on disk. But fixing that doesnât belong in
this patch series.
The conform tests expect utmpx.h to define time_t and suseconds_t.
These are the public names for the types of the fields of struct
timeval, and utmpx.h is required to define struct timeval, so this is
a reasonable expectation even though POSIX doesn't _explicitly_ say
it's also required to define time_t and suseconds_t. utmp.h is not a
standard header but it makes sense for it to be as consistent with
utmpx.h as possible, especially in our implementation where
/var/log/utmp and /var/log/utmpx have the same format.
I thought I was going to need to change all of the arch-specific
bits/epoll.h headers as well as sys/epoll.h, but it turned out not to
be necessary. I still took the opportunity to give them all multiple
inclusion guards.
I suspect we do not need as many copies of bits/fcntl.h and bits/sem.h
as we have, but thatâs complicated enough that it deserves its own patchset.
The debugger interface headers are a mess and I only have so much
patience for them. This does the bare minimum required for
thread_db.h, sys/procfs.h, and sys/user.h, which are at least
nominally cross-platform interfaces, to avoid including sys/types.h,
sys/time.h, and/or signal.h. Exposure of sys/ucontext.h is reduced
but not eliminated. Cross-architecture consistency should be improved.
Git does not understand âremove file X and then rename file Y over the
top of itâ very well, so the diff looks bigger than it should.
This partially mitigates Hurd-specific bug 23088 and therefore some
xfail annotations can be removed.
* io/ftw.h: Don't include sys/types.h.
* misc/sys/uio.h: Don't include sys/types.h.
Include bits/types.h, bits/types/size_t.h, and bits/types/ssize_t.h.
* posix/spawn.h: Don't include sys/types.h.
Include bits/types.h, bits/types/mode_t.h, and bits/types/pid_t.h.
* rt/aio.h: Don't include sys/types.h.
Include bits/types.h, bits/pthreadtypes.h,
bits/types/size_t.h, and bits/types/ssize_t.h.
* sysdeps/pthread/semaphore.h: Don't include sys/types.h.
* sysdeps/unix/sysv/linux/bits/uio-ext.h: Use __pid_t, not pid_t.
* sysdeps/generic/netinet/in_systm.h: Rename to
inet/netinet/in_systm.h. Include bits/stdint-uintn.h,
not sys/types.h or stdint.h.
* sysdeps/generic/netinet/ip.h: Rename to
inet/netinet/ip.h. Include bits/stdint-uintn.h and
bits/endian.h, not sys/types.h.
* sysdeps/gnu/netinet/tcp.h: Rename to
inet/netinet/tcp.h. Include bits/stdint-uintn.h and
bits/endian.h, not sys/types.h or stdint.h.
* sydeps/gnu/net/if.h: Rename to socket/net/if.h.
Donât include sys/types.h.
* include/net/if.h: Include socket/net/if.h, rather than
whatever the next net/if.h on the include path is.
* include/netinet/in_systm.h, include/netinet/ip.h
* include/netinet/tcp.h: New trivial wrappers.
* sysdeps/generic/net/if.h: Delete, never used.
* sysdeps/generic/netinet/tcp.h: Delete, never used.
* bits/utmp.h: Delete file.
* sysdeps/gnu/bits/utmp.h: Move to bits/utmp.h.
Add multiple include guard.
Donât include paths.h, sys/time.h, or sys/types.h.
Donât use struct timeval.
Use __intN_t for consistency with bits/utmpx.h.
* sysdeps/unix/sysv/linux/s390/bits/utmp.h: Add multiple include guard.
Donât include paths.h, sys/time.h, sys/types.h, or bits/wordsize.h.
Donât use struct timeval.
Use __intN_t for consistency with bits/utmpx.h.
Use __time64_t unconditionally for lastlog.ll_time.
Use __int64_t unconditionally for utmp.ut_session.
Adjust indentation and blank lines to match bits/utmp.h.
* sysdeps/gnu/bits/utmpx.h: Move to bits/utmpx.h.
Add multiple include guard.
Donât include paths.h, sys/time.h, bits/types.h, or bits/wordsize.h.
Donât define _PATH_UTMPX or _PATH_WTMPX.
Donât use struct timeval.
Use pid_t for consistency with bits/utmp.h.
* sysdeps/unix/sysv/linux/s390/bits/utmpx.h: Add multiple include guard.
Donât define _PATH_UTMPX or _PATH_WTMPX.
Donât include paths.h, sys/time.h, bits/types.h, or bits/wordsize.h.
Donât define _PATH_UTMPX or _PATH_WTMPX.
Donât use struct timeval.
Use pid_t for consistency with bits/utmp.h.
Use __int64_t unconditionally for utmpx.ut_session.
* login/utmp.h: Donât include sys/types.h.
Do include paths.h, bits/types.h, bits/types/pid_t.h,
bits/types/suseconds_t, bits/types/time_t.h, and
bits/types/struct_timeval.h.
Move __BEGIN_DECLS to enclose only prototypes.
* sysdeps/gnu/utmpx.h: Move to login/utmpx.h.
Donât include sys/time.h. Do include bits/types.h,
bits/types/suseconds_t, bits/types/time_t.h, and
bits/types/struct_timeval.h.
When __USE_GNU, include paths.h and define _PATH_UTMPX and _PATH_WTMPX.
* login/Makefile (headers): Add utmpx.h and bits/utmpx.h.
(routines): Add endutxent, getutmp, getutmpx, getutxent,
getutxid, getutxline, pututxline, setutxent, updwtmpx, and
utmpxname. Reorganize.
* sysdeps/gnu/Makefile: Do not add anything to sysdep_routines
or sysdep_headers when subdir == login.
* sysdeps/gnu/sys/mtio.h: Move to misc/sys/mtio.h.
Don't include sys/types.h.
* sysdeps/gnu/Makefile: Don't add anything to sysdep_headers
for the misc directory.
* misc/Makefile (headers): Add sys/mtio.h.
* include/sys/mtio.h: New wrapper.
* elf/link.h, inet/aliases.h, misc/sys/xattr.h:
Don't include sys/types.h. Include bits/types/size_t.h.
* gmon/sys/gmon.h: Don't include sys/types.h.
* gmon/sys/profil.h: Don't include sys/types.h.
Include bits/types/size_t.h and bits/types/struct_timeval.h.
* io/fts.h: Don't include sys/types.h.
Include bits/types/dev_t.h, bits/types/ino_t.h, bits/types/ino64_t.h,
and bits/types/nlink_t.h.
* io/sys/sendfile.h: Don't include sys/types.h.
Include bits/types.h, bits/types/off_t.h, bits/types/size_t.h,
and bits/types/ssize_t.h.
* stdlib/sys/random.h: Don't include sys/types.h.
Include bits/types/size_t.h and bits/types/ssize_t.h.
* gmon/tst-sprofil.h: Include sys/time.h.
* sysdeps/mach/hurd/sendfile.c: Include sys/types.h.
* sysdeps/unix/sysv/linux/sys/epoll.h: Donât include stdint.h
or sys/types.h. Do include features.h and bits/types.h.
(union epoll_data, struct epoll_event): Use __uint32_t and
__uint64_t for field types.
* sysdeps/unix/sysv/linux/alpha/bits/epoll.h
* sysdeps/unix/sysv/linux/bits/epoll.h
* sysdeps/unix/sysv/linux/hppa/bits/epoll.h
* sysdeps/unix/sysv/linux/mips/bits/epoll.h
* sysdeps/unix/sysv/linux/sparc/bits/epoll.h
* sysdeps/unix/sysv/linux/x86/bits/epoll.h:
Add multiple inclusion guard.
* sysdeps/unix/sysv/linux/alpha/sys/acct.h: Style fix.
* sysdeps/unix/sysv/linux/sys/acct.h: Include features.h
and bits/stdint-uintn.h. Don't include sys/types.h, stdint.h,
or bits/types/time_t.h.
* sysdeps/unix/sysv/linux/sys/fsuid.h
* sysdeps/unix/sysv/linux/sys/quota.h
Include bits/types.h, not sys/types.h.
* sysdeps/nptl/sys/procfs.h: Include features.h and bits/types.h,
not sys/types.h.
* sysdeps/nptl/thread_db.h: Donât include sys/types.h.
* sysdeps/nptl/proc_service.h: Include bits/types/pid_t.h and
bits/types/size_t.h.
* sysdeps/unix/sysv/linux/sys/procfs.h: Include bits/types.h and
bits/types/struct_timeval.h, not sys/time.h or sys/types.h.
* sysdeps/unix/sysv/linux/aarch64/bits/procfs.h: Add multiple
inclusion guard. Include bits/types.h. Correct a comment.
* sysdeps/unix/sysv/linux/alpha/bits/procfs-prregset.h:
Add multiple inclusion guard. Include sys/ucontext.h.
* sysdeps/unix/sysv/linux/alpha/bits/procfs.h
* sysdeps/unix/sysv/linux/sparc/bits/procfs.h
Add multiple inclusion guard. Donât include signal.h or sys/ucontext.h.
* sysdeps/unix/sysv/linux/ia64/bits/procfs.h:
Add multiple inclusion guard. Include sys/ucontext.h, not signal.h.
* sysdeps/unix/sysv/linux/powerpc/bits/procfs.h:
Add multiple inclusion guard. Donât include signal.h or
sys/ucontext.h. Include bits/wordsize.h and asm/elf.h.
Adjust conditional for whether to provide various fallback
definitions.
* sysdeps/unix/sysv/linux/arm/bits/procfs.h
* sysdeps/unix/sysv/linux/csky/bits/procfs.h
* sysdeps/unix/sysv/linux/hppa/bits/procfs.h
* sysdeps/unix/sysv/linux/m68k/bits/procfs.h
* sysdeps/unix/sysv/linux/microblaze/bits/procfs.h
* sysdeps/unix/sysv/linux/mips/bits/procfs.h
* sysdeps/unix/sysv/linux/nios2/bits/procfs.h
* sysdeps/unix/sysv/linux/riscv/bits/procfs.h
* sysdeps/unix/sysv/linux/s390/bits/procfs.h
* sysdeps/unix/sysv/linux/sh/bits/procfs.h
* sysdeps/unix/sysv/linux/x86/bits/procfs.h:
Add multiple inclusion guard. Improve commentary.
* sysdeps/posix/dl-fileid.h (r_file_id): Use __dev_t and __ino64_t
for field types.
* nss/nss.h
* sysdeps/powerpc/sys/platform/ppc.h
* sysdeps/unix/sysv/linux/sys/eventfd.h
* sysdeps/unix/sysv/linux/sys/fanotify.h
* sysdeps/unix/sysv/linux/sys/inotify.h
* sysdeps/unix/sysv/linux/sys/raw.h
* sysdeps/unix/sysv/linux/sys/signalfd.h:
Include bits/types.h, not stdint.h.
Include features.h where not already doing so.
Use __(u)intN_t types instead of (u)intN_t types in all
declarations.
* sysdeps/unix/sysv/linux/powerpc/bits/powerpc.h:
Use __uint64_t instead of uint64_t.
* nss/tst-nss-test4.c: Include stdint.h.
* bits/fcntl.h: Add multiple include guard. Hoist inclusion of
bits/types.h to top of file.
* sysdeps/mach/hurd/bits/fcntl.h: Add multiple include guard.
Include bits/types.h, not sys/types.h; remove redundant inclusion
of bits/types.h in middle of file.
* bits/sem.h: Add multiple include guard. Include bits/types.h,
not sys/types.h.
* sysdeps/gnu/bits/sem.h: Likewise.
* sysdeps/unix/sysv/linux/bits/sem.h: Likewise.
* sysdeps/unix/sysv/linux/ia64/bits/ipc.h: Likewise.
* sysvipc/sys/sem.h: Include bits/types/pid_t.h and
bits/types/time_t.h.
* resolv/bits/types/res_state.h: Include bits/types.h, not
sys/types.h. Use __uint32_t and __uint16_t, not uint32_t and
uint16_t.
* sysdeps/mach/hurd/bits/socket.h: Include bits/types.h, not
sys/types.h.
* sysdeps/unix/sysv/linux/bits/socket.h: Likewise. Use __pid_t,
__uid_t, and __gid_t, not pid_t, uid_t, and gid_t.
* socket/sys/socket.h: Include bits/types.h, bits/types/ssize_t.h,
and bits/types/socklen_t.h.
* inet/htonl.c, include/htons.c: Include endian.h.
* include/netinet/ether.h: Include bits/types/size_t.h.
* scripts/check-obsolete-constructs.py
(HEADER_ALLOWED_INCLUDES, SYSDEP_ALLOWED_INCLUDES): Update.
* sysdeps/mach/hurd/i386/Makefile: Remove test-xfail-*/*/conform
for semaphore.h, ftw.h, and sys/uio.h.
commit 2cd8dcd151a41eae0ab5bf81a7eb93eea3302b29
Author: Zack Weinberg <zackw@panix.com>
Date: Fri May 31 10:30:38 2019 -0400
Donât include sys/time.h from sys/timex.h.
The interfaces defined in sys/timex.h only need struct timeval, not
any of the other things defined in sys/time.h.
While I was at it I moved stuff around so that sysdeps/â¦/linux/bits/timex.h
defines everything that uapi linux/timex.h defines (as of version 5.0;
alas, we still cannot use linux/timex.h directly) plus the
MOD_CLKA and MOD_CLKB constants. In particular, the TIME_* constants
are relevant to users of clock_adjtime as well as adjtimex (I presumeâ
clock_adjtime is not very well documented) so they should be visible
from time.h as well as sys/timex.h. Conversely, as far as I can tell,
struct ntptimeval was never a kernel interface on Linux, and MAXTC is
not part of the exposed API and also has the wrong value for current
kernels. Also I removed a thoroughly obsolete bug workaround from
ntp_gettime.c and ntp_gettimex.c.
* sysdeps/unix/sysv/linux/sys/timex.h: Donât include sys/time.h.
Update commentary. Donât define MAXTC. Move definition of
NTP_API and the TIME_* constants...
* sysdeps/unix/sysv/linux/bits/timex.h: ...here.
Allow inclusion only by sys/timex.h and bits/time.h.
Update commentary.
* sysdeps/unix/sysv/linux/ntp_gettime.c
* sysdeps/unix/sysv/linux/ntp_gettimex.c: Remove obsolete
check for MOD_OFFSET not being defined.
* scripts/check-obsolete-constructs.py (HEADER_ALLOWED_INCLUDES):
Update.
commit fd0a2720650fa560321a7277500b316aec2df503
Author: Zack Weinberg <zackw@panix.com>
Date: Wed May 22 12:03:57 2019 -0400
Donât include string.h from sys/un.h.
sys/un.h needs strlen in order to define SUN_LEN, but does not need
any of the other things declared by string.h; the path of least
resistance is to prototype strlen locally.
Also, the construct being used to get the size of everything up to the
sun_path member contains a formal dereference of a null pointer and
therefore has undefined behavior. Replace with __SOCKADDR_COMMON_SIZE.
Some old RPC code was relying on sys/un.h to provide all of string.h.
* sys/un.h [__USE_MISC]: Donât include string.h.
Include bits/types/size_t.h. Prototype strlen locally.
Use __SOCKADDR_COMMON_SIZE for size of leading members of
struct sockaddr_un.
* nis/nis_domain_of.c, nis/yp_xdr.c, sunrpc/svc.c:
Include string.h.
* scripts/check-obsolete-constructs.py (HEADER_ALLOWED_INCLUDES):
Update.
commit b761b9106d2e7b70596c857cd0193b000c8c1389
Author: Zack Weinberg <zackw@panix.com>
Date: Mon Jun 10 11:34:41 2019 -0400
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.
* 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.
commit b42393774860855b596c0cb0b41639c11963e2c9
Author: Zack Weinberg <zackw@panix.com>
Date: Sat Mar 16 12:35:25 2019 -0400
Donât include sys/select.h from sys/types.h.
This is supposedly present for BSD compatibility, but the current
generation of BSDs is not consistent about it: FreeBSD does, OpenBSD
doesnât, NetBSD exposes only fd_set and the FD_* macros. Programs
that need to wait for any of multiple I/O events have several
alternatives to select nowadays, so I think it makes sense to expose
select only to programs that specifically want it.
Only a few places within our own code are affected. A few test
programs need to include sys/select.h explicitly, as does rpc/svc.h.
sysdeps/nptl/thread_db.h needs to declare sigset_t, and
sysdeps/unix/sysv/linux/pselect.c was including sys/poll.h instead of
sys/select.h, which is probably a copy-and-paste error. sys/socket.h
needs to forward-declare struct timespec under __USE_GNU, because
recvmmsg has a struct timespec * argument; Iâm open to the possibility
of having it fully declare struct timespec.
I considered taking sys/select.h out of sys/time.h as well, but POSIX
not only explicitly allows this inclusion, it requires sys/time.h to
declare almost everything that sys/select.h declares. It doesnât seem
worth creating another bits header just to prevent sys/time.h from
declaring pselect, sigset_t, and struct timespec.
Not including sys/select.h from sys/types.h means that sys/types.h
also no longer defines anything from sys/time.h, and a couple of files
were relying on that. (pthread_join_common.c should be using
clock_gettime instead of gettimeofday, but that's out of scope for
this patch series.)
* posix/sys/types.h: Donât include sys/select.h.
* scripts/check-obsolete-constructs.py: Remove whitelist entry
for sys/types.h -> sys/select.h. Adjust commentary re
sys/time.h -> sys/select.h.
* socket/sys/socket.h: When __USE_GNU, forward-declare struct timespec.
* misc/tst-fdset.c, nptl/tst-cancel4.c, scripts/check-c++-types.sh
* sunrpc/rpc/svc.h: Include sys/select.h.
* sysdeps/nptl/thread_db.h: Include bits/types/sigset_t.h.
* sysdeps/unix/sysv/linux/pselect.c: Include sys/select.h,
not sys/poll.h.
* nptl/pthread_join_common.c, sysdeps/unix/sysv/linux/dl-vdso.h:
Include sys/time.h.
commit f6480a080eb82cef6d79ddf1096c4b25b4320ff5
Author: Zack Weinberg <zackw@panix.com>
Date: Sat Mar 16 21:01:12 2019 -0400
Limit the set of strings.h functions also exposed in string.h.
As someone who can remember when you might not be able to include both
string.h and strings.h at the same time, it annoys me that strings.h
still exists and is the only standard source for str(n)casecmp(_l) and
ffs. I think itâs right that we expose those functions from string.h.
However, thereâs no reason we need to keep exposing the other obsolete
functions that strings.h declares from string.h.
This patch creates <bits/strings_x2k8.h>, which declares the
non-obsolete functions whose official home is strings.h. strings.h
includes it unconditionally, and string.h includes it under
__USE_MISC, instead of strings.h.
Two tests of the obsolete strings.h functions had to be adjusted.
* string/strings.h (strcasecmp, strncasecmp, strcasecmp_l)
(strncasecmp_l, ffs, ffsl, ffsll): Move declarations to...
* string/bits/strings_x2k8.h: ... this new file.
* string/Makefile: Install bits/strings_x2k8.h.
* include/bits/strings_x2k8h: New wrapper.
* string/string.h: Include bits/strings_x2k8.h instead of
strings.h.
* debug/tst-chk1.c, string/test-string.h: Include strings.h.
* scripts/check-obsolete-constructs.py: string.h is no longer
expected to include strings.h.
* sysdeps/i386/i686/multiarch/bcopy.c
* sysdeps/i386/i686/multiarch/bzero.c
* sysdeps/i386/i686/multiarch/ifunc-impl-list.c
* sysdeps/powerpc/powerpc32/power4/multiarch/ifunc-impl-list.c
* sysdeps/powerpc/powerpc64/multiarch/bcopy-ppc64.c
* sysdeps/powerpc/powerpc64/multiarch/bcopy.c
* sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c
* sysdeps/s390/bzero.c
* sysdeps/s390/multiarch/ifunc-impl-list.c
* sysdeps/sparc/sparc64/multiarch/bzero.c
* sysdeps/sparc/sparc64/multiarch/ifunc-impl-list.c:
Include strings.h.
commit 3f4e35edb9dbcfd73081f979010f4d7478e6ca57
Author: Zack Weinberg <zackw@panix.com>
Date: Wed May 29 14:23:32 2019 -0400
Donât rely on stddef.h or stdarg.h for individual type definitions.
In the course of developing earlier patches in this series I
discovered that clangâs stddef.h does not implement the __need_*
convention correctly: in C++, under some circumstances __need_NULL
will also cause a definition of nullptr_t, and when the âmodulesâ
feature is enabled, all of the __need macros are ignored and all of
stddef.h is exposed. (Iâm not sure how to actually make either of
these things happen, I discovered the problem by reading the file.)
Worse, clangâs stdarg.h does not implement __need___va_list *at all*;
including its stdarg.h will always expose all of its definitions.
These are bugs in clang but it seems prudent to work around them, and
the simplest way to do so is to have the bits/types/ headers
introduced in the previous patch make definitions themselves, when
possible. For size_t, ptrdiff_t, and wchar_t, we can use the
predefined macros __SIZE_TYPE__, __PTRDIFF_TYPE__, and __WCHAR_TYPE__,
when available, falling back to the old approach. For __gnuc_va_list,
we have a whitelist of compilers known to provide __builtin_va_list,
falling back to the old approach. NULL and va_list are defined
ab initio.
An additional complication is that we must be able to tell stddef.h
and stdarg.h _not_ to define again things we have already defined. It
appears to me, based on inspection of clang, GCC, and icc stddef.h and
stdarg.h, that we can use the macros _SIZE_T, _PTRDIFF_T, _WCHAR_T,
_VA_LIST, and __GNUC_VA_LIST to accomplish this.
Since we are no longer relying on stdarg.h to define an
implementation-namespace alias for us, I thought it would make sense
also to stop calling it __gnuc_va_list. The bulk of this patch is
a mechanical substitution of __va_list for __gnuc_va_list throughout
our headers.
Copyright boilerplate is added to stdlib/bits/NULL.h and stdlib/bits/types/*.h
because they now contain enough commentary and code that they could
plausibly be copyrightable.
* stdlib/bits/NULL.h: Do not use stddef.h to define NULL.
Define NULL ab initio if not already defined, as `((void *)0)` for C,
and either `__null` or 0 for C++, depending on compiler support.
* stdlib/bits/types/__va_list.h: If __builtin_va_list is known to
be available, use it to define __va_list without including
stdarg.h. Otherwise use __need___va_list to request a definition
of __gnuc_va_list and nothing else from stdarg.h, then use that to
define __va_list.
* stdlib/bits/types/va_list.h: Use __va_list, not __gnuc_va_list,
to define va_list. Improve commentary.
* stdlib/bits/types/ptrdiff_t.h: If __PTRDIFF_TYPE__ is defined,
use it to define ptrdiff_t without including stddef.h. Otherwise
use __need_ptrdiff_t to request a definition of ptrdiff_t and
nothing else from stddef.h. Use _PTRDIFF_T as guard macro to
match behavior of common stddef.h implementations.
* stdlib/bits/types/size_t.h: Similarly for size_t, with
__SIZE_TYPE__, __need_size_t, and _SIZE_T.
* stdlib/bits/types/wchar_t.h: Similarly for wchar_t, with
__WCHAR_TYPE__, __need_wchar_t, and _WCHAR_T. If __cplusplus
is defined, do nothing; wchar_t is built-in in C++.
* conform/data/stdio.h-data, conform/data/wchar.h-data
* include/err.h, include/stdio.h, include/syslog.h, include/wchar.h
* libio/bits/stdio.h, libio/bits/stdio2.h, libio/iolibio.h
* libio/libio.h, libio/stdio.h, libio/vwprintf.c, misc/bits/syslog.h
* misc/err.c, misc/err.h, misc/syslog.h, stdio-common/printf.h
* sysdeps/ieee754/ldbl-opt/nldbl-compat.c
* sysdeps/ieee754/ldbl-opt/nldbl-compat.h
* wcsmbs/bits/wchar2.h, wcsmbs/wchar.h:
Replace all uses of __gnuc_va_list with __va_list.
* scripts/check-obsolete-constructs.py (HEADER_ALLOWED_INCLUDES):
bits/NULL.h is no longer allowed to include stddef.h.
commit b571a66a02da60d133b61fb3adae3054342faa2c
Author: Zack Weinberg <zackw@panix.com>
Date: Tue May 28 13:59:08 2019 -0400
Add bits/types/ wrappers for stddef.h and stdarg.h types.
We rely on the compiler's stddef.h and stdarg.h to define size_t,
ptrdiff_t, wchar_t, NULL, and __gnuc_va_list, and to implement a
convention that allows us to request the definition of a specific one:
for instance
#define __need_size_t
#include <stddef.h>
is expected to define size_t but not any of the other things stddef.h
defines.
This patch hides that convention behind a set of bits/types/ headers,
which allows check-obsolete-constructs.py to verify that none of our
headers include these headers unconditionally. (Both of them define
at least one item in the user namespace that no other header is
supposed to expose.) It will also facilitate coping with compilers
that donât implement the __need convention. (That scenario is not
hypothetical, see the next patch.)
Only public headers use the new bits headers. Non-public headers and
.c files in our codebase, that were formerly defining __need macros,
now just include stddef.h and/or stdarg.h without any __need macros.
A few files didnât need to be including stddef.h / stdarg.h at all.
Uses of NULL in public headers that arenât expected to define NULL
are changed to a bare 0. bits/NULL.h is only used by headers that
are expected to define NULL.
malloc.h and printf.h were, in fact, including stddef.h and/or
stdarg.h unconditionally; they no longer do that. This broke a few of
our test cases, which are fixed by adding appropriate inclusions to
the relevant .c files.
* stdlib/bits/NULL.h
* stdlib/bits/types/__va_list.h
* stdlib/bits/types/ptrdiff_t.h
* stdlib/bits/types/size_t.h
* stdlib/bits/types/va_list.h
* stdlib/bits/types/wchar_t.h:
New headers defining a single type or macro each.
* stdlib/Makefile: Install new headers.
* include/bits/NULL.h
* include/bits/types/__va_list.h
* include/bits/types/ptrdiff_t.h
* include/bits/types/size_t.h
* include/bits/types/va_list.h
* include/bits/types/wchar_t.h:
New wrapper headers.
* malloc/malloc.h: Donât include stdio.h or stddef.h.
Include bits/NULL.h, bits/types/size_t.h, bits/types/ptrdiff_t.h,
and bits/types/FILE.h.
* stdio-common/printf.h: Donât include stddef.h or stdarg.h.
Include bits/types/size_t.h, bits/types/wchar_t.h, and
bits/types/__va_list.h. Use __gnuc_va_list instead of va_list
in prototypes.
* libio/bits/types/struct_FILE.h: Include bits/types/size_t.h.
* misc/sys/param.h: Include features.h.
* sysvipc/sys/msg.h: Include bits/msq.h after all bits/types/ headers.
* sysvipc/sys/sem.h: Include bits/sem.h after all bits/types/ headers.
* sysvipc/sys/shm.h: Include bits/shm.h after all bits/types/ headers.
* hurd/hurd/signal.h: Donât use NULL.
* hurd/hurd/ioctl.h: Donât include stdarg.h.
* hurd/hurd/userlink.h: Donât include stddef.h. Donât use NULL.
* intl/libintl.h: Donât include stddef.h. Donât use NULL.
* intl/gettext.c, intl/ngettext.c: Include stddef.h
unconditionally. Donât define any __need macros first.
Donât include stdlib.h.
* sysdeps/posix/sigignore.c:, sysdeps/posix/sigset.c:
Donât include errno.h or string.h.
* malloc/tst-malloc-thread-fail.c: Include stddef.h.
* malloc/tst-malloc_info.c: Include stdio.h.
* stdio-common/tst-vfprintf-user-type.c: Include stdarg.h.
* string/tst-cmp.c: Include stdio.h.
* debug/wcpcpy_chk.c, iconv/loop.c, iconv/skeleton.c
* signal/sighold.c, signal/sigrelse.c, stdio-common/tempname.c
* sysdeps/generic/ldsodefs.h, sysdeps/nptl/libc-lock.h
* sysdeps/nptl/libc-lockP.h, sysdeps/posix/waitid.c
* wcsmbs/wcstol_l.c, wcsmbs/wcstoll_l.c, wcsmbs/wcstoul_l.c
* wcsmbs/wcstoull_l.c, sysdeps/posix/sigignore.c
* sysdeps/posix/sigset.c: Donât define __need macros before
including stddef.h.
* bits/socket.h, bits/types/stack_t.h, dirent/dirent.h
* dlfcn/dlfcn.h, gmon/sys/profil.h, grp/grp.h, gshadow/gshadow.h
* hurd/hurd/signal.h, hurd/hurd/sigpreempt.h, iconv/gconv.h
* include/set-hooks.h, include/stdio.h, inet/aliases.h
* io/sys/sendfile.h, libio/stdio.h, misc/bits/types/struct_iovec.h
* misc/search.h, misc/sys/mman.h, misc/syslog.h, posix/glob.h
* posix/sched.h, posix/sys/types.h, posix/unistd.h
* posix/wordexp.h, pwd/pwd.h, shadow/shadow.h, signal/signal.h
* socket/sys/socket.h, stdlib/alloca.h, stdlib/monetary.h
* stdlib/stdlib.h, stdlib/sys/random.h, string/string.h
* string/strings.h, sunrpc/rpc/netdb.h
* sysdeps/htl/bits/types/struct___pthread_attr.h
* sysdeps/mach/hurd/bits/socket.h
* sysdeps/unix/sysv/linux/bits/socket.h
* sysdeps/unix/sysv/linux/bits/types/stack_t.h
* sysdeps/unix/sysv/linux/ia64/bits/sigcontext.h
* sysdeps/unix/sysv/linux/mips/bits/types/stack_t.h
* sysdeps/unix/sysv/linux/scsi/sg.h
* sysdeps/unix/sysv/linux/sys/sysctl.h
* sysvipc/sys/msg.h, sysvipc/sys/sem.h, sysvipc/sys/shm.h
* time/time.h, wcsmbs/uchar.h, wcsmbs/wchar.h:
Use bits/types/size_t.h instead of __need_size_t.
* iconv/gconv.h, iconv/iconv.h, libio/libio.h
* stdlib/inttypes.h, stdlib/stdlib.h, wcsmbs/wchar.h:
Use bits/types/wchar_t.h instead of __need_wchar_t.
* libio/stdio.h, locale/locale.h, misc/sys/param.h
* posix/sched.h, posix/unistd.h, stdlib/stdlib.h
* string/string.h, sysdeps/unix/sysv/linux/bits/sigcontext.h
* time/time.h, wcsmbs/wchar.h: Use bits/NULL.h instead of __need_NULL.
* libio/stdio.h, misc/err.h: Use bits/types/__va_list.h instead
of __need___va_list.
* libio/stdio.h: Use bits/types/va_list.h instead of manually
defining va_list.
* hurd/hurd/userlink.h, misc/sys/mman.h, posix/sched.h
* sysdeps/mach/hurd/bits/socket.h
* sysdeps/unix/sysv/linux/ia64/bits/sigcontext.h
* wcsmbs/wchar.h: Reorganize includes; no semantic effect.
* stdlib/stdlib.h: Normalize format of multiple include guard.
* sysdeps/unix/sysv/linux/bits/sigcontext.h: Annotate workarounds
for kernel header bugs.
* sysdeps/unix/sysv/linux/aarch64/sys/user.h
* sysdeps/unix/sysv/linux/arm/sys/user.h
* sysdeps/unix/sysv/linux/m68k/sys/user.h
* sysdeps/unix/sysv/linux/microblaze/sys/user.h
* sysdeps/unix/sysv/linux/nios2/sys/user.h
* sysdeps/unix/sysv/linux/s390/sys/user.h
* sysdeps/unix/sysv/linux/x86/sys/user.h
Include features.h.
* sysdeps/unix/sysv/linux/alpha/sys/user.h
* sysdeps/unix/sysv/linux/ia64/sys/user.h
* sysdeps/unix/sysv/linux/mips/sys/user.h
* sysdeps/unix/sysv/linux/powerpc/sys/user.h
* sysdeps/unix/sysv/linux/sh/sys/user.h
* sysdeps/unix/sysv/linux/sparc/sys/user.h
Include features.h and bits/types/size_t.h, in that order.
Include kernel headers, if any, after those two.
Donât include stddef.h or sys/types.h.
* scripts/check-obsolete-constructs.py
(UNIVERSAL_ALLOWED_INCLUDES): Remove stddef.h and stdarg.h.
(HEADER_ALLOWED_INCLUDES): Update.
commit 367ac2b3ee1ef21ac24215eeae4d9c9936c087f4
Author: Zack Weinberg <zackw@panix.com>
Date: Fri Mar 15 09:02:24 2019 -0400
Split up endian.h to minimize exposure of BYTE_ORDER.
With only two exceptions (sys/types.h and sys/param.h, both of which
historically might have defined BYTE_ORDER) the public headers that
include <endian.h> only want to be able to test __BYTE_ORDER against
__*_ENDIAN.
This patch creates a new bits/endian.h that can be included by any
header that wants to be able to test __BYTE_ORDER and/or
__FLOAT_WORD_ORDER against the __*_ENDIAN constants, or needs
__LONG_LONG_PAIR. It only defines macros in the implementation
namespace.
The existing bits/endian.h (which could not be included independently
of endian.h, and only defines __BYTE_ORDER and maybe __FLOAT_WORD_ORDER)
is renamed to bits/endianness.h. I also took the opportunity to
canonicalize the form of this header, which we are stuck with having
one copy of per architecture. Since they are so short, this means git
doesnât understand that they were renamed from existing headers, sigh.
endian.h itself is a nonstandard header and its only remaining use
from a standard header is guarded by __USE_MISC, so I dropped the
__USE_MISC conditionals from around all of the public-namespace things
it defines. (This means, an application that requests strict library
conformance but includes endian.h will still see the definition of
BYTE_ORDER.)
A few changes to specific bits/endian(ness).h variants deserve
mention:
- sysdeps/unix/sysv/linux/ia64/bits/endian.h is moved to
sysdeps/ia64/bits/endianness.h. If I remember correctly, ia64 did
have selectable endianness, but we have assembly code in
sysdeps/ia64 that assumes itâs little-endian, so there is no reason
to treat the ia64 endianness.h as linux-specific.
- The C-SKY port does not fully support big-endian mode, but I do
not think this is sufficient reason to make csky/bits/endian(ness).h
error out if __CSKYBE__ is defined, so it now defines __BYTE_ORDER
appropriately for whichever mode the compiler is in.
- The PowerPC port had extra logic in its bits/endian.h to detect a
broken compiler, which strikes me as unnecessary, so I removed it.
- The only files that defined __FLOAT_WORD_ORDER always defined it to
the same value as __BYTE_ORDER, so I removed those definitions.
The SH bits/endian(ness).h had comments inconsistent with the
actual setting of __FLOAT_WORD_ORDER, which I also removed.
- I *removed* copyright boilerplate from the few bits/endian(ness).h
headers that had it; these files record a single fact in a fashion
dictated by an external spec, so I do not think they are copyrightable.
As long as I was changing every copy of ieee754.h in the tree, I
noticed that only the MIPS variant includes float.h, because it uses
LDBL_MANT_DIG to decide among three different versions of
ieee854_long_double. This patch makes it not include float.h when
GCCâs intrinsic __LDBL_MANT_DIG__ is available.
* string/endian.h: Unconditionally define LITTLE_ENDIAN,
BIG_ENDIAN, PDP_ENDIAN, and BYTE_ORDER. Condition byteswapping
macros only on !__ASSEMBLER__. Move the definitions of
__BIG_ENDIAN, __LITTLE_ENDIAN, __PDP_ENDIAN, __FLOAT_WORD_ORDER,
and __LONG_LONG_PAIR to...
* string/bits/endian.h: ...this new file, which includes
the renamed header bits/endianness.h for the definition of
__BYTE_ORDER and possibly __FLOAT_WORD_ORDER.
* string/Makefile: Install bits/endianness.h.
* include/bits/endian.h: New wrapper.
* bits/endian.h: Rename to bits/endianness.h.
Add multiple-include guard. Rewrite the comment explaining what
the machine-specific variants of this file should do.
* sysdeps/unix/sysv/linux/ia64/bits/endian.h:
Move to sysdeps/ia64.
* sysdeps/aarch64/bits/endian.h
* sysdeps/alpha/bits/endian.h
* sysdeps/arm/bits/endian.h
* sysdeps/csky/bits/endian.h
* sysdeps/hppa/bits/endian.h
* sysdeps/ia64/bits/endian.h
* sysdeps/m68k/bits/endian.h
* sysdeps/microblaze/bits/endian.h
* sysdeps/mips/bits/endian.h
* sysdeps/nios2/bits/endian.h
* sysdeps/powerpc/bits/endian.h
* sysdeps/riscv/bits/endian.h
* sysdeps/s390/bits/endian.h
* sysdeps/sh/bits/endian.h
* sysdeps/sparc/bits/endian.h
* sysdeps/x86/bits/endian.h:
Rename to endianness.h; canonicalize form of file; remove
redundant definitions of __FLOAT_WORD_ORDER.
* sysdeps/csky/bits/endianness.h: Do not error out if __CSKYEB__
is defined.
* sysdeps/powerpc/bits/endianness.h: Remove logic to check for
broken compilers.
* ctype/ctype.h
* inet/netinet/in.h
* resolv/arpa/nameser_compat.h
* sysdeps/aarch64/nptl/bits/pthreadtypes-arch.h
* sysdeps/arm/nptl/bits/pthreadtypes-arch.h
* sysdeps/csky/nptl/bits/pthreadtypes-arch.h
* sysdeps/ia64/ieee754.h
* sysdeps/ieee754/ieee754.h
* sysdeps/ieee754/ldbl-128/ieee754.h
* sysdeps/ieee754/ldbl-128ibm/ieee754.h
* sysdeps/m68k/nptl/bits/pthreadtypes-arch.h
* sysdeps/microblaze/nptl/bits/pthreadtypes-arch.h
* sysdeps/mips/ieee754/ieee754.h
* sysdeps/mips/nptl/bits/pthreadtypes-arch.h
* sysdeps/nios2/nptl/bits/pthreadtypes-arch.h
* sysdeps/nptl/pthread.h
* sysdeps/riscv/nptl/bits/pthreadtypes-arch.h
* sysdeps/sh/nptl/bits/pthreadtypes-arch.h
* sysdeps/sparc/sparc32/ieee754.h
* sysdeps/unix/sysv/linux/generic/bits/stat.h
* sysdeps/unix/sysv/linux/generic/bits/statfs.h
* sysdeps/unix/sysv/linux/sys/acct.h
* wctype/bits/wctype-wchar.h:
Include bits/endian.h, not endian.h.
* sysdeps/unix/sysv/linux/hppa/pthread.h: Donât include endian.h.
* sysdeps/mips/ieee754/ieee754.h: Use __LDBL_MANT_DIG__
in ifdefs, instead of LDBL_MANT_DIG. Only include float.h
when __LDBL_MANT_DIG__ is not predefined, in which case
define __LDBL_MANT_DIG__ to equal LDBL_MANT_DIG.
* scripts/check-obsolete-constructs.h: Remove most of the
whitelist entries for endian.h and float.h.
commit c93470c99bb2eb032d4892d8de2d388b9d632d62
Author: Zack Weinberg <zackw@panix.com>
Date: Tue Jun 18 11:47:49 2019 -0400
Donât include sys/cdefs.h directly from public headers.
The convention throughout glibc is that every public header includes
features.h directly, as its first action, and relies on features.h to
include sys/cdefs.h. In a few places, though, itâs been done the
other way around, usually in headers that were copied from a BSD
source (where the convention is exactly the opposite). This patch
makes all installed headers match the glibc convention.
This patch also corrects a bug in glob.h: it may declare size_t
without notifying stddef.h that it has done this, so e.g.
#define _XOPEN_SOURCE 700
#include <glob.h>
#include <stddef.h>
int dummy;
declares size_t twice, which is invalid prior to C2011. I wasnât able
to persuade gcc 8 to issue an error, even with -std=c89 -Wsystem-headers,
but clang is not so lenient.
* posix/glob.h: Include features.h, not sys/cdefs.h.
When __USE_XOPEN || USE_XOPEN2K8, include stddef.h for size_t;
otherwise, issue an immediate #error if __SIZE_TYPE__ is not
available. Use __gsize_t, not __size_t, as an impl-namespace
alternative name for size_t.
* conform/data/glob.h-data: Adjust to match.
* inet/netinet/igmp.h, mach/lock-intern.h, misc/ar.h
* misc/sys/auxv.h, resolv/resolv.h, socket/sys/un.h
* sunrpc/rpc/auth_des.h, sunrpc/rpc/rpc_msg.h
* sysdeps/generic/memcopy.h, sysdeps/generic/netinet/tcp.h
* sysdeps/htl/pthread.h, sysdeps/mach/hurd/net/ethernet.h
* sysdeps/mach/hurd/net/if_arp.h: Include features.h, not sys/cdefs.h.
* scripts/check-obsolete-constructs.py (HEADER_ALLOWED_INCLUDES):
Update.
commit bb486ef65f40d6291da40380695a86a597956d8b
Author: Zack Weinberg <zackw@panix.com>
Date: Sun Mar 17 09:50:36 2019 -0400
Swap sys/poll.h with poll.h.
Similarly to (sys/)syslog.h, poll.h is the header standardized by
POSIX, but we had all of its contents in sys/, for historical reasons.
This patch exchanges the contents of the two headers, and adds
multiple-include guards to all of poll.hâs bits headers.
* io/poll.h: Exchange contents with...
* io/sys/poll.h: ...this file. Adjust guard macros.
* include/poll.h: Exchange contents with...
* include/sys/poll.h: ...this file. Adjust guard macros.
* bits/poll.h, io/bits/poll2.h
* sysdeps/unix/sysv/linux/bits/poll.h
* sysdeps/unix/sysv/linux/m68k/bits/poll.h
* sysdeps/unix/sysv/linux/mips/bits/poll.h
* sysdeps/unix/sysv/linux/sparc/bits/poll.h:
Allow inclusion by poll.h, not sys/poll.h. Add multiple-
include guards where not already present.
* scripts/check-obsolete-constructs.py (HEADER_ALLOWED_INCLUDES):
Update.
commit 034a98bdb01a90511461c60905f4e357ebfe5e46
Author: Zack Weinberg <zackw@panix.com>
Date: Tue Jun 18 11:45:26 2019 -0400
Swap sys/syslog.h with syslog.h.
Our installed syslog.h is a trivial wrapper around sys/syslog.h, which
is where all the actual declarations are. This is backward from
POSIX, which specifies syslog.h and its contents, and does not specify
sys/syslog.h. This arrangement appears to have been inherited from
some BSD-phylum C library, and probably pre-dates any standardization
of syslog.
This patch swaps the contents of syslog.h and sys/syslog.h, so that
the actual declarations appear under the standardized name. Since it
is necessary to adjust all of syslog.hâs bits headers, I also added
multiple-include guards to those files that didnât already have
them. (All installed headers should have multiple-include guards,
even if they are internal and only used in one public header. The
ânever include this file directlyâ #error convention doesnât protect
against including the internal header a second time after its parent
header has already been included.)
* misc/sys/syslog.h: Exchange contents with...
* misc/syslog.h: ...this file. Adjust multiple-include guards.
* include/sys/syslog.h: Exchange contents with...
* include/syslog.h: ...this file. Adjust multiple-include guards.
* bits/syslog-path.h, misc/bits/syslog-ldbl.h
* misc/bits/syslog.h: Allow inclusion by syslog.h, not sys/syslog.h.
Add multiple-include guard where not already present.
* scripts/check-obsolete-constructs.py (HEADER_ALLOWED_INCLUDES):
Update.
commit e91def0c1d15369e612192d2dedb90485fd5accd
Author: Zack Weinberg <zackw@panix.com>
Date: Thu Mar 14 21:03:23 2019 -0400
Add check-obsolete-constructs checker for nested includes.
As a first step toward minimizing the number of public headers that
include other public headers, add a checker to check-obsolete-constructs
that will error out on any such inclusion thatâs not on a whitelist.
The whitelist is initialized to all of the nested inclusions that
already exist; subsequent patches will remove nested inclusions and
shrink the whitelist, hopefully to the point where we only have
nested inclusions as mandated by the relevant standards.
Hurd headers and Sun RPC headers and interface definitions are exempt
from these checks. The former is because minimizing their
cross-inclusions would require making Hurd-specific design decisions,
which I feel is best left to the Hurd maintainers. The latter is
because they are obsolete in glibc; cleanups should be done under the
auspices of TIRPC.
* scripts/check-obsolete-constructs.py
(UNIVERSAL_ALLOWED_INCLUDES, HEADER_ALLOWED_INCLUDES)
(SYSDEP_ALLOWED_INCLUDES, NESTED_INCLUDES_EXEMPT_RE)
(get_allowed_nested, NestedIncludeCheckerWhitelistOnly)
(NestedIncludeChecker): New.
(HeaderChecker): Instantiate and run a NestedIncludeChecker
for each header.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-06-20 16:05 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-20 16:05 [glibc/zack/no-nested-includes] (20 commits) fixup: hurd sys/socket.h is now conformant Zack Weinberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).