| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 aarch64, ia64 and riscv
need a little more work. aarch64 sys/ucontext.h (now bits/ucontext.h)
was including sys/procfs.h for the definition of elf_greg_t etc;
the simplest fix is to have it include bits/procfs.h instead (and then
that needs to include sys/user.h for user_regs_struct). This is not
ideal but fixing it properly would require disentangling all of the
debugger interface headers which is more than I’m up for at the moment.
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/aarch64/bits/procfs.h: Allow inclusion
by bits/ucontext.h as well as sys/procfs.h. Include sys/user.h.
* sysdeps/unix/sysv/linux/aarch64/bits/ucontext.h: Include
bits/procfs.h instead of sys/procfs.h.
* 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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Many public 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>).
After this patch, the public headers that still include sys/types.h are:
stdlib.h and sys/param.h, where removal would risk breaking far too much;
the inclusion of sys/types.h; regex.h, which is taken verbatim from
gnulib and can't include features.h directly (I'm open to better ideas);
sys/bitypes.h, which is an alternative name for sys/types.h; and
the networking headers, which will be dealt with separately. The headers
that still include stdint.h are: inttypes.h, as required by ISO C;
elf.h and thread_db.h, see discussion of debugger interface headers below;
and, again, the networking headers will be dealt with separately.
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.
It would be desirable to stop including stdint.h from elf.h and
thread_db.h as well, but that would involve touching dozens more
bits headers and I ran out of patience.
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 is another partial fix for Hurd-specific bug 23088. The headers
that are still affected by that bug are aio.h, mqueue.h, regex.h,
signal.h, stdlib.h, and sys/types.h.
* 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: Update list of xfails for
bug 23088.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Besides the snarl of debugger/ucontext interfaces, these are the only
public headers that include signal.h.
sys/wait.h includes signal.h only for the definition of siginfo_t.
We already have a single-type header for that, so use it. siginfo_t
contains a field whose type is uid_t, but sys/wait.h is not specified
to define uid_t, so, as is already done for pid_t, the conformance
test is modified to expect that field to have type __uid_t instead.
It is not clear what subset of the definitions from signal.h are
actually expected by historical users of sys/param.h; I’ve chosen to
take the comment at face value and cut it down to bits/signum.h, which
supplies _NSIG and all of the SIG* constants. This requires adjusting
every copy of bits/signum.h to permit inclusion by sys/param.h as well
as signal.h.
While I was at it I moved the comment about sys/param.h being obsolete
from sysdeps/mach/hurd/bits/param.h, where it’s not likely to be seen,
to the top-level sys/param.h, and edited it to give more useful advice.
This patch partially fixes Hurd-specific bug 23088; sys/wait.h is now
conformant.
* posix/sys/wait.h: Include bits/types/siginfo_t.h, not signal.h.
* conform/data/sys/wait.h-data: Do not expect a definition of uid_t.
* malloc/tst-mallocfork.c, nptl/tst-fork4.c, nptl/tst-getpid3.c
* nptl/tst-mutex9.c, nptl/tst-rwlock12.c
* resolv/tst-resolv-res_init-skeleton.c
* sysdeps/unix/sysv/linux/s390/tst-ptrace-singleblock.c:
Include signal.h.
* nptl/tst-cancel4.c, rt/tst-mqueue1.c
* support/tst-support_capture_subprocess.c
* sysdeps/unix/sysv/linux/tst-align-clone.c:
Include signal.h. Sort includes.
* misc/sys/param.h: Include bits/signum.h, not signal.h.
Add comment explaining that this header is obsolete, based on
a similar comment in Hurd bits/param.h.
* bits/param.h: Add multiple inclusion guard and defensive #error.
* sysdeps/mach/hurd/bits/param.h: Add multiple inclusion guard.
Remove comment explaining that this header is obsolete (see above).
* sysdeps/mach/i386/bits/mach/param.h: Add multiple inclusion guard.
* sysdeps/unix/sysv/linux/bits/param.h: Add multiple inclusion guard.
* bits/signum-generic.h, bits/signum.h
* sysdeps/unix/bsd/bits/signum.h
* sysdeps/unix/sysv/linux/alpha/bits/signum.h
* sysdeps/unix/sysv/linux/bits/signum.h
* sysdeps/unix/sysv/linux/hppa/bits/signum.h
* sysdeps/unix/sysv/linux/mips/bits/signum.h:
Allow inclusion by sys/param.h as well as signal.h.
* scripts/check-obsolete-constructs.py (HEADER_ALLOWED_INCLUDES):
Update.
* sysdeps/mach/hurd/i386/Makefile: Remove XFAILs for sys/wait.h.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This doesn't exactly fit the theme but as long as I'm tinkering with
sys/types.h it makes sense to go through and create single-declaration
bits/types/ headers for all of the remaining cases where we have
two or more headers declaring a public type.
The remaining uses of the original __T_defined idiom are:
__error_t_defined in files shared with gnulib, which probably has to
remain as is; ____gwchar_t_defined in inttypes.h, which may not be
necessary anymore and should be addressed separately, and
__ldiv_t_defined and __lldiv_t_defined in stdlib.h, ditto.
Our handling of LFS types is a little inconsistent: some headers
declare both off_t and off64_t (for instance) when
_LARGEFILE64_SOURCE, others will only declare off_t regardless of
_LARGEFILE64_SOURCE. I don't know if this was intentional or not.
I am tempted to centralize responsibility for _LARGEFILE64_SOURCE as
well as _FILE_OFFSET_BITS=64 in bits/types/off_t.h (etc) so that any
header that declares off_t will automatically also declare off64_t
when _LARGEFILE64_SOURCE.
sunrpc/rpc/types.h is special, because it is included in files
compiled by the *build* compiler (cross-rpcgen-objs), and therefore it
cannot unconditionally assume bits/types headers are available. What
I did was have it include the appropriate bits/types headers only if
including sys/types.h did not cause __BIT_TYPES_DEFINED__ to be
defined. This will do the right thing when an installed rpc/types.h
is included by application code compiled without __USE_MISC in effect.
During the build, we rely on the fact that we compile all of our own
code with __USE_MISC in effect. This is fragile, but should be
acceptable for code that's no longer built by default anyway.
scripts/check-obsolete-constructs.py ensures that only sys/types.h and
rpc/types.h include the bits/types/ headers that define obsolete types.
* posix/bits/types/blkcnt64_t.h
* posix/bits/types/blkcnt_t.h
* posix/bits/types/blksize_t.h
* posix/bits/types/dev_t.h
* posix/bits/types/fsblkcnt64_t.h
* posix/bits/types/fsblkcnt_t.h
* posix/bits/types/fsfilcnt64_t.h
* posix/bits/types/fsfilcnt_t.h
* posix/bits/types/fsid_t.h
* posix/bits/types/gid_t.h
* posix/bits/types/id_t.h
* posix/bits/types/ino64_t.h
* posix/bits/types/ino_t.h
* posix/bits/types/intptr_t.h
* posix/bits/types/key_t.h
* posix/bits/types/loff_t.h
* posix/bits/types/mode_t.h
* posix/bits/types/nlink_t.h
* posix/bits/types/off64_t.h
* posix/bits/types/off_t.h
* posix/bits/types/pid_t.h
* posix/bits/types/socklen_t.h
* posix/bits/types/ssize_t.h
* posix/bits/types/suseconds_t.h
* posix/bits/types/uid_t.h
* posix/bits/types/useconds_t.h:
New single-declaration headers for standard types canonically
defined by sys/types.h, sys/socket.h, or inttypes.h but also
exposed by other headers under some circumstances. Code moved
from posix/sys/types.h, socket/sys/socket.h, stdlib/inttypes.h
as appropriate.
* posix/bits/types/uint.h
* posix/bits/types/u_int.h
* posix/bits/types/u_intN_t.h
* posix/bits/types/caddr_t.h
* posix/bits/types/daddr_t.h
* posix/bits/types/loff_t.h
* posix/bits/types/register_t.h:
Similarly, but for obsolete BSD-derived types whose canonical
home is sys/types.h. Some of these headers define more than
one type.
* posix/Makefile (headers): Install the above new headers.
Rewrap the list.
* posix/sys/types.h: All definitions of public types now
accomplished using the above new headers. Consolidate
groups of definitions controlled by the same feature
selection macros.
* inet/arpa/inet.h, bits/socket.h
* sysdeps/mach/hurd/bits/socket.h
* sysdeps/unix/sysv/linux/bits/socket.h:
Use bits/types/socklen_t.h.
* dirent/dirent.h: Use bits/types/ino_t.h and bits/types/ino64_t.h.
* grp/grp.h: Use bits/types/gid_t.h.
* io/fcntl.h: Use bits/types/mode_t.h, bits/types/off_t.h,
bits/types/pid_t.h, and bits/types/off64_t.h.
* io/sys/stat.h: Use bits/types/dev_t.h, bits/types/gid_t.h,
bits/types/ino_t.h, bits/types/mode_t.h, bits/types/nlink_t.h,
bits/types/off_t.h, bits/types/uid_t.h, and bits/types/blkcnt_t.h.
* libio/stdio.h: Use bits/types/off_t.h, bits/types/off64_t.h,
and bits/types/ssize_t.h.
* misc/sys/mman.h: Use bits/types/off_t.h and bits/types/mode_t.h.
* misc/sys/select.h: Use bits/types/suseconds_t.h.
* posix/sched.h: Use bits/types/pid_t.h.
* posix/sys/wait.h: Use bits/types/pid_t.h and bits/types/id_t.h.
* posix/unistd.h: Use bits/types/gid_t.h, bits/types/uid_t.h,
bits/types/off_t.h, bits/types/off64_t.h, bits/types/useconds_t.h,
bits/types/intptr_t.h, and bits/types/socklen_t.h.
* pwd/pwd.h: Use bits/types/gid_t.h and bits/types/uid_t.h.
* resource/sys/resource.h: Use bits/types/id_t.h.
* signal/signal.h: Use bits/types/pid_t.h and bits/types/uid_t.h.
* stdlib/monetary.h: Use bits/types/ssize_t.h.
* sysdeps/gnu/utmpx.h: Use bits/types/pid_t.h.
* sysvipc/sys/ipc.h: Use bits/types/uid_t.h, bits/types/gid_t.h,
bits/types/mode_t.h, and bits/types/key_t.h.
* sysvipc/sys/msg.h: Use bits/types/pid_t.h and bits/types/ssize_t.h.
* sysvipc/sys/shm.h: Use bits/types/pid_t.h.
* termios/termios.h: Use bits/types/pid_t.h.
* time/sys/time.h: Use bits/types/suseconds_t.h.
* time/time.h: Use bits/types/pid_t.h.
* sunrpc/rpc/types.h: Consolidate all #includes at the top of
the file. If __BIT_TYPES_DEFINED__ is not defined after
including sys/types.h, also include bits/types/caddr_t.h,
bits/types/daddr_t.h, bits/types/fsid_t.h, and bits/types/u_int.h.
* scripts/check-obsolete-constructs.py (OBSOLETE_TYPE_HDR_RE_): New.
(ObsoleteIndirectDefinitionsAllowed): New; allows inclusion of
bits/types/ headers that define obsolete typedefs, but not
direct definitions of those types.
(ObsoleteNotAllowed, ObsoletePrivateDefinitionsAllowed)
(ObsoletePublicDefinitionsAllowed): Do not allow inclusion of
bits/types/ headers that define obsolete typedefs.
* include/bits/types/blkcnt64_t.h
* include/bits/types/blkcnt_t.h
* include/bits/types/blksize_t.h
* include/bits/types/caddr_t.h
* include/bits/types/daddr_t.h
* include/bits/types/dev_t.h
* include/bits/types/fsblkcnt64_t.h
* include/bits/types/fsblkcnt_t.h
* include/bits/types/fsfilcnt64_t.h
* include/bits/types/fsfilcnt_t.h
* include/bits/types/fsid_t.h
* include/bits/types/gid_t.h
* include/bits/types/id_t.h
* include/bits/types/ino64_t.h
* include/bits/types/ino_t.h
* include/bits/types/intptr_t.h
* include/bits/types/key_t.h
* include/bits/types/loff_t.h
* include/bits/types/mode_t.h
* include/bits/types/nlink_t.h
* include/bits/types/off64_t.h
* include/bits/types/off_t.h
* include/bits/types/pid_t.h
* include/bits/types/register_t.h
* include/bits/types/socklen_t.h
* include/bits/types/ssize_t.h
* include/bits/types/suseconds_t.h
* include/bits/types/u_char.h
* include/bits/types/u_intN_t.h
* include/bits/types/uchar.h
* include/bits/types/uid_t.h
* include/bits/types/useconds_t.h: New wrappers.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This makes four linked changes to bits/types.h. First, we use
__(u)?int(16|32|64)_t to define __[SU](16|32|64)_TYPE. In addition
to reducing the amount of ifdeffage, this means __STD_TYPE is no longer
necessary, since gcc -std=c89 will complain about ‘typedef long long foo_t’
but not ‘typedef __int64_t foo_t’, even if the underlying type
of __int64_t is long long.
Second, we eliminate __UQUAD_TYPE and __SQUAD_TYPE from the set of
macros bits/typesizes.h should use to define __FOO_T_TYPE macros,
since they are always the same as __U64_TYPE and __S64_TYPE
respectively.
Third, we remove __u_char, __u_short, __u_int, __u_long, __u_quad_t,
and __quad_t, we add __uintptr_t, and we define __intmax_t and
__uintmax_t as __int64_t and __uint64_t.
Fourth, we reorganize the list of typedefs into groups by the
standard (if any) that defines them, and sort them alphabetically within
each group.
* posix/bits/types.h: Move #error for __WORDSIZE neither 32 nor 64
to first group of conditionals on __WORDSIZE, and make it more
explicit. Update commentary. Define all __foo_t types with
regular ‘typedef’. Reorganize all __foo_t types into the same
groups that sys/types.h uses.
(__u_char, __u_short, __u_int, __u_long, __quad_t, __u_quad_t)
(__UQUAD_TYPE, __SQUAD_TYPE, __STD_TYPE): Don’t define.
(__S16_TYPE): Define unconditionally as __int16_t.
(__U16_TYPE): Define unconditionally as __uint16_t.
(__S32_TYPE): Define unconditionally as __int32_t.
(__U32_TYPE): Define unconditionally as __uint32_t.
(__S64_TYPE): Define unconditionally as __int64_t.
(__U64_TYPE): Define unconditionally as __uint64_t.
(__intmax_t): Define unconditionally as __int64_t.
(__uintmax_t): Define unconditionally as __uint64_t.
(__uintptr_t): New typedef.
* bits/time64.h
* bits/typesizes.h
* sysdeps/mach/hurd/bits/typesizes.h
* sysdeps/unix/sysv/linux/alpha/bits/typesizes.h
* sysdeps/unix/sysv/linux/generic/bits/typesizes.h
* sysdeps/unix/sysv/linux/mips/bits/typesizes.h
* sysdeps/unix/sysv/linux/s390/bits/typesizes.h
* sysdeps/unix/sysv/linux/sparc/bits/typesizes.h
* sysdeps/unix/sysv/linux/x86/bits/typesizes.h:
Replace all uses of __UQUAD_TYPE with __U64_TYPE, and all
uses of __SQUAD_TYPE with __S64_TYPE.
* posix/sys/types.h, rpc/sys/types.h
(u_char): Define as unsigned char.
(u_short): Define as unsigned short.
(u_int): Define as unsigned int.
(u_long): Define as unsigned long.
(quad_t): Define as __int64_t.
(u_quad_t): Define as __uint64_t.
* stdlib/stdint.h (intptr_t): Define as __intptr_t.
(uintptr_t): Define as __uintptr_t.
* scripts/check-obsolete-constructs.py: Update allowed
definitions for the obsolete types. No longer allow
__STD_TYPE as an alias for typedef.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
caddr_t is a BSD-derived alias for ‘char *’, obsoleted by the
introduction of ‘void *’ in C89 (!) daddr_t is a “disk address,”
but it’s always defined as ‘int’, making it too small for modern
disks and tapes. loff_t is another name for off64_t, from early
drafts of LFS. All three are already only exposed by sys/types.h
under __USE_MISC.
This patch adds them to the set of types that shall not be used in
installed headers (enforced by check-obsolete-constructs.py) and
expunges all remaining uses, internally as well as in installed
headers. Since __DADDR_T_TYPE is always defined as __S32_TYPE, and
daddr_t is obsolete so there’s no need to worry about future
variation, the patch also removes __DADDR_T_TYPE from the set of
macros that bits/typesizes.h is required to define. Instead
bits/types.h always defines __daddr_t as __S32_TYPE, and the
definition is moved to a more logical location within the file, next
to __caddr_t.
It’s always safe to change (__)loff_t to the matching (__)off64_t;
in a few internal files, I removed an unnecessary __ prefix.
daddr_t is only used for struct ustat, which is obsoleted by struct
statvfs and we already don’t declare it in public headers, and for an
ioctl parameter block in sys/mtio.h (which may or may not be obsolete,
I can’t tell). In sys/mtio.h I replaced both uses with ‘int’ to match
the use of bare ‘long int’ for most of the other fields of that
structure. In misc/ustat.c, the definition of struct ustat is not
actually necessary so I removed it entirely. In
sysdeps/unix/sysv/linux/ustat.c a definition is necessary but only
because INLINE_SYSCALL_CALL doesn’t work (on at least x86) when an
argument is a pointer to an incomplete type, so I substituted a dummy
definition.
Most of the internal uses of caddr_t are in the sunrpc and nis
directories, and since most of that code is obsolete, I mechanically
replaced them with char * rather than consider whether void * might
make more sense. Because “const caddr_t foo” is semantically
different from “const char *foo” (in the first case ‘foo’ itself is
const but the memory pointed to isn’t, in the second case the memory
pointed to is const but ‘foo’ isn’t) this change exposed some
const-correctness errors in sunrpc, which I fixed minimally. Outside
of sunrpc and nis, I put a little more thought into whether uses of
caddr_t should be void * instead.
* scripts/check-obsolete-constructs.py: Add caddr_t, daddr_t,
and loff_t to the set of obsolete types forbidden in public
headers.
* posix/bits/types.h: Unconditionally define __daddr_t as
__S32_TYPE. Move definition of __daddr_t next to definition
of __caddr_t.
* bits/typesizes.h
* sysdeps/mach/hurd/bits/typesizes.h
* sysdeps/unix/sysv/linux/alpha/bits/typesizes.h
* sysdeps/unix/sysv/linux/generic/bits/typesizes.h
* sysdeps/unix/sysv/linux/mips/bits/typesizes.h
* sysdeps/unix/sysv/linux/s390/bits/typesizes.h
* sysdeps/unix/sysv/linux/sparc/bits/typesizes.h
* sysdeps/unix/sysv/linux/x86/bits/typesizes.h:
Don’t define __DADDR_T_TYPE.
* sysdeps/gnu/sys/mtio.h (struct mtget): Change all uses of
__daddr_t to int.
* misc/ustat.c: Remove definition of struct ustat; only
forward-declare it.
* sysdeps/unix/sysv/linux/ustat.c: Replace fields of
struct ustat with a size-preserving dummy field.
* hurd/Makefile (migheaderpipe): Rewrite loff_t as __off64_t.
* hurd/fd-read.c (_hurd_fd_read): Use off64_t instead of loff_t.
* hurd/fd-write.c (hurd_fd_write): Use off64_t instead of loff_t.
* hurd/hurd/fd.h (_hurd_fd_read, _hurd_fd_write): Declare
using __off64_t instead of __loff_t.
* support/xunistd.h (xcopy_file_range): Declare using off64_t
instead of loff_t.
* sysdeps/unix/sysv/linux/generic/wordsize-32/overflow.h
* sysdeps/unix/sysv/linux/lseek.c
* sysdeps/unix/sysv/linux/lseek64.c
* sysdeps/unix/sysv/linux/splice.c
Throughout, use off64_t instead of loff_t.
* sysdeps/unix/sysv/linux/sys/quota.h
(dqoff): Use __off64_t instead of __loff_t.
(quotactl): Declare using char * instead of caddr_t.
* sysdeps/unix/sysv/linux/test-errno-linux.c
(do_test): Cast to char * instead of caddr_t when calling quotactl.
* elf/dl-map-segments.h (_dl_map_segments): Cast to void *
instead of caddr_t when calling __mprotect and __mmap.
* elf/dl-minimal.c (malloc): Declare page as char *, not caddr_t.
* elf/dl-reloc.c (_dl_relocate_object): Declare textrels.start
as char *, not caddr_t. Cast to char *, not caddr_t, in
pointer arithmetic.
* intl/loadmsgcat.c: Remove two unnecessary casts to caddr_t
when calling munmap. Change a third cast to target void *
instead and add a comment explaining why this one is necessary.
* locale/loadlocale.c (_nl_load_locale): Use NULL instead of
`(caddr_t)0`, and remove an unnecessary cast to caddr_t when
calling munmap.
(_nl_unload_locale): Change casts when calling free and munmap
to target char *, and add a comment explaining why they are
necessary.
* sysdeps/gnu/net/if.h
(struct ifreq): Declare ifru_data as char *, not __caddr_t.
(struct ifconf): Declare ifcu_buf as char *, not __caddr_t.
* nis/nis_add.c
* nis/nis_call.c
* nis/nis_callback.c
* nis/nis_checkpoint.c
* nis/nis_findserv.c
* nis/nis_intern.h
* nis/nis_lookup.c
* nis/nis_mkdir.c
* nis/nis_modify.c
* nis/nis_ping.c
* nis/nis_remove.c
* nis/nis_rmdir.c
* nis/nis_server.c
* nis/nis_table.c
* nis/nis_util.c
* nis/nss_nisplus/nisplus-grp.c
* nis/nss_nisplus/nisplus-pwd.c
* nis/rpcsvc/nis_callback.h
* nis/rpcsvc/yp.h
* nis/ypclnt.c
* sunrpc/auth_des.c
* sunrpc/auth_unix.c
* sunrpc/authdes_prot.c
* sunrpc/authuxprot.c
* sunrpc/clnt_raw.c
* sunrpc/clnt_tcp.c
* sunrpc/clnt_udp.c
* sunrpc/clnt_unix.c
* sunrpc/key_call.c
* sunrpc/pm_getmaps.c
* sunrpc/pm_getport.c
* sunrpc/pmap_clnt.c
* sunrpc/pmap_prot2.c
* sunrpc/pmap_rmt.c
* sunrpc/proto.h
* sunrpc/rpc/auth.h
* sunrpc/rpc/clnt.h
* sunrpc/rpc/pmap_clnt.h
* sunrpc/rpc/pmap_rmt.h
* sunrpc/rpc/rpc_msg.h
* sunrpc/rpc/svc.h
* sunrpc/rpc/xdr.h
* sunrpc/rpc_clntout.c
* sunrpc/rpc_cmsg.c
* sunrpc/rpc_hout.c
* sunrpc/rpc_prot.c
* sunrpc/rpc_sample.c
* sunrpc/rpc_svcout.c
* sunrpc/svc.c
* sunrpc/svc_authux.c
* sunrpc/svc_raw.c
* sunrpc/svc_tcp.c
* sunrpc/svc_udp.c
* sunrpc/svc_unix.c
* sunrpc/xdr.c
* sunrpc/xdr_array.c
* sunrpc/xdr_mem.c
* sunrpc/xdr_rec.c
* sunrpc/xdr_ref.c
* sunrpc/xdr_sizeof.c
* sunrpc/xdr_stdio.c:
Mechanically replace all uses of caddr_t with char *.
* sunrpc/xdr_mem.c (xdrmem_create): Cast away const when
setting xdrs->x_private and xdrs->x_base.
* sunrpc/xdr_stdio.c (xdrstdio_getbytes): Correct argument
types in definition to match prototype.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently register_t is, unlike all other types in sys/types.h,
defined using a GCC extension (__attribute__((mode(word)))), falling
back to ‘int’ if the extension is unavailable. This is a potential
ABI compatibility hazard for people using non-GNU compilers with
glibc. It’s also unnecessary; the bits/typesizes.h mechanism can
handle all of the existing variation in the definition. In most
cases, defining __REGISTER_T_TYPE as __SWORD_TYPE is sufficient.
Special handling is necessary for MIPS n32 and x86-64 x32, where
__SWORD_TYPE is ‘int’ and the appropriate type for register_t is
‘long long’. Unfortunately, this means we need to create a new
bits/typesizes.h variant for linux/mips. This variant is based
on the top-level bits/typesizes.h, not linux/generic/bits/typesizes.h,
to match the existing MIPS ABIs.
Tested using build-many-glibcs. The c++-types test confirms that the
physical type of register_t does not change on any supported platform.
* posix/sys/types.h: Typedef register_t as __register_t.
* posix/bits/types.h: Typedef __register_t using __REGISTER_T_TYPE.
* bits/typesizes.h
* sysdeps/mach/hurd/bits/typesizes.h
* sysdeps/unix/sysv/linux/alpha/bits/typesizes.h
* sysdeps/unix/sysv/linux/generic/bits/typesizes.h
* sysdeps/unix/sysv/linux/s390/bits/typesizes.h
* sysdeps/unix/sysv/linux/sparc/bits/typesizes.h:
Define __REGISTER_T_TYPE as __SWORD_TYPE.
* sysdeps/unix/sysv/linux/mips/bits/typesizes.h:
New file (copied from bits/typesizes.h).
Define __REGISTER_T_TYPE as __SWORD_TYPE for o32 and n64 ABIs.
Define __REGISTER_T_TYPE as __SQUAD_TYPE for n32.
* sysdeps/unix/sysv/linux/x86/bits/typesizes.h:
Define __REGISTER_T_TYPE as __SWORD_TYPE for o32 and 64-bit ABIs.
Define __REGISTER_T_TYPE as __SQUAD_TYPE for x32.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The Makefile glue to run tests on installed headers is currently
duplicated between the top-level Makefile and Rules, because the
top-level Makefile doesn't read Rules but does install some headers.
This patch moves most of the headers installed by the top-level Makefile
to misc/ (chosen arbitrarily; I'm open to putting them somewhere else
if reviewers feel it would be better) and removes the duplicated logic
from the top-level Makefile. I believe this also means that none of
the headers in include/ are installed headers anymore.
gnu/lib-names*.h are still generated by code in Makerules and installed
by the top-level Makefile. I tried to move them to misc/ as well, but
that broke the generation process in a manner that didn't make any sense
so I gave up. The tests performed on installed headers are not
especially useful for gnu/lib-names*.h so I think we can live with this
for now.
* include/bits/xopen_lim.h
* include/features.h
* include/gnu-versions.h
* include/gnu/libc-version.h
* include/limits.h
* include/stdc-predef.h
* include/values.h:
Move to misc/ and replace with a trivial wrapper.
* Makefile (headers): Remove all headers moved to misc/.
Don't set a vpath for %.h.
(check-installed-headers-c.out, check-installed-headers-cxx.out)
(check-wrapper-headers.out): Remove rules.
* misc/Makefile (headers): Add all of the above headers and
sort the list.
* sysdeps/mach/hurd/bits/errno.h: Regenerate.
|
|
|
|
|
|
|
| |
Without a proper size, we get MACH_RCV_TOO_LARGE instead of MACH_MSG_SUCCESS.
* sysdeps/mach/hurd/setitimer.c (timer_thread): Add return_code_type
field to received message, and set the receive size in __mach_msg call.
|
|
|
|
|
|
|
|
| |
As explained on
https://sourceware.org/ml/libc-alpha/2020-01/msg00049.html
the presence of __errno_location in libpthread.so on GNU/Linux makes
libpthread getting linked in for libstdc++. This aligns on that behavior, to
avoid issues that only GNU/Hurd would get.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This follows bd60ce86520b ('nptl: Move pthread_atfork to libc_nonshared.a')
with the same rationale: there is no non-libpthread equivalent to be used
for making linking against libpthread optional.
libpthread_nonshared.a is unused after this, so remove it from the
build.
There is no ABI impact because pthread_atfork was implemented using
__register_atfork in libc even before this change.
pthread_atfork has to be a weak alias because pthread_* names are not
reserved in libc.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch avoid probing the __NR_clock_getttime64 syscall each time
__clock_gettime64 is issued on a kernel without 64 bit time support.
Once ENOSYS is obtained, only 32-bit clock_gettime are used.
The following snippet:
clock_getres (CLOCK_REALTIME, &(struct timespec) { 0 });
clock_getres (CLOCK_MONOTONIC, &(struct timespec) { 0 });
clock_getres (CLOCK_BOOTTIME, &(struct timespec) { 0 });
clock_getres (20, &(struct timespec) { 0 });
On a kernel without 64 bit time support issues the syscalls:
syscall_0x196(0, 0xffb83330, [...]) = -1 ENOSYS (Function not implemented)
clock_getres(CLOCK_REALTIME, {tv_sec=0, tv_nsec=1}) = 0
clock_getres(CLOCK_MONOTONIC, {tv_sec=0, tv_nsec=1}) = 0
clock_getres(CLOCK_BOOTTIME, {tv_sec=0, tv_nsec=1}) = 0
Checked on i686-linux-gnu on 4.15 kernel.
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
|
|
|
|
|
|
|
|
| |
No architecture currently defines the vDSO symbol. On archictures
with 64-bit time_t the HAVE_CLOCK_GETRES_VSYSCALL is renamed to
HAVE_CLOCK_GETRES64_VSYSCALL, it simplifies clock_gettime code.
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
|
|
|
|
|
|
| |
It was added on Linux 5.4 (commit 1f66c45db3302).
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
|
|
|
|
|
|
| |
It was added on Linux 5.5 (commit 74d06efb9c2f9).
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
|
|
|
|
|
|
|
|
| |
It was added on Linux 5.3 (commit 22ca962288c0a).
Checked on i686-linux-gnu with 5.3.0 kernel.
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch avoid probing the __NR_clock_getttime64 syscall each time
__clock_gettime64 is issued on a kernel without 64 bit time support.
Once ENOSYS is obtained, only 32-bit clock_gettime are used.
The following snippet:
clock_gettime (CLOCK_REALTIME, &(struct timespec) { 0 });
clock_gettime (CLOCK_MONOTONIC, &(struct timespec) { 0 });
clock_gettime (CLOCK_BOOTTIME, &(struct timespec) { 0 });
clock_gettime (20, &(struct timespec) { 0 });
On a kernel without 64 bit time support and with vDSO support results
on the following syscalls:
syscall_0x193(0, 0xff87ba30, [...]) = -1 ENOSYS (Function not implemented)
clock_gettime(CLOCK_BOOTTIME, {tv_sec=927082, tv_nsec=474382032}) = 0
clock_gettime(0x14 /* CLOCK_??? */, 0xff87b9f8) = -1 EINVAL (Invalid argument)
While on a kernel without vDSO support:
syscall_0x193(0, 0xbec95550, 0xb6ed2000, 0x1, 0xbec95550, 0) = -1 (errno 38)
clock_gettime(CLOCK_REALTIME, {tv_sec=1576615930, tv_nsec=638250162}) = 0
clock_gettime(CLOCK_MONOTONIC, {tv_sec=1665478, tv_nsec=638779620}) = 0
clock_gettime(CLOCK_BOOTTIME, {tv_sec=1675418, tv_nsec=292932704}) = 0
clock_gettime(0x14 /* CLOCK_??? */, 0xbec95530) = -1 EINVAL (Invalid argument)
Checked on i686-linux-gnu on 4.15 kernel and on a 5.3 kernel.
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
|
|
|
|
|
|
|
|
| |
No architecture currently defines the vDSO symbol. On architectures
with 64-bit time_t the HAVE_CLOCK_GETTIME_VSYSCALL is renamed to
HAVE_CLOCK_GETTIME64_VSYSCALL, it simplifies clock_gettime code.
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch moves the vDSO setup from libc to loader code, just after
the vDSO link_map setup. For static case the initialization
is moved to _dl_non_dynamic_init instead.
Instead of using the mangled pointer, the vDSO data is set as
attribute_relro (on _rtld_global_ro for shared or _dl_vdso_* for
static). It is read-only even with partial relro.
It fixes BZ#24967 now that the vDSO pointer is setup earlier than
malloc interposition is called.
Also, vDSO calls should not be a problem for static dlopen as
indicated by BZ#20802. The vDSO pointer would be zero-initialized
and the syscall will be issued instead.
Checked on x86_64-linux-gnu, i686-linux-gnu, aarch64-linux-gnu,
arm-linux-gnueabihf, powerpc64le-linux-gnu, powerpc64-linux-gnu,
powerpc-linux-gnu, s390x-linux-gnu, sparc64-linux-gnu, and
sparcv9-linux-gnu. I also run some tests on mips.
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
|
|
|
|
|
|
|
|
|
|
|
| |
The IFUNC bypass to vDSO is used when USE_IFUNC_TIME is set.
Currently powerpc and x86 defines it. Otherwise the generic
implementation is used, which calls clock_gettime.
Checked on powerpc64le-linux-gnu, powerpc64-linux-gnu,
powerpc-linux-gnu-power4, x86_64-linux-gnu, and i686-linux-gnu.
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
|
|
|
|
|
|
|
|
|
|
|
|
| |
The IFUNC bypass to vDSO is used when USE_IFUNC_GETTIMEOFDAY is set.
Currently aarch64, powerpc*, and x86 defines it. Otherwise the
generic implementation is used, which calls clock_gettime.
Checked on aarch64-linux-gnu, powerpc64le-linux-gnu,
powerpc64-linux-gnu, powerpc-linux-gnu-power4, x86_64-linux-gnu,
and i686-linux-gnu.
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
|
|
|
|
|
|
|
|
|
| |
The clock_getres is a new implementation added on Linux 5.4
(abed3d826f2f).
Checked with a build against mips-linux-gnu and mips64-linux-gnu.
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add the missing time and clock_getres vDSO symbol names on x86.
For time, the iFUNC already uses expected name so it affects only
the static build.
The clock_getres is a new implementation added on Linux 5.3
(f66501dc53e72).
Checked on x86-linux-gnu and i686-linux-gnu.
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The auto-generated vDSO call shows some issues:
- It requires sync the auto-generated C file with current glibc
implementation;
- It still uses symbol redirections hacks where libc-symbols.h
provide macros that uses compiler builtins
(libc_ifunc_redirected for instance);
- It does not handle all required compiler handling
(inhibit_stack_protector on iFUNC resolver).
- No architecure uses it.
Checked with a build against all major ABIs.
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
|
|
|
|
|
|
|
|
|
|
| |
This is the only use of auto-generation syscall which uses a vDSO
plus IFUNC and the current x86 generic implementation already covers
the expected semantic.
Checked on x86_64-linux-gnu-x32.
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
As indicated on libc-help [1] the ec138c67cb commit broke 32-bit
builds when configured with --enable-kernel=5.1 or higher. The
scenario 10 from [2] might also occur in this configuration and
INLINE_VSYSCALL will try to use the vDSO symbol and
HAVE_CLOCK_GETTIME64_VSYSCALL does not set HAVE_VSYSCALL prior its
usage.
Also, there is no easy way to just enable the code to use one
vDSO symbol since the macro INLINE_VSYSCALL is redefined if
HAVE_VSYSCALL is set.
Instead of adding more pre-processor handling and making the code
even more convoluted, this patch removes the requirement of defining
HAVE_VSYSCALL before including sysdep-vdso.h to enable vDSO usage.
The INLINE_VSYSCALL is now expected to be issued inside a
HAVE_*_VSYSCALL check, since it will try to use the internal vDSO
pointers.
Both clock_getres and clock_gettime vDSO code for time64_t were
removed since there is no vDSO setup code for the symbol (an
architecture can not set HAVE_CLOCK_GETTIME64_VSYSCALL).
Checked on i686-linux-gnu (default and with --enable-kernel=5.1),
x86_64-linux-gnu, aarch64-linux-gnu, and powerpc64le-linux-gnu.
I also checked against a build to mips64-linux-gnu and
sparc64-linux-gnu.
[1] https://sourceware.org/ml/libc-help/2019-12/msg00014.html
[2] https://sourceware.org/ml/libc-alpha/2019-12/msg00142.html
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
|
|
|
|
|
|
|
|
| |
The result of INTERNAL_SYSCALL_CANCEL should be checked with
macros INTERNAL_SYSCALL_ERROR_P and INTERNAL_SYSCALL_ERRNO instead
of comparing the result directly.
Checked on powerpc-linux-gnu.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch adds a new macro, libm_alias_finite, to define all _finite
symbol. It sets all _finite symbol as compat symbol based on its first
version (obtained from the definition at built generated first-versions.h).
The <fn>f128_finite symbols were introduced in GLIBC 2.26 and so need
special treatment in code that is shared between long double and float128.
It is done by adding a list, similar to internal symbol redifinition,
on sysdeps/ieee754/float128/float128_private.h.
Alpha also needs some tricky changes to ensure we still emit 2 compat
symbols for sqrt(f).
Passes buildmanyglibc.
Co-authored-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
|
|
|
|
|
|
| |
Since the switch away from auto-generated wrappers for these system
calls, the kludge is already included in the C source file of the
system call wrapper.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Use <arch-syscall.h> instead of <asm/unistd.h> to obtain the system
call numbers. A few direct includes of <asm/unistd.h> need to be
removed (if the system call numbers are already provided indirectly
by <sysdep.h>) or replaced with <sys/syscall.h>.
Current Linux headers for alpha define the required system call names,
so most of the _NR_* hacks are no longer needed. For the 32-bit arm
architecture, eliminate the INTERNAL_SYSCALL_ARM macro, now that we
have regular system call names for cacheflush and set_tls. There are
more such cleanup opportunities for other architectures, but these
cleanups are required to avoid macro redefinition errors during the
build.
For ia64, it is desirable to use <asm/break.h> directly to obtain
the break number for system calls (which is not a system call number
itself). This requires replacing __BREAK_SYSCALL with
__IA64_BREAK_SYSCALL because the former is defined as an alias in
<asm/unistd.h>, but not in <asm/break.h>.
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The new tables are currently only used for consistency checks
with the installed kernel headers and the architecture-independent
system call names table. They are based on Linux 5.4.
The goal is to use these architecture-specific tables to ensure
that system call wrappers are available irrespective of the version
of the installed kernel headers.
The tables are formatted in the form of C header files so that they
can be used directly in an #include directive, without external
preprocessing. (External preprocessing of a plain table file
would introduce cross-subdirectory dependency issues.) However,
the intent is that they can still be treated as tables and can be
processed by simple tools.
The irregular system call names on 32-bit arm add a complication.
The <fixup-asm-unistd.h> header is introduced to work around that,
and the system calls are listed under regular names in the
<arch-syscall.h> file.
A make target, update-syscalls-list, is added to patch the glibc
sources with data from the current kernel headers.
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
I've updated copyright dates in glibc for 2020. This is the patch for
the changes not generated by scripts/update-copyrights and subsequent
build / regeneration of generated files. As well as the usual annual
updates, mainly dates in --version output (minus libc.texinfo which
previously had to be handled manually but is now successfully updated
by update-copyrights), there is a fix to
sysdeps/unix/sysv/linux/powerpc/bits/termios-c_lflag.h where a typo in
the copyright notice meant it failed to be updated automatically.
Please remember to include 2020 in the dates for any new files added
in future (which means updating any existing uncommitted patches you
have that add new files to use the new copyright dates in them).
|
| |
|
|
|
|
|
|
|
| |
Since both wait and waitpid are implemented on top of wait4. It fixes
nptl/tst-cancel{x}{4,5,7}.
Checked on alpha-linux-gnu.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This adds _hurd_sigstate_set_global_rcv used by libpthread to enable
POSIX-confirming behavior of signals on a per-thread basis.
This also provides a sigstate destructor _hurd_sigstate_delete, and a
global process signal state, which needs to be locked and check when
global disposition is enabled, thus the addition of _hurd_sigstate_lock
_hurd_sigstate_actions _hurd_sigstate_pending _hurd_sigstate_unlock helpers.
This also updates all the glibc code accordingly.
This also drops support for get_int(INIT_SIGMASK), which did not make sense
any more since we do not have a single signal thread any more.
During fork/spawn, this also reinitializes the child global sigstate's
lock. That cures an issue that would very rarely cause a deadlock in the
child in fork, tries to unlock ss' critical section lock at the end of
fork. This will typically (always?) be observed in /bin/sh, which is not
surprising as that is the foremost caller of fork.
To reproduce an intermediate state, add an endless loop if
_hurd_global_sigstate is locked after __proc_dostop (cast through
volatile); that is, while still being in the fork's parent process.
When that triggers (use the libtool testsuite), the signal thread has
already locked ss (which is _hurd_global_sigstate), and is stuck at
hurdsig.c:685 in post_signal, trying to lock _hurd_siglock (which the
main thread already has locked and keeps locked until after
__task_create). This is the case that ss->thread == MACH_PORT_NULL, that
is, a global signal. In the main thread, between __proc_dostop and
__task_create is the __thread_abort call on the signal thread which would
abort any current kernel operation (but leave ss locked). Later in fork,
in the parent, when _hurd_siglock is unlocked in fork, the parent's
signal thread can proceed and will unlock eventually the global sigstate.
In the client, _hurd_siglock will likewise be unlocked, but the global
sigstate never will be, as the client's signal thread has been configured
to restart execution from _hurd_msgport_receive. Thus, when the child
tries to unlock ss' critical section lock at the end of fork, it will
first lock the global sigstate, will spin trying to lock it, which can
never be successful, and we get our deadlock.
Options seem to be:
* Move the locking of _hurd_siglock earlier in post_signal -- but that
may generally impact performance, if this locking isn't generally
needed anyway?
On the other hand, would it actually make sense to wait here until we
are not any longer in a critical section (which is meant to disable
signal delivery anyway (but not for preempted signals?))?
* Clear the global sigstate in the fork's child with the rationale that
we're anyway restarting the signal thread from a clean state. This
has now been implemented.
Why has this problem not been observed before Jérémie's patches? (Or has
it? Perhaps even more rarely?) In _S_msg_sig_post, the signal is now
posted to a *global receiver thread*, whereas previously it was posted to
the *designated signal-receiving thread*. The latter one was in a
critical section in fork, so didn't try to handle the signal until after
leaving the critical section? (Not completely analyzed and verified.)
Another question is what the signal is that is being received
during/around the time __proc_dostop executes.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Adapted from the Linux x86 functions.
Not thoroughly tested, but manual testing as well as glibc tests look fine, and
manual -lpthread testing also looks fine (within the given bounds for a new
stack to be used with makecontext).
This has also been in use in Debian since 2013.
|
| |
|