about summary refs log tree commit diff
path: root/sysdeps/unix/sysv/linux/alpha/sys/ucontext.h
diff options
context:
space:
mode:
authorZack Weinberg <zackw@panix.com>2019-06-10 09:07:10 -0400
committerZack Weinberg <zackw@panix.com>2020-01-08 14:15:42 -0500
commit9e32bbc2da1644f4ec9c1428faf98ed6ad508e4a (patch)
tree72183c88ed23314619034b3668f7d45c5f7381e7 /sysdeps/unix/sysv/linux/alpha/sys/ucontext.h
parent94ab7b6b7f5b7f424554e325c20f60f706efc207 (diff)
downloadglibc-9e32bbc2da1644f4ec9c1428faf98ed6ad508e4a.tar.gz
glibc-9e32bbc2da1644f4ec9c1428faf98ed6ad508e4a.tar.xz
glibc-9e32bbc2da1644f4ec9c1428faf98ed6ad508e4a.zip
Minimize inclusion of netinet/in.h from public headers.
As with sys/socket.h and struct sockaddr, most of the files including
netinet/in.h just want struct sockaddr_in or a related type, so
introduce bits/types headers for these.  POSIX specifically allows
arpa/inet.h to include netinet/in.h and I think it makes sense to
preserve that.  The definition of struct sockaddr_in had a dependence
on the definition of struct sockaddr; to avoid that, bits/sockaddr.h
grows a new macro, __SOCKADDR_DATA_SIZE, which is the declared size of
struct sockaddr.sa_data.

On Linux, some kernel headers (notably linux/in.h and linux/in6.h)
attempt to cooperate with a C library’s headers in defining types such
as struct sockaddr_in.  There is a set of macros whose names begin
with __UAPI_DEF_ that indicate that a type has already been defined.
This mechanism doesn’t actually work with the kernel headers as they
are in 5.0, as far as I can tell, but it could be made to work with
straightforward changes, so it makes sense for us to support it to the
extent we can.  To do this sensibly I need to introduce a new bits
header called bits/uapi-compat.h, with a trivial definition for
non-Linux.  This replaces the existing __USE_KERNEL_IPV6_DEFS macro.

	* bits/sockaddr.h (__SOCKADDR_DATA_SIZE): New macro.
	* sysdeps/unix/bsd/bits/sockaddr.h: Likewise.
	* sysdeps/unix/sysv/linux/m68k/bits/sockaddr.h: Likewise.
	* socket/bits/types/struct_sockaddr.h: Use __SOCKADDR_DATA_SIZE as
	array length of sa_data.

	* bits/in.h: Add multiple inclusion guard.
	(__USE_KERNEL_IPV6_DEFS): Don’t define.
	* sysdeps/unix/sysv/linux/bits/in.h: Similarly.
	(IPV6_ADD_MEMBERSHIP, IPV6_DROP_MEMBERSHIP): Define when not
	already defined, not conditional on __USE_KERNEL_IPV6_DEFS.

	* bits/uapi-compat.h: New file, trivial generic version.
	* sysdeps/unix/sysv/linux/bits/uapi-compat.h: New file,
	Linux-specific version which recognizes kernel header guard macros
	and defines __UAPI_DEF_* macros as appropriate.
	* misc/Makefile: Install bits/uapi-compat.h.

	* include/bits/types/in_addr_t.h, include/bits/types/in_port_t.h
	* include/bits/types/struct_in_addr.h
	* include/bits/types/struct_in6_addr.h
	* include/bits/types/struct_sockaddr_in.h
	* include/bits/types/struct_sockaddr_in6.h:
	New wrapper headers.

	* inet/bits/types/in_addr_t.h, inet/bits/types/in_port_t.h
	* inet/bits/types/struct_in_addr.h
	* inet/bits/types/struct_in6_addr.h
	* inet/bits/types/struct_sockaddr_in.h
	* inet/bits/types/struct_sockaddr_in6.h
	New single-type headers, factored out of inet/netinet/in.h.
	Add __UAPI_DEF_* conditionals where appropriate, and verify that
	all conditionalized definitions agree with the relevant
	OS-supplied header.  Use __SOCKADDR_DATA_SIZE to set size of sin_zero.
	* inet/Makefile: Install the new single-type headers.

	* inet/netinet/in.h: Include bits/uapi-compat.h.
	Define in_addr_t, in_port_t, struct in_addr, struct in6_addr,
	struct sockaddr_in, and struct sockaddr_in6 by including the
	above single-type headers, not directly.  Replace all
	__USE_KERNEL_IPV6_DEFS conditionals with appropriate __UAPI_DEF_*
	conditionals.  Add appropriate __UAPI_DEF_* conditionals around
	the definitions of the IPPROTO_* constants, the IN_CLASS
	macros, and struct ip_mreq.  Import IN_LOOPBACK macro from
	Linux 5.0 linux/in.h and verify all other conditionalized
	definitions agree with the relevant linux/ header.
	Define IPPORT_RESERVED only if not already defined, and make it a
	macro so we can tell.

	* inet/netinet/igmp.h, inet/netinet/ip.h, inet/netinet/ip_icmp.h:
	Include bits/types/struct_in_addr.h, not netinet/in.h.

	* inet/netinet/ip_icmp.h: Hoist all #includes to the top of the file.

	* inet/netinet/icmp6.h, inet/netinet/ip6.h
	* sysdeps/unix/sysv/linux/net/route.h:
	Include bits/types/struct_in6_addr.h, not netinet/in.h.

	* sysdeps/mach/hurd/net/route.h: Include bits/types.h and
	bits/types/struct_in6_addr.h, not netinet/in.h.  Use __uint16_t
	and __uint32_t instead of uint16_t and uint32_t.

	* resolv/bits/types/res_state.h: Include bits/types/struct_in_addr.h
	and bits/types/struct_sockaddr_in.h.  Forward declare struct
	sockaddr_in6.  Don’t include netinet/in.h.

	* resolv/netdb.h: Don’t include netinet/in.h.  Use socklen_t
	instead of __socklen_t.  Define IPPORT_RESERVED only if not
	already defined, with definition matching netinet/in.h.
	When __USE_MISC, include bits/sockaddr.h.
	* resolv/resolv.h: Don’t include netinet/in.h.

	* inet/tst-getni1.c, inet/tst-getni2.c
	* nss/tst-nss-files-hosts-erange.c, nss/tst-nss-files-hosts-getent.c
	* nss/tst-nss-files-hosts-multi.c, posix/tst-getaddrinfo2.c
	* resolv/tst-bug18665-tcp.c, resolv/tst-resolv-ai_idn-common.c
	* resolv/tst-resolv-canonname.c, resolv/tst-resolv-edns.c
	* resolv/tst-resolv-network.c, resolv/tst-resolv-nondecimal.c
	* resolv/tst-resolv-search.c, support/tst-support-namespace.c:
	Include netinet/in.h.
	* support/resolv_test.h: Include stdint.h, not sys/cdefs.h.

	* scripts/check-obsolete-constructs.py (HEADER_ALLOWED_INCLUDES):
	Update.
Diffstat (limited to 'sysdeps/unix/sysv/linux/alpha/sys/ucontext.h')
0 files changed, 0 insertions, 0 deletions