From: Zack Weinberg Date: Thu, 6 Jun 2019 13:49:54 +0000 (-0400) Subject: Don’t include sys/socket.h from public headers. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=94ab7b6b7f5b7f424554e325c20f60f706efc207;p=thirdparty%2Fglibc.git Don’t include sys/socket.h from public headers. No standard public header is required to include sys/socket.h, although some are allowed to. Several public headers need the definitions of socklen_t, struct sockaddr, and/or struct sockaddr_storage, but nothing else from sys/socket.h. We already have a single-type header for socklen_t, so this patch adds single-type headers for struct sockaddr and struct sockaddr_storage. The definition of struct sockaddr_storage is subtly different on Linux than on the Hurd; in order to not need two copies of bits/types/struct_sockaddr_storage.h, bits/sockaddr.h is now responsible for defining __ss_aligntype if ‘unsigned long int’ is not the correct definition. I also added a single-type header for struct linger, even though only sys/socket.h is expected to define that, just because all three copies of bits/socket.h were defining it exactly the same way. There would also be a case for defining it directly in sys/socket.h but this seemed tidier. I did *not* create single-type headers for struct msghdr and struct cmsghdr, because those and their helper macros are not consistent among the three copies of bits/socket.h, and, again, only sys/socket.h is expected to define them. The large number of .c files that add an `#include ` 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. --- diff --git a/bits/socket.h b/bits/socket.h index c844429ab85..fb30f9dac4a 100644 --- a/bits/socket.h +++ b/bits/socket.h @@ -23,10 +23,6 @@ # error "Never include directly; use instead." #endif -#include -#include -#include -#include /* Types of sockets. */ enum __socket_type @@ -137,34 +133,6 @@ enum __socket_type /* Maximum queue length specifiable by listen. */ #define SOMAXCONN 128 /* 5 on the origional 4.4 BSD. */ -/* Get the definition of the macro to define the common sockaddr members. */ -#include - -/* Structure describing a generic socket address. */ -struct sockaddr - { - __SOCKADDR_COMMON (sa_); /* Common data: address family and length. */ - char sa_data[14]; /* Address data. */ - }; - - -/* Structure large enough to hold any socket address (with the historical - exception of AF_UNIX). */ -#if __WORDSIZE == 64 -# define __ss_aligntype __uint64_t -#else -# define __ss_aligntype __uint32_t -#endif -#define _SS_PADSIZE \ - (_SS_SIZE - __SOCKADDR_COMMON_SIZE - sizeof (__ss_aligntype)) - -struct sockaddr_storage - { - __SOCKADDR_COMMON (ss_); /* Address family, etc. */ - char __ss_padding[_SS_PADSIZE]; - __ss_aligntype __ss_align; /* Force desired alignment. */ - }; - /* Bits in the FLAGS argument to `send', `recv', et al. */ enum @@ -347,11 +315,4 @@ enum #define SO_TYPE SO_TYPE }; -/* Structure used to manipulate the SO_LINGER option. */ -struct linger - { - int l_onoff; /* Nonzero to linger on close. */ - int l_linger; /* Time to linger. */ - }; - #endif /* bits/socket.h */ diff --git a/include/bits/types/struct_linger.h b/include/bits/types/struct_linger.h new file mode 100644 index 00000000000..55b2f20dd72 --- /dev/null +++ b/include/bits/types/struct_linger.h @@ -0,0 +1 @@ +#include diff --git a/include/bits/types/struct_sockaddr.h b/include/bits/types/struct_sockaddr.h new file mode 100644 index 00000000000..641fbcd56d1 --- /dev/null +++ b/include/bits/types/struct_sockaddr.h @@ -0,0 +1 @@ +#include diff --git a/include/bits/types/struct_sockaddr_storage.h b/include/bits/types/struct_sockaddr_storage.h new file mode 100644 index 00000000000..68f3171f0c1 --- /dev/null +++ b/include/bits/types/struct_sockaddr_storage.h @@ -0,0 +1 @@ +#include diff --git a/include/ifaddrs.h b/include/ifaddrs.h index 416118f1b38..bea810b1612 100644 --- a/include/ifaddrs.h +++ b/include/ifaddrs.h @@ -3,6 +3,7 @@ # ifndef _ISOMAC +#include #include #include diff --git a/include/netdb.h b/include/netdb.h index e230b1f4fc7..7853769ebe9 100644 --- a/include/netdb.h +++ b/include/netdb.h @@ -39,21 +39,21 @@ extern int __old_gethostent_r (struct hostent *__restrict __result_buf, int *__restrict __h_errnop); extern int __gethostbyaddr_r (const void *__restrict __addr, - socklen_t __len, int __type, + __socklen_t __len, int __type, struct hostent *__restrict __result_buf, char *__restrict __buf, size_t __buflen, struct hostent **__restrict __result, int *__restrict __h_errnop) attribute_hidden; extern int __old_gethostbyaddr_r (const void *__restrict __addr, - socklen_t __len, int __type, + __socklen_t __len, int __type, struct hostent *__restrict __result_buf, char *__restrict __buf, size_t __buflen, struct hostent **__restrict __result, int *__restrict __h_errnop); extern int __gethostbyaddr2_r (const void *__restrict __addr, - socklen_t __len, int __type, + __socklen_t __len, int __type, struct hostent *__restrict __result_buf, char *__restrict __buf, size_t __buflen, struct hostent **__restrict __result, @@ -246,7 +246,7 @@ extern enum nss_status _nss_ ## service ## _gethostbyname_r \ (const char *name, struct hostent *host, char *buffer, \ size_t buflen, int *errnop, int *h_errnop); \ extern enum nss_status _nss_ ## service ## _gethostbyaddr_r \ - (const void *addr, socklen_t addrlen, int af, \ + (const void *addr, __socklen_t addrlen, int af, \ struct hostent *host, char *buffer, size_t buflen, \ int *errnop, int *h_errnop); \ extern enum nss_status _nss_ ## service ## _setservent (int); \ diff --git a/include/sys/socketvar.h b/include/sys/socketvar.h new file mode 100644 index 00000000000..658fd10b85d --- /dev/null +++ b/include/sys/socketvar.h @@ -0,0 +1 @@ +#include diff --git a/inet/arpa/inet.h b/inet/arpa/inet.h index 08837249fad..2625d2f2e64 100644 --- a/inet/arpa/inet.h +++ b/inet/arpa/inet.h @@ -20,6 +20,7 @@ #include #include /* To define `struct in_addr'. */ +#include #include __BEGIN_DECLS diff --git a/inet/check_pf.c b/inet/check_pf.c index 323bd842f43..8c3438eef37 100644 --- a/inet/check_pf.c +++ b/inet/check_pf.c @@ -19,6 +19,7 @@ #include #include #include +#include void attribute_hidden diff --git a/inet/gethstbynm.c b/inet/gethstbynm.c index e5eb4c9cebb..2cbd31974d2 100644 --- a/inet/gethstbynm.c +++ b/inet/gethstbynm.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include diff --git a/inet/gethstbynm_r.c b/inet/gethstbynm_r.c index 9e4b9e2e96e..3c3d4cda594 100644 --- a/inet/gethstbynm_r.c +++ b/inet/gethstbynm_r.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include diff --git a/inet/getsourcefilter.c b/inet/getsourcefilter.c index c2e67b0fa5d..5b1beaf00ab 100644 --- a/inet/getsourcefilter.c +++ b/inet/getsourcefilter.c @@ -20,6 +20,7 @@ #include #include #include +#include int getsourcefilter (int s, uint32_t interface, const struct sockaddr *group, diff --git a/inet/ifaddrs.h b/inet/ifaddrs.h index ffcd66d97c4..4868942dcd9 100644 --- a/inet/ifaddrs.h +++ b/inet/ifaddrs.h @@ -20,7 +20,7 @@ #define _IFADDRS_H 1 #include -#include +#include __BEGIN_DECLS diff --git a/inet/inet6_opt.c b/inet/inet6_opt.c index 715f6f83018..bc55dc8da9d 100644 --- a/inet/inet6_opt.c +++ b/inet/inet6_opt.c @@ -17,6 +17,7 @@ . */ #include +#include #include #include diff --git a/inet/inet6_option.c b/inet/inet6_option.c index 48b2aed1ced..bdbce502dec 100644 --- a/inet/inet6_option.c +++ b/inet/inet6_option.c @@ -18,6 +18,7 @@ #include #include +#include #include #include #include diff --git a/inet/inet6_rth.c b/inet/inet6_rth.c index 09ac6b5cfb6..d53c5a5751b 100644 --- a/inet/inet6_rth.c +++ b/inet/inet6_rth.c @@ -17,6 +17,7 @@ . */ #include +#include #include #include diff --git a/inet/netinet/in.h b/inet/netinet/in.h index 993cfe6ae8c..81568819a47 100644 --- a/inet/netinet/in.h +++ b/inet/netinet/in.h @@ -19,10 +19,11 @@ #define _NETINET_IN_H 1 #include -#include -#include #include - +#include +#include +#include +#include __BEGIN_DECLS @@ -568,27 +569,27 @@ extern int inet6_option_find (const struct cmsghdr *__cmsg, /* Hop-by-Hop and Destination Options Processing (RFC 3542). */ -extern int inet6_opt_init (void *__extbuf, socklen_t __extlen) __THROW; -extern int inet6_opt_append (void *__extbuf, socklen_t __extlen, int __offset, - uint8_t __type, socklen_t __len, uint8_t __align, +extern int inet6_opt_init (void *__extbuf, __socklen_t __extlen) __THROW; +extern int inet6_opt_append (void *__extbuf, __socklen_t __extlen, int __offset, + uint8_t __type, __socklen_t __len, uint8_t __align, void **__databufp) __THROW; -extern int inet6_opt_finish (void *__extbuf, socklen_t __extlen, int __offset) +extern int inet6_opt_finish (void *__extbuf, __socklen_t __extlen, int __offset) __THROW; extern int inet6_opt_set_val (void *__databuf, int __offset, void *__val, - socklen_t __vallen) __THROW; -extern int inet6_opt_next (void *__extbuf, socklen_t __extlen, int __offset, - uint8_t *__typep, socklen_t *__lenp, + __socklen_t __vallen) __THROW; +extern int inet6_opt_next (void *__extbuf, __socklen_t __extlen, int __offset, + uint8_t *__typep, __socklen_t *__lenp, void **__databufp) __THROW; -extern int inet6_opt_find (void *__extbuf, socklen_t __extlen, int __offset, - uint8_t __type, socklen_t *__lenp, +extern int inet6_opt_find (void *__extbuf, __socklen_t __extlen, int __offset, + uint8_t __type, __socklen_t *__lenp, void **__databufp) __THROW; extern int inet6_opt_get_val (void *__databuf, int __offset, void *__val, - socklen_t __vallen) __THROW; + __socklen_t __vallen) __THROW; /* Routing Header Option (RFC 3542). */ -extern socklen_t inet6_rth_space (int __type, int __segments) __THROW; -extern void *inet6_rth_init (void *__bp, socklen_t __bp_len, int __type, +extern __socklen_t inet6_rth_space (int __type, int __segments) __THROW; +extern void *inet6_rth_init (void *__bp, __socklen_t __bp_len, int __type, int __segments) __THROW; extern int inet6_rth_add (void *__bp, const struct in6_addr *__addr) __THROW; extern int inet6_rth_reverse (const void *__in, void *__out) __THROW; @@ -616,14 +617,14 @@ extern int setipv4sourcefilter (int __s, struct in_addr __interface_addr, /* Get source filter. */ extern int getsourcefilter (int __s, uint32_t __interface_addr, const struct sockaddr *__group, - socklen_t __grouplen, uint32_t *__fmode, + __socklen_t __grouplen, uint32_t *__fmode, uint32_t *__numsrc, struct sockaddr_storage *__slist) __THROW; /* Set source filter. */ extern int setsourcefilter (int __s, uint32_t __interface_addr, const struct sockaddr *__group, - socklen_t __grouplen, uint32_t __fmode, + __socklen_t __grouplen, uint32_t __fmode, uint32_t __numsrc, const struct sockaddr_storage *__slist) __THROW; #endif /* use GNU */ diff --git a/inet/netinet/tcp.h b/inet/netinet/tcp.h index 243b55a24c5..f6aa166c5a1 100644 --- a/inet/netinet/tcp.h +++ b/inet/netinet/tcp.h @@ -86,11 +86,11 @@ #define TCP_REPAIR_OFF_NO_WP -1 #ifdef __USE_MISC -# include # include -# include +# include +# include -typedef uint32_t tcp_seq; +typedef __uint32_t tcp_seq; /* * TCP header. * Per RFC 793, September, 1981. @@ -101,61 +101,61 @@ struct tcphdr { struct { - uint16_t th_sport; /* source port */ - uint16_t th_dport; /* destination port */ + __uint16_t th_sport; /* source port */ + __uint16_t th_dport; /* destination port */ tcp_seq th_seq; /* sequence number */ tcp_seq th_ack; /* acknowledgement number */ # if __BYTE_ORDER == __LITTLE_ENDIAN - uint8_t th_x2:4; /* (unused) */ - uint8_t th_off:4; /* data offset */ + __uint8_t th_x2:4; /* (unused) */ + __uint8_t th_off:4; /* data offset */ # endif # if __BYTE_ORDER == __BIG_ENDIAN - uint8_t th_off:4; /* data offset */ - uint8_t th_x2:4; /* (unused) */ + __uint8_t th_off:4; /* data offset */ + __uint8_t th_x2:4; /* (unused) */ # endif - uint8_t th_flags; + __uint8_t th_flags; # define TH_FIN 0x01 # define TH_SYN 0x02 # define TH_RST 0x04 # define TH_PUSH 0x08 # define TH_ACK 0x10 # define TH_URG 0x20 - uint16_t th_win; /* window */ - uint16_t th_sum; /* checksum */ - uint16_t th_urp; /* urgent pointer */ + __uint16_t th_win; /* window */ + __uint16_t th_sum; /* checksum */ + __uint16_t th_urp; /* urgent pointer */ }; struct { - uint16_t source; - uint16_t dest; - uint32_t seq; - uint32_t ack_seq; + __uint16_t source; + __uint16_t dest; + __uint32_t seq; + __uint32_t ack_seq; # if __BYTE_ORDER == __LITTLE_ENDIAN - uint16_t res1:4; - uint16_t doff:4; - uint16_t fin:1; - uint16_t syn:1; - uint16_t rst:1; - uint16_t psh:1; - uint16_t ack:1; - uint16_t urg:1; - uint16_t res2:2; + __uint16_t res1:4; + __uint16_t doff:4; + __uint16_t fin:1; + __uint16_t syn:1; + __uint16_t rst:1; + __uint16_t psh:1; + __uint16_t ack:1; + __uint16_t urg:1; + __uint16_t res2:2; # elif __BYTE_ORDER == __BIG_ENDIAN - uint16_t doff:4; - uint16_t res1:4; - uint16_t res2:2; - uint16_t urg:1; - uint16_t ack:1; - uint16_t psh:1; - uint16_t rst:1; - uint16_t syn:1; - uint16_t fin:1; + __uint16_t doff:4; + __uint16_t res1:4; + __uint16_t res2:2; + __uint16_t urg:1; + __uint16_t ack:1; + __uint16_t psh:1; + __uint16_t rst:1; + __uint16_t syn:1; + __uint16_t fin:1; # else # error "Adjust your defines" # endif - uint16_t window; - uint16_t check; - uint16_t urg_ptr; + __uint16_t window; + __uint16_t check; + __uint16_t urg_ptr; }; }; }; @@ -225,45 +225,45 @@ enum tcp_ca_state struct tcp_info { - uint8_t tcpi_state; - uint8_t tcpi_ca_state; - uint8_t tcpi_retransmits; - uint8_t tcpi_probes; - uint8_t tcpi_backoff; - uint8_t tcpi_options; - uint8_t tcpi_snd_wscale : 4, tcpi_rcv_wscale : 4; - - uint32_t tcpi_rto; - uint32_t tcpi_ato; - uint32_t tcpi_snd_mss; - uint32_t tcpi_rcv_mss; - - uint32_t tcpi_unacked; - uint32_t tcpi_sacked; - uint32_t tcpi_lost; - uint32_t tcpi_retrans; - uint32_t tcpi_fackets; + __uint8_t tcpi_state; + __uint8_t tcpi_ca_state; + __uint8_t tcpi_retransmits; + __uint8_t tcpi_probes; + __uint8_t tcpi_backoff; + __uint8_t tcpi_options; + __uint8_t tcpi_snd_wscale : 4, tcpi_rcv_wscale : 4; + + __uint32_t tcpi_rto; + __uint32_t tcpi_ato; + __uint32_t tcpi_snd_mss; + __uint32_t tcpi_rcv_mss; + + __uint32_t tcpi_unacked; + __uint32_t tcpi_sacked; + __uint32_t tcpi_lost; + __uint32_t tcpi_retrans; + __uint32_t tcpi_fackets; /* Times. */ - uint32_t tcpi_last_data_sent; - uint32_t tcpi_last_ack_sent; /* Not remembered, sorry. */ - uint32_t tcpi_last_data_recv; - uint32_t tcpi_last_ack_recv; + __uint32_t tcpi_last_data_sent; + __uint32_t tcpi_last_ack_sent; /* Not remembered, sorry. */ + __uint32_t tcpi_last_data_recv; + __uint32_t tcpi_last_ack_recv; /* Metrics. */ - uint32_t tcpi_pmtu; - uint32_t tcpi_rcv_ssthresh; - uint32_t tcpi_rtt; - uint32_t tcpi_rttvar; - uint32_t tcpi_snd_ssthresh; - uint32_t tcpi_snd_cwnd; - uint32_t tcpi_advmss; - uint32_t tcpi_reordering; - - uint32_t tcpi_rcv_rtt; - uint32_t tcpi_rcv_space; - - uint32_t tcpi_total_retrans; + __uint32_t tcpi_pmtu; + __uint32_t tcpi_rcv_ssthresh; + __uint32_t tcpi_rtt; + __uint32_t tcpi_rttvar; + __uint32_t tcpi_snd_ssthresh; + __uint32_t tcpi_snd_cwnd; + __uint32_t tcpi_advmss; + __uint32_t tcpi_reordering; + + __uint32_t tcpi_rcv_rtt; + __uint32_t tcpi_rcv_space; + + __uint32_t tcpi_total_retrans; }; @@ -276,18 +276,18 @@ struct tcp_info struct tcp_md5sig { struct sockaddr_storage tcpm_addr; /* Address associated. */ - uint8_t tcpm_flags; /* Extension flags. */ - uint8_t tcpm_prefixlen; /* Address prefix. */ - uint16_t tcpm_keylen; /* Key length. */ - uint32_t __tcpm_pad; /* Zero. */ - uint8_t tcpm_key[TCP_MD5SIG_MAXKEYLEN]; /* Key (binary). */ + __uint8_t tcpm_flags; /* Extension flags. */ + __uint8_t tcpm_prefixlen; /* Address prefix. */ + __uint16_t tcpm_keylen; /* Key length. */ + __uint32_t __tcpm_pad; /* Zero. */ + __uint8_t tcpm_key[TCP_MD5SIG_MAXKEYLEN]; /* Key (binary). */ }; /* For socket repair options. */ struct tcp_repair_opt { - uint32_t opt_code; - uint32_t opt_val; + __uint32_t opt_code; + __uint32_t opt_val; }; /* Queue to repair, for TCP_REPAIR_QUEUE. */ @@ -318,30 +318,30 @@ enum struct tcp_cookie_transactions { - uint16_t tcpct_flags; - uint8_t __tcpct_pad1; - uint8_t tcpct_cookie_desired; - uint16_t tcpct_s_data_desired; - uint16_t tcpct_used; - uint8_t tcpct_value[TCP_MSS_DEFAULT]; + __uint16_t tcpct_flags; + __uint8_t __tcpct_pad1; + __uint8_t tcpct_cookie_desired; + __uint16_t tcpct_s_data_desired; + __uint16_t tcpct_used; + __uint8_t tcpct_value[TCP_MSS_DEFAULT]; }; /* For use with TCP_REPAIR_WINDOW. */ struct tcp_repair_window { - uint32_t snd_wl1; - uint32_t snd_wnd; - uint32_t max_window; - uint32_t rcv_wnd; - uint32_t rcv_wup; + __uint32_t snd_wl1; + __uint32_t snd_wnd; + __uint32_t max_window; + __uint32_t rcv_wnd; + __uint32_t rcv_wup; }; /* For use with TCP_ZEROCOPY_RECEIVE. */ struct tcp_zerocopy_receive { - uint64_t address; /* In: address of mapping. */ - uint32_t length; /* In/out: number of bytes to map/mapped. */ - uint32_t recv_skip_hint; /* Out: amount of bytes to skip. */ + __uint64_t address; /* In: address of mapping. */ + __uint32_t length; /* In/out: number of bytes to map/mapped. */ + __uint32_t recv_skip_hint; /* Out: amount of bytes to skip. */ }; #endif /* Misc. */ diff --git a/inet/protocols/routed.h b/inet/protocols/routed.h index adb1767dca1..694c4364455 100644 --- a/inet/protocols/routed.h +++ b/inet/protocols/routed.h @@ -32,7 +32,9 @@ #ifndef _PROTOCOLS_ROUTED_H #define _PROTOCOLS_ROUTED_H 1 -#include +#include +#include + /* * Routing Information Protocol * diff --git a/inet/setsourcefilter.c b/inet/setsourcefilter.c index f0975de724a..9ffd42a9e70 100644 --- a/inet/setsourcefilter.c +++ b/inet/setsourcefilter.c @@ -20,7 +20,7 @@ #include #include #include - +#include int setsourcefilter (int s, uint32_t interface, const struct sockaddr *group, diff --git a/inet/test-ifaddrs.c b/inet/test-ifaddrs.c index b7027c2b103..751efc55b0a 100644 --- a/inet/test-ifaddrs.c +++ b/inet/test-ifaddrs.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include diff --git a/inet/test-inet6_opt.c b/inet/test-inet6_opt.c index a7ebf006c6e..e10680c498b 100644 --- a/inet/test-inet6_opt.c +++ b/inet/test-inet6_opt.c @@ -1,3 +1,4 @@ +#include #include #include #include diff --git a/inet/tst-inet6_rth.c b/inet/tst-inet6_rth.c index 549d717c7de..abb85cdf261 100644 --- a/inet/tst-inet6_rth.c +++ b/inet/tst-inet6_rth.c @@ -1,5 +1,6 @@ #include #include +#include #include #include diff --git a/inet/tst-inet6_scopeid_pton.c b/inet/tst-inet6_scopeid_pton.c index 37ec20b1e23..4c25d23cddf 100644 --- a/inet/tst-inet6_scopeid_pton.c +++ b/inet/tst-inet6_scopeid_pton.c @@ -16,6 +16,7 @@ License along with the GNU C Library; if not, see . */ +#include #include #include #include diff --git a/nis/nss_nis/nis-hosts.c b/nis/nss_nis/nis-hosts.c index 2d08076382b..6355663d498 100644 --- a/nis/nss_nis/nis-hosts.c +++ b/nis/nss_nis/nis-hosts.c @@ -25,6 +25,7 @@ #include #undef _nss_nis_endhostent #include +#include #include #include #include diff --git a/nis/nss_nisplus/nisplus-hosts.c b/nis/nss_nisplus/nisplus-hosts.c index 1e66e4ff923..b65c27f014b 100644 --- a/nis/nss_nisplus/nisplus-hosts.c +++ b/nis/nss_nisplus/nisplus-hosts.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include diff --git a/nscd/aicache.c b/nscd/aicache.c index 46db40fceb0..8f7e72e65be 100644 --- a/nscd/aicache.c +++ b/nscd/aicache.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include diff --git a/nscd/cache.c b/nscd/cache.c index 0c4dfc0dcf0..41403c990df 100644 --- a/nscd/cache.c +++ b/nscd/cache.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include diff --git a/nscd/hstcache.c b/nscd/hstcache.c index 9ade6c1582a..d9020f76abe 100644 --- a/nscd/hstcache.c +++ b/nscd/hstcache.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include diff --git a/nscd/initgrcache.c b/nscd/initgrcache.c index c37b920fae9..ee5e1e21333 100644 --- a/nscd/initgrcache.c +++ b/nscd/initgrcache.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include diff --git a/nscd/netgroupcache.c b/nscd/netgroupcache.c index dacd52315aa..63e903703a3 100644 --- a/nscd/netgroupcache.c +++ b/nscd/netgroupcache.c @@ -25,6 +25,7 @@ #include #include #include +#include #include "../inet/netgroup.h" #include "nscd.h" diff --git a/nscd/nscd_gethst_r.c b/nscd/nscd_gethst_r.c index f08d1d149ae..33e5c7e6198 100644 --- a/nscd/nscd_gethst_r.c +++ b/nscd/nscd_gethst_r.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include diff --git a/nscd/servicescache.c b/nscd/servicescache.c index cb434ae1ece..1dbe57ba6cd 100644 --- a/nscd/servicescache.c +++ b/nscd/servicescache.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include diff --git a/nss/digits_dots.c b/nss/digits_dots.c index 91b587b5165..3dff017b794 100644 --- a/nss/digits_dots.c +++ b/nss/digits_dots.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include "nsswitch.h" diff --git a/nss/nss_files/files-hosts.c b/nss/nss_files/files-hosts.c index 92c5d9728d9..cbd7f709dac 100644 --- a/nss/nss_files/files-hosts.c +++ b/nss/nss_files/files-hosts.c @@ -17,6 +17,7 @@ . */ #include +#include #include #include #include diff --git a/nss/nss_files/files-network.c b/nss/nss_files/files-network.c index 6530d51c3b8..819d4aefbf7 100644 --- a/nss/nss_files/files-network.c +++ b/nss/nss_files/files-network.c @@ -16,6 +16,7 @@ License along with the GNU C Library; if not, see . */ +#include #include #include #include diff --git a/nss/tst-nss-files-hosts-erange.c b/nss/tst-nss-files-hosts-erange.c index 9491fdf24dc..d5db1df737f 100644 --- a/nss/tst-nss-files-hosts-erange.c +++ b/nss/tst-nss-files-hosts-erange.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include diff --git a/nss/tst-nss-files-hosts-getent.c b/nss/tst-nss-files-hosts-getent.c index 02723d9cc0d..4860d31ee7c 100644 --- a/nss/tst-nss-files-hosts-getent.c +++ b/nss/tst-nss-files-hosts-getent.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include diff --git a/nss/tst-nss-files-hosts-multi.c b/nss/tst-nss-files-hosts-multi.c index 1863fff7cec..10f6228349c 100644 --- a/nss/tst-nss-files-hosts-multi.c +++ b/nss/tst-nss-files-hosts-multi.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include diff --git a/posix/tst-getaddrinfo3.c b/posix/tst-getaddrinfo3.c index 5077f311fcb..1d1919971a5 100644 --- a/posix/tst-getaddrinfo3.c +++ b/posix/tst-getaddrinfo3.c @@ -2,6 +2,7 @@ #include #include #include +#include #include #include diff --git a/resolv/netdb.h b/resolv/netdb.h index 575e416dac1..91277fcb868 100644 --- a/resolv/netdb.h +++ b/resolv/netdb.h @@ -25,6 +25,7 @@ #include #include +#include #include #ifdef __USE_MISC /* This is necessary to make this include file properly replace the diff --git a/resolv/nss_dns/dns-network.c b/resolv/nss_dns/dns-network.c index 906a3a6b063..06f187f5ffa 100644 --- a/resolv/nss_dns/dns-network.c +++ b/resolv/nss_dns/dns-network.c @@ -65,6 +65,7 @@ #include #include "nsswitch.h" +#include #include #include #include diff --git a/resolv/resolv_conf.c b/resolv/resolv_conf.c index 08c50ef19eb..316d27fc960 100644 --- a/resolv/resolv_conf.c +++ b/resolv/resolv_conf.c @@ -23,6 +23,7 @@ #include #include #include +#include #include /* _res._u._ext.__glibc_extension_index is used as an index into a diff --git a/resolv/tst-bug18665-tcp.c b/resolv/tst-bug18665-tcp.c index 37170675c2c..539b5eb0d4e 100644 --- a/resolv/tst-bug18665-tcp.c +++ b/resolv/tst-bug18665-tcp.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include diff --git a/resolv/tst-bug18665.c b/resolv/tst-bug18665.c index 37e28284656..c1e29cfec82 100644 --- a/resolv/tst-bug18665.c +++ b/resolv/tst-bug18665.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include diff --git a/resolv/tst-inet_ntop.c b/resolv/tst-inet_ntop.c index f0de06306c2..728fd25d7f1 100644 --- a/resolv/tst-inet_ntop.c +++ b/resolv/tst-inet_ntop.c @@ -3,6 +3,7 @@ #include #include #include +#include static int do_test (void) diff --git a/resolv/tst-inet_pton.c b/resolv/tst-inet_pton.c index 71c679458a7..7092143b071 100644 --- a/resolv/tst-inet_pton.c +++ b/resolv/tst-inet_pton.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include diff --git a/resolv/tst-resolv-ai_idn-common.c b/resolv/tst-resolv-ai_idn-common.c index 9e8ed7611c6..ff6ff13bac2 100644 --- a/resolv/tst-resolv-ai_idn-common.c +++ b/resolv/tst-resolv-ai_idn-common.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include diff --git a/resolv/tst-resolv-basic.c b/resolv/tst-resolv-basic.c index 2ad9ee382a7..deb1e3c5842 100644 --- a/resolv/tst-resolv-basic.c +++ b/resolv/tst-resolv-basic.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include diff --git a/resolv/tst-resolv-binary.c b/resolv/tst-resolv-binary.c index 90a94a50feb..c7ad3bd57da 100644 --- a/resolv/tst-resolv-binary.c +++ b/resolv/tst-resolv-binary.c @@ -18,6 +18,7 @@ #include #include +#include #include #include diff --git a/resolv/tst-resolv-edns.c b/resolv/tst-resolv-edns.c index 4fbb3a056ce..597520398c9 100644 --- a/resolv/tst-resolv-edns.c +++ b/resolv/tst-resolv-edns.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include diff --git a/resolv/tst-resolv-network.c b/resolv/tst-resolv-network.c index a91699c7112..2bb5266829f 100644 --- a/resolv/tst-resolv-network.c +++ b/resolv/tst-resolv-network.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include diff --git a/resolv/tst-resolv-nondecimal.c b/resolv/tst-resolv-nondecimal.c index 5d161a452eb..8b1b162d1b5 100644 --- a/resolv/tst-resolv-nondecimal.c +++ b/resolv/tst-resolv-nondecimal.c @@ -18,6 +18,7 @@ #include #include +#include #include #include #include diff --git a/resolv/tst-resolv-search.c b/resolv/tst-resolv-search.c index 6379147a278..545a0a2545f 100644 --- a/resolv/tst-resolv-search.c +++ b/resolv/tst-resolv-search.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include diff --git a/resolv/tst-resolv-threads.c b/resolv/tst-resolv-threads.c index a3a874ef4b1..0b4c198cc7f 100644 --- a/resolv/tst-resolv-threads.c +++ b/resolv/tst-resolv-threads.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include diff --git a/resolv/tst-resolv-trailing.c b/resolv/tst-resolv-trailing.c index f27e110afbf..b2ec1dffa08 100644 --- a/resolv/tst-resolv-trailing.c +++ b/resolv/tst-resolv-trailing.c @@ -18,6 +18,7 @@ #include #include +#include #include #include #include diff --git a/scripts/check-obsolete-constructs.py b/scripts/check-obsolete-constructs.py index 5e528bcc1a2..6004cede759 100755 --- a/scripts/check-obsolete-constructs.py +++ b/scripts/check-obsolete-constructs.py @@ -542,9 +542,6 @@ HEADER_ALLOWED_INCLUDES = { # arpa/inet.h -> netinet/in.h "netdb.h": [ "netinet/in.h", "rpc/netdb.h" ], "arpa/inet.h": [ "netinet/in.h" ], - "net/if.h": [ "sys/socket.h" ], - "netinet/in.h": [ "sys/socket.h" ], - "netinet/tcp.h": [ "sys/socket.h" ], # Nonstandardized top-level headers "argp.h": [ "ctype.h", "errno.h", "getopt.h", @@ -580,7 +577,6 @@ HEADER_ALLOWED_INCLUDES = { "sys/procfs.h": [ "sys/ucontext.h", "sys/user.h" ], "sys/ptrace.h": [ "sys/ucontext.h" ], "sys/raw.h": [ "sys/ioctl.h" ], - "sys/socketvar.h": [ "sys/socket.h" ], "sys/timerfd.h": [ "time.h" ], "sys/ttychars.h": [ "sys/ttydefaults.h" ], "sys/ucontext.h": [ "sys/procfs.h" ], @@ -598,6 +594,7 @@ HEADER_ALLOWED_INCLUDES = { "sys/fcntl.h": [ "fcntl.h" ], "sys/poll.h": [ "poll.h" ], "sys/signal.h": [ "signal.h" ], + "sys/socketvar.h": [ "sys/socket.h" ], "sys/syslog.h": [ "syslog.h" ], "sys/termios.h": [ "termios.h" ], "sys/unistd.h": [ "unistd.h" ], @@ -606,18 +603,16 @@ HEADER_ALLOWED_INCLUDES = { "wait.h": [ "sys/wait.h" ], # Nonstandardized networking headers - "ifaddrs.h": [ "sys/socket.h" ], "resolv.h": [ "arpa/nameser.h", "netinet/in.h" ], "arpa/nameser.h": [ "arpa/nameser_compat.h" ], "net/ethernet.h": [ "net/if_ether.h" ], - "net/if_arp.h": [ "sys/socket.h" ], "net/if_ppp.h": [ "net/if.h", "net/ppp_defs.h", "sys/ioctl.h" ], "net/if_shaper.h": [ "net/if.h", "sys/ioctl.h" ], - "net/route.h": [ "netinet/in.h", "sys/socket.h" ], - "netatalk/at.h": [ "sys/socket.h", "sys/ioctl.h" ], + "net/route.h": [ "netinet/in.h" ], + "netatalk/at.h": [ "sys/ioctl.h" ], "netinet/ether.h": [ "netinet/if_ether.h" ], "netinet/icmp6.h": [ "netinet/in.h" ], @@ -629,7 +624,6 @@ HEADER_ALLOWED_INCLUDES = { "netrom/netrom.h": [ "netax25/ax25.h" ], "netrose/rose.h": [ "netax25/ax25.h" ], - "protocols/routed.h": [ "sys/socket.h" ], "protocols/rwhod.h": [ "paths.h" ], # Internal headers diff --git a/socket/Makefile b/socket/Makefile index 125c042cab7..c63754812c8 100644 --- a/socket/Makefile +++ b/socket/Makefile @@ -22,9 +22,11 @@ subdir := socket include ../Makeconfig -headers := sys/socket.h sys/un.h bits/sockaddr.h bits/socket.h \ - bits/socket2.h bits/types/struct_osockaddr.h \ - sys/socketvar.h net/if.h +headers := net/if.h sys/socket.h sys/socketvar.h sys/un.h \ + bits/sockaddr.h bits/socket.h bits/socket2.h \ + bits/types/struct_linger.h bits/types/struct_osockaddr.h \ + bits/types/struct_sockaddr.h \ + bits/types/struct_sockaddr_storage.h routines := accept bind connect getpeername getsockname getsockopt \ listen recv recvfrom recvmsg send sendmsg sendto \ diff --git a/socket/bits/types/struct_linger.h b/socket/bits/types/struct_linger.h new file mode 100644 index 00000000000..58708e02045 --- /dev/null +++ b/socket/bits/types/struct_linger.h @@ -0,0 +1,11 @@ +#ifndef _BITS_TYPES_STRUCT_LINGER_H +#define _BITS_TYPES_STRUCT_LINGER_H 1 + +/* Structure used to manipulate the SO_LINGER option. */ +struct linger + { + int l_onoff; /* Nonzero to linger on close. */ + int l_linger; /* Time to linger. */ + }; + +#endif diff --git a/socket/bits/types/struct_sockaddr.h b/socket/bits/types/struct_sockaddr.h new file mode 100644 index 00000000000..86100142cae --- /dev/null +++ b/socket/bits/types/struct_sockaddr.h @@ -0,0 +1,15 @@ +#ifndef __struct_sockaddr_defined +#define __struct_sockaddr_defined 1 + +#include + +/* Structure describing a generic socket address. For historical + reasons this type is smaller than many address families' concrete + socket addresses. You may want struct sockaddr_storage instead. */ +struct sockaddr + { + __SOCKADDR_COMMON (sa_); /* Common data: family and perhaps length. */ + char sa_data[14]; /* Address data. */ + }; + +#endif diff --git a/socket/bits/types/struct_sockaddr_storage.h b/socket/bits/types/struct_sockaddr_storage.h new file mode 100644 index 00000000000..47e05139391 --- /dev/null +++ b/socket/bits/types/struct_sockaddr_storage.h @@ -0,0 +1,21 @@ +#ifndef __struct_sockaddr_storage_defined +#define __struct_sockaddr_storage_defined 1 + +#include + +/* Structure large enough to hold any socket address (with the historical + exception of AF_UNIX). */ +#ifndef __ss_aligntype +# define __ss_aligntype unsigned long int +#endif +#define _SS_PADSIZE \ + (_SS_SIZE - __SOCKADDR_COMMON_SIZE - sizeof (__ss_aligntype)) + +struct sockaddr_storage + { + __SOCKADDR_COMMON (ss_); /* Address family, etc. */ + char __ss_padding[_SS_PADSIZE]; + __ss_aligntype __ss_align; /* Force desired alignment. */ + }; + +#endif /* bits/types/struct_sockaddr_storage.h */ diff --git a/socket/net/if.h b/socket/net/if.h index 8431e000a2f..852fb8b04bb 100644 --- a/socket/net/if.h +++ b/socket/net/if.h @@ -32,7 +32,7 @@ struct if_nameindex #ifdef __USE_MISC -# include /* for struct sockaddr */ +# include /* Standard interface flags. */ enum diff --git a/socket/sys/socket.h b/socket/sys/socket.h index 6a68164e395..0725fcb6d9e 100644 --- a/socket/sys/socket.h +++ b/socket/sys/socket.h @@ -28,11 +28,11 @@ __BEGIN_DECLS #include #include #include +#include -/* This operating system-specific header file defines the SOCK_*, PF_*, - AF_*, MSG_*, SOL_*, and SO_* constants, and the `struct sockaddr', - `struct msghdr', and `struct linger' types. */ -#include +#include +#include +#include #ifdef __USE_MISC # include @@ -42,6 +42,11 @@ __BEGIN_DECLS struct timespec; #endif +/* This operating system-specific header file defines the SOCK_*, PF_*, + AF_*, MSG_*, SOL_*, and SO_* constants, and the `struct msghdr' and + `struct cmsghdr' types. */ +#include + /* The following constants should be used for the second parameter of `shutdown'. */ enum diff --git a/sysdeps/generic/sys/socketvar.h b/socket/sys/socketvar.h similarity index 100% rename from sysdeps/generic/sys/socketvar.h rename to socket/sys/socketvar.h diff --git a/sunrpc/rpc_gethostbyname.c b/sunrpc/rpc_gethostbyname.c index e838d25341e..24bbaa5d0cb 100644 --- a/sunrpc/rpc_gethostbyname.c +++ b/sunrpc/rpc_gethostbyname.c @@ -18,6 +18,7 @@ #include #include +#include #include #include #include diff --git a/support/support_format_address_family.c b/support/support_format_address_family.c index 29c7834ebe0..9ab206669a1 100644 --- a/support/support_format_address_family.c +++ b/support/support_format_address_family.c @@ -18,6 +18,7 @@ #include +#include #include char * diff --git a/support/support_format_addrinfo.c b/support/support_format_addrinfo.c index fa7d6acefc6..c74aa53e7e7 100644 --- a/support/support_format_addrinfo.c +++ b/support/support_format_addrinfo.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include diff --git a/support/support_format_dns_packet.c b/support/support_format_dns_packet.c index 918e70808eb..8f599068834 100644 --- a/support/support_format_dns_packet.c +++ b/support/support_format_dns_packet.c @@ -18,6 +18,7 @@ #include +#include #include #include #include diff --git a/support/support_format_hostent.c b/support/support_format_hostent.c index 108cd35de61..5c90692caf2 100644 --- a/support/support_format_hostent.c +++ b/support/support_format_hostent.c @@ -18,6 +18,7 @@ #include +#include #include #include #include diff --git a/support/support_format_netent.c b/support/support_format_netent.c index 9eea21a4ac4..388f8c0006f 100644 --- a/support/support_format_netent.c +++ b/support/support_format_netent.c @@ -18,6 +18,7 @@ #include +#include #include #include #include diff --git a/sysdeps/mach/hurd/bits/socket.h b/sysdeps/mach/hurd/bits/socket.h index 828a8efbf22..56421de9520 100644 --- a/sysdeps/mach/hurd/bits/socket.h +++ b/sysdeps/mach/hurd/bits/socket.h @@ -25,11 +25,6 @@ #endif -#include -#include -#include -#include - /* Types of sockets. */ enum __socket_type { @@ -142,34 +137,6 @@ enum __socket_type /* Maximum queue length specifiable by listen. */ #define SOMAXCONN 128 /* 5 on the origional 4.4 BSD. */ -/* Get the definition of the macro to define the common sockaddr members. */ -#include - -/* Structure describing a generic socket address. */ -struct sockaddr - { - __SOCKADDR_COMMON (sa_); /* Common data: address family and length. */ - char sa_data[14]; /* Address data. */ - }; - - -/* Structure large enough to hold any socket address (with the historical - exception of AF_UNIX). */ -#if __WORDSIZE == 64 -# define __ss_aligntype __uint64_t -#else -# define __ss_aligntype __uint32_t -#endif -#define _SS_PADSIZE \ - (_SS_SIZE - __SOCKADDR_COMMON_SIZE - sizeof (__ss_aligntype)) - -struct sockaddr_storage - { - __SOCKADDR_COMMON (ss_); /* Address family, etc. */ - char __ss_padding[_SS_PADSIZE]; - __ss_aligntype __ss_align; /* Force desired alignment. */ - }; - /* Bits in the FLAGS argument to `send', `recv', et al. */ enum @@ -352,11 +319,4 @@ enum #define SO_TYPE SO_TYPE }; -/* Structure used to manipulate the SO_LINGER option. */ -struct linger - { - int l_onoff; /* Nonzero to linger on close. */ - int l_linger; /* Time to linger. */ - }; - #endif /* bits/socket.h */ diff --git a/sysdeps/mach/hurd/if_index.c b/sysdeps/mach/hurd/if_index.c index 32dceccdbf6..30b41ef3969 100644 --- a/sysdeps/mach/hurd/if_index.c +++ b/sysdeps/mach/hurd/if_index.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include diff --git a/sysdeps/mach/hurd/net/if_arp.h b/sysdeps/mach/hurd/net/if_arp.h index 86dd2ffc374..a7e81a9b066 100644 --- a/sysdeps/mach/hurd/net/if_arp.h +++ b/sysdeps/mach/hurd/net/if_arp.h @@ -23,7 +23,8 @@ #define _NET_IF_ARP_H 1 #include -#include +#include +#include __BEGIN_DECLS diff --git a/sysdeps/mach/hurd/net/route.h b/sysdeps/mach/hurd/net/route.h index 8772461da51..3e71e8915aa 100644 --- a/sysdeps/mach/hurd/net/route.h +++ b/sysdeps/mach/hurd/net/route.h @@ -22,7 +22,7 @@ #include -#include +#include #include diff --git a/sysdeps/unix/bsd/bits/sockaddr.h b/sysdeps/unix/bsd/bits/sockaddr.h index e2719bbc9ce..bb7ecffd1bd 100644 --- a/sysdeps/unix/bsd/bits/sockaddr.h +++ b/sysdeps/unix/bsd/bits/sockaddr.h @@ -42,4 +42,13 @@ typedef unsigned char sa_family_t; /* Size of struct sockaddr_storage. */ #define _SS_SIZE 128 +/* Desired alignment for struct sockaddr_storage. */ +#include +#include +#if __WORDSIZE == 64 +# define __ss_aligntype __uint64_t +#else +# define __ss_aligntype __uint32_t +#endif + #endif /* bits/sockaddr.h */ diff --git a/sysdeps/unix/sysv/linux/bits/socket.h b/sysdeps/unix/sysv/linux/bits/socket.h index e85fb589ce2..b7af054e414 100644 --- a/sysdeps/unix/sysv/linux/bits/socket.h +++ b/sysdeps/unix/sysv/linux/bits/socket.h @@ -24,10 +24,6 @@ #endif -#include -#include -#include - /* Get the architecture-dependent definition of enum __socket_type. */ #include @@ -165,30 +161,6 @@ /* Maximum queue length specifiable by listen. */ #define SOMAXCONN 4096 -/* Get the definition of the macro to define the common sockaddr members. */ -#include - -/* Structure describing a generic socket address. */ -struct sockaddr - { - __SOCKADDR_COMMON (sa_); /* Common data: address family and length. */ - char sa_data[14]; /* Address data. */ - }; - - -/* Structure large enough to hold any socket address (with the historical - exception of AF_UNIX). */ -#define __ss_aligntype unsigned long int -#define _SS_PADSIZE \ - (_SS_SIZE - __SOCKADDR_COMMON_SIZE - sizeof (__ss_aligntype)) - -struct sockaddr_storage - { - __SOCKADDR_COMMON (ss_); /* Address family, etc. */ - char __ss_padding[_SS_PADSIZE]; - __ss_aligntype __ss_align; /* Force desired alignment. */ - }; - /* Bits in the FLAGS argument to `send', `recv', et al. */ enum @@ -351,11 +323,4 @@ struct ucred # include #endif -/* Structure used to manipulate the SO_LINGER option. */ -struct linger - { - int l_onoff; /* Nonzero to linger on close. */ - int l_linger; /* Time to linger. */ - }; - #endif /* bits/socket.h */ diff --git a/sysdeps/unix/sysv/linux/check_native.c b/sysdeps/unix/sysv/linux/check_native.c index a2ee2ed42e6..1ffaaa07a4b 100644 --- a/sysdeps/unix/sysv/linux/check_native.c +++ b/sysdeps/unix/sysv/linux/check_native.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include diff --git a/sysdeps/unix/sysv/linux/errqueue.h b/sysdeps/unix/sysv/linux/errqueue.h index e99db3037d8..f8cfb073d5d 100644 --- a/sysdeps/unix/sysv/linux/errqueue.h +++ b/sysdeps/unix/sysv/linux/errqueue.h @@ -20,18 +20,19 @@ #ifndef _BITS_ERRQUEUE_H #define _BITS_ERRQUEUE_H 1 -#include -#include +#include +#include struct sock_extended_err { - uint32_t ee_errno; - uint8_t ee_origin; - uint8_t ee_type; - uint8_t ee_code; - uint8_t ee_pad; - uint32_t ee_info; - uint32_t ee_data; + __uint32_t ee_errno; + __uint8_t ee_origin; + __uint8_t ee_type; + __uint8_t ee_code; + __uint8_t ee_pad; + __uint32_t ee_info; + __uint32_t ee_data; + /* A socket address immediately follows. */ }; #define SO_EE_ORIGIN_NONE 0 diff --git a/sysdeps/unix/sysv/linux/net/if_arp.h b/sysdeps/unix/sysv/linux/net/if_arp.h index bbaf9561802..83eac3107cf 100644 --- a/sysdeps/unix/sysv/linux/net/if_arp.h +++ b/sysdeps/unix/sysv/linux/net/if_arp.h @@ -23,7 +23,8 @@ #define _NET_IF_ARP_H 1 #include -#include +#include +#include __BEGIN_DECLS diff --git a/sysdeps/unix/sysv/linux/net/route.h b/sysdeps/unix/sysv/linux/net/route.h index 09819c9cae2..340d994f250 100644 --- a/sysdeps/unix/sysv/linux/net/route.h +++ b/sysdeps/unix/sysv/linux/net/route.h @@ -22,10 +22,11 @@ #include -#include -#include +#include +#include #include +#include /* This structure gets passed by the SIOCADDRT and SIOCDELRT calls. */ struct rtentry @@ -59,12 +60,12 @@ struct in6_rtmsg struct in6_addr rtmsg_dst; struct in6_addr rtmsg_src; struct in6_addr rtmsg_gateway; - uint32_t rtmsg_type; - uint16_t rtmsg_dst_len; - uint16_t rtmsg_src_len; - uint32_t rtmsg_metric; + __uint32_t rtmsg_type; + __uint16_t rtmsg_dst_len; + __uint16_t rtmsg_src_len; + __uint32_t rtmsg_metric; unsigned long int rtmsg_info; - uint32_t rtmsg_flags; + __uint32_t rtmsg_flags; int rtmsg_ifindex; }; @@ -113,7 +114,7 @@ struct in6_rtmsg #define RTF_NAT 0x08000000 #define RTF_ADDRCLASSMASK 0xF8000000 -#define RT_ADDRCLASS(flags) ((uint32_t) flags >> 23) +#define RT_ADDRCLASS(flags) ((__uint32_t) flags >> 23) #define RT_TOS(tos) ((tos) & IPTOS_TOS_MASK) diff --git a/sysdeps/unix/sysv/linux/netatalk/at.h b/sysdeps/unix/sysv/linux/netatalk/at.h index c4e33a8e42a..bb5451ec237 100644 --- a/sysdeps/unix/sysv/linux/netatalk/at.h +++ b/sysdeps/unix/sysv/linux/netatalk/at.h @@ -22,8 +22,7 @@ #include #include -#include -#include +#include /* for SIOCPROTOPRIVATE */ /* Constants from linux/atalk.h as of kernel version 5.0. */