@@ -23,10 +23,6 @@
# error "Never include <bits/socket.h> directly; use <sys/socket.h> instead."
#endif
-#include <bits/wordsize.h>
-#include <bits/types.h>
-#include <bits/types/size_t.h>
-#include <bits/types/socklen_t.h>
/* 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 <bits/sockaddr.h>
-
-/* 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 */
new file mode 100644
@@ -0,0 +1 @@
+#include <socket/bits/types/struct_linger.h>
new file mode 100644
@@ -0,0 +1 @@
+#include <socket/bits/types/struct_sockaddr.h>
new file mode 100644
@@ -0,0 +1 @@
+#include <socket/bits/types/struct_sockaddr_storage.h>
@@ -3,6 +3,7 @@
# ifndef _ISOMAC
+#include <stddef.h>
#include <stdbool.h>
#include <stdint.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); \
new file mode 100644
@@ -0,0 +1 @@
+#include <socket/sys/socketvar.h>
@@ -20,6 +20,7 @@
#include <features.h>
#include <netinet/in.h> /* To define `struct in_addr'. */
+#include <bits/types/size_t.h>
#include <bits/types/socklen_t.h>
__BEGIN_DECLS
@@ -19,6 +19,7 @@
#include <ifaddrs.h>
#include <netdb.h>
#include <stdint.h>
+#include <sys/socket.h>
void
attribute_hidden
@@ -20,6 +20,7 @@
#include <errno.h>
#include <netdb.h>
#include <string.h>
+#include <sys/socket.h>
#include <arpa/inet.h>
#include <netinet/in.h>
@@ -20,6 +20,7 @@
#include <errno.h>
#include <netdb.h>
#include <string.h>
+#include <sys/socket.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <resolv/res_hconf.h>
@@ -20,6 +20,7 @@
#include <errno.h>
#include <netinet/in.h>
#include <stdint.h>
+#include <sys/socket.h>
int
getsourcefilter (int s, uint32_t interface, const struct sockaddr *group,
@@ -20,7 +20,7 @@
#define _IFADDRS_H 1
#include <features.h>
-#include <sys/socket.h>
+#include <bits/types/struct_sockaddr.h>
__BEGIN_DECLS
@@ -17,6 +17,7 @@
<http://www.gnu.org/licenses/>. */
#include <string.h>
+#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/ip6.h>
@@ -18,6 +18,7 @@
#include <assert.h>
#include <string.h>
+#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/ip6.h>
#include <sys/param.h>
@@ -17,6 +17,7 @@
<http://www.gnu.org/licenses/>. */
#include <string.h>
+#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/ip6.h>
@@ -19,10 +19,11 @@
#define _NETINET_IN_H 1
#include <features.h>
-#include <bits/stdint-uintn.h>
-#include <sys/socket.h>
#include <bits/types.h>
-
+#include <bits/stdint-uintn.h>
+#include <bits/sockaddr.h>
+#include <bits/types/struct_sockaddr.h>
+#include <bits/types/struct_sockaddr_storage.h>
__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 */
@@ -85,11 +85,11 @@
#define TCP_REPAIR_OFF_NO_WP -1
#ifdef __USE_MISC
-# include <bits/stdint-uintn.h>
# include <bits/endian.h>
-# include <sys/socket.h>
+# include <bits/types.h>
+# include <bits/types/struct_sockaddr_storage.h>
-typedef uint32_t tcp_seq;
+typedef __uint32_t tcp_seq;
/*
* TCP header.
* Per RFC 793, September, 1981.
@@ -100,61 +100,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 <bits/endian.h> defines"
# endif
- uint16_t window;
- uint16_t check;
- uint16_t urg_ptr;
+ __uint16_t window;
+ __uint16_t check;
+ __uint16_t urg_ptr;
};
};
};
@@ -224,45 +224,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;
+ __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_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;
+ __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_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_rcv_rtt;
+ __uint32_t tcpi_rcv_space;
- uint32_t tcpi_total_retrans;
+ __uint32_t tcpi_total_retrans;
};
@@ -275,18 +275,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. */
@@ -317,30 +317,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. */
@@ -32,7 +32,9 @@
#ifndef _PROTOCOLS_ROUTED_H
#define _PROTOCOLS_ROUTED_H 1
-#include <sys/socket.h>
+#include <features.h>
+#include <bits/types/struct_sockaddr.h>
+
/*
* Routing Information Protocol
*
@@ -20,7 +20,7 @@
#include <errno.h>
#include <stdint.h>
#include <netinet/in.h>
-
+#include <sys/socket.h>
int
setsourcefilter (int s, uint32_t interface, const struct sockaddr *group,
@@ -21,6 +21,7 @@
#include <stdlib.h>
#include <string.h>
#include <ifaddrs.h>
+#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
@@ -1,3 +1,4 @@
+#include <sys/socket.h>
#include <netinet/in.h>
#include <stdio.h>
#include <stdlib.h>
@@ -1,5 +1,6 @@
#include <stdio.h>
#include <string.h>
+#include <sys/socket.h>
#include <arpa/inet.h>
#include <netinet/ip6.h>
@@ -16,6 +16,7 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
+#include <sys/socket.h>
#include <arpa/inet.h>
#include <inttypes.h>
#include <net-internal.h>
@@ -25,6 +25,7 @@
#include <netdb.h>
#undef _nss_nis_endhostent
#include <string.h>
+#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <libc-lock.h>
@@ -23,6 +23,7 @@
#include <netdb.h>
#include <nss.h>
#include <string.h>
+#include <sys/socket.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <rpcsvc/nis.h>
@@ -25,6 +25,7 @@
#include <time.h>
#include <unistd.h>
#include <sys/mman.h>
+#include <sys/socket.h>
#include <resolv/resolv-internal.h>
#include <resolv/resolv_context.h>
#include <scratch_buffer.h>
@@ -25,6 +25,7 @@
#include <string.h>
#include <libintl.h>
#include <arpa/inet.h>
+#include <sys/socket.h>
#include <sys/mman.h>
#include <sys/param.h>
#include <sys/stat.h>
@@ -33,6 +33,7 @@
#include <arpa/inet.h>
#include <arpa/nameser.h>
#include <sys/mman.h>
+#include <sys/socket.h>
#include <stackinfo.h>
#include <scratch_buffer.h>
@@ -26,6 +26,7 @@
#include <unistd.h>
#include <sys/mman.h>
#include <sys/param.h>
+#include <sys/socket.h>
#include <scratch_buffer.h>
#include <config.h>
@@ -25,6 +25,7 @@
#include <unistd.h>
#include <sys/mman.h>
#include <sys/param.h>
+#include <sys/socket.h>
#include "../inet/netgroup.h"
#include "nscd.h"
@@ -21,6 +21,7 @@
#include <stdio.h>
#include <string.h>
#include <stdint.h>
+#include <sys/socket.h>
#include <arpa/nameser.h>
#include <not-cancel.h>
@@ -23,6 +23,7 @@
#include <unistd.h>
#include <stdint.h>
#include <sys/mman.h>
+#include <sys/socket.h>
#include <kernel-features.h>
#include <scratch_buffer.h>
@@ -25,6 +25,7 @@
#include <resolv/resolv-internal.h>
#include <resolv/resolv_context.h>
#include <netdb.h>
+#include <sys/socket.h>
#include <arpa/inet.h>
#include "nsswitch.h"
@@ -17,6 +17,7 @@
<http://www.gnu.org/licenses/>. */
#include <assert.h>
+#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <arpa/nameser.h>
@@ -16,6 +16,7 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
+#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
@@ -22,6 +22,7 @@
#include <gnu/lib-names.h>
#include <netdb.h>
#include <nss.h>
+#include <sys/socket.h>
#include <support/check.h>
#include <support/check_nss.h>
#include <support/namespace.h>
@@ -24,6 +24,7 @@
#include <nss.h>
#include <stdlib.h>
#include <stdio.h>
+#include <sys/socket.h>
#include <support/check.h>
#include <support/check_nss.h>
#include <support/namespace.h>
@@ -24,6 +24,7 @@
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
+#include <sys/socket.h>
#include <support/check.h>
#include <support/check_nss.h>
#include <support/namespace.h>
@@ -2,6 +2,7 @@
#include <netdb.h>
#include <stdio.h>
#include <string.h>
+#include <sys/socket.h>
#include <arpa/inet.h>
#include <arpa/nameser.h>
@@ -25,6 +25,7 @@
#include <features.h>
#include <netinet/in.h>
+#include <bits/types/socklen_t.h>
#include <bits/stdint-uintn.h>
#ifdef __USE_MISC
/* This is necessary to make this include file properly replace the
@@ -65,6 +65,7 @@
#include <stddef.h>
#include "nsswitch.h"
+#include <sys/socket.h>
#include <arpa/inet.h>
#include <arpa/nameser.h>
#include <resolv/resolv-internal.h>
@@ -23,6 +23,7 @@
#include <libc-lock.h>
#include <resolv-internal.h>
#include <sys/stat.h>
+#include <sys/socket.h>
#include <libc-symbols.h>
/* _res._u._ext.__glibc_extension_index is used as an index into a
@@ -22,6 +22,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <sys/socket.h>
#include <support/check.h>
#include <support/check_nss.h>
#include <support/resolv_test.h>
@@ -21,6 +21,7 @@
#include <resolv.h>
#include <stdio.h>
#include <string.h>
+#include <sys/socket.h>
#include <support/check.h>
#include <support/resolv_test.h>
#include <support/xthread.h>
@@ -3,6 +3,7 @@
#include <netinet/in.h>
#include <stdio.h>
#include <string.h>
+#include <sys/socket.h>
static int
do_test (void)
@@ -21,6 +21,7 @@
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
+#include <sys/socket.h>
#include <support/check.h>
#include <support/next_to_fault.h>
#include <support/xunistd.h>
@@ -23,6 +23,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <sys/socket.h>
#include <support/check.h>
#include <support/check_nss.h>
#include <support/resolv_test.h>
@@ -20,6 +20,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <sys/socket.h>
#include <support/check.h>
#include <support/check_nss.h>
#include <support/format_nss.h>
@@ -18,6 +18,7 @@
#include <resolv.h>
#include <string.h>
+#include <sys/types.h>
#include <support/check.h>
#include <support/resolv_test.h>
@@ -22,6 +22,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <sys/socket.h>
#include <support/check.h>
#include <support/resolv_test.h>
#include <support/support.h>
@@ -19,6 +19,7 @@
#include <netdb.h>
#include <stdlib.h>
#include <string.h>
+#include <sys/socket.h>
#include <support/check.h>
#include <support/check_nss.h>
#include <support/resolv_test.h>
@@ -18,6 +18,7 @@
#include <netdb.h>
#include <stdlib.h>
+#include <sys/socket.h>
#include <support/check.h>
#include <support/check_nss.h>
#include <support/resolv_test.h>
@@ -19,6 +19,7 @@
#include <resolv.h>
#include <stdlib.h>
#include <string.h>
+#include <sys/socket.h>
#include <support/check.h>
#include <support/check_nss.h>
#include <support/resolv_test.h>
@@ -29,6 +29,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <sys/socket.h>
#include <support/check.h>
#include <support/namespace.h>
#include <support/resolv_test.h>
@@ -18,6 +18,7 @@
#include <array_length.h>
#include <netdb.h>
+#include <sys/socket.h>
#include <support/check.h>
#include <support/check_nss.h>
#include <support/resolv_test.h>
@@ -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
@@ -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 \
new file mode 100644
@@ -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
new file mode 100644
@@ -0,0 +1,15 @@
+#ifndef __struct_sockaddr_defined
+#define __struct_sockaddr_defined 1
+
+#include <bits/sockaddr.h>
+
+/* 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
new file mode 100644
@@ -0,0 +1,21 @@
+#ifndef __struct_sockaddr_storage_defined
+#define __struct_sockaddr_storage_defined 1
+
+#include <bits/sockaddr.h>
+
+/* 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 */
@@ -32,7 +32,7 @@ struct if_nameindex
#ifdef __USE_MISC
-# include <sys/socket.h> /* for struct sockaddr */
+# include <bits/types/struct_sockaddr.h>
/* Standard interface flags. */
enum
@@ -28,11 +28,11 @@ __BEGIN_DECLS
#include <bits/types/ssize_t.h>
#include <bits/types/socklen_t.h>
#include <bits/types/struct_iovec.h>
+#include <bits/types/struct_linger.h>
-/* 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 <bits/socket.h>
+#include <bits/sockaddr.h>
+#include <bits/types/struct_sockaddr.h>
+#include <bits/types/struct_sockaddr_storage.h>
#ifdef __USE_MISC
# include <bits/types/struct_osockaddr.h>
@@ -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 <bits/socket.h>
+
/* The following constants should be used for the second parameter of
`shutdown'. */
enum
similarity index 100%
rename from sysdeps/generic/sys/socketvar.h
rename to socket/sys/socketvar.h
@@ -18,6 +18,7 @@
#include <errno.h>
#include <netdb.h>
+#include <sys/socket.h>
#include <rpc/rpc.h>
#include <scratch_buffer.h>
#include <string.h>
@@ -18,6 +18,7 @@
#include <support/format_nss.h>
+#include <sys/socket.h>
#include <support/support.h>
char *
@@ -22,6 +22,7 @@
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
+#include <sys/socket.h>
#include <support/support.h>
#include <support/xmemstream.h>
@@ -18,6 +18,7 @@
#include <support/format_nss.h>
+#include <sys/socket.h>
#include <arpa/inet.h>
#include <resolv.h>
#include <stdbool.h>
@@ -18,6 +18,7 @@
#include <support/format_nss.h>
+#include <sys/socket.h>
#include <arpa/inet.h>
#include <errno.h>
#include <stdio.h>
@@ -18,6 +18,7 @@
#include <support/format_nss.h>
+#include <sys/socket.h>
#include <arpa/inet.h>
#include <stdio.h>
#include <stdlib.h>
@@ -25,11 +25,6 @@
#endif
-#include <bits/types.h>
-#include <bits/types/size_t.h>
-#include <bits/types/socklen_t.h>
-#include <bits/wordsize.h>
-
/* 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 <bits/sockaddr.h>
-
-/* 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 */
@@ -19,6 +19,7 @@
#include <error.h>
#include <net/if.h>
#include <string.h>
+#include <sys/socket.h>
#include <sys/ioctl.h>
#include <unistd.h>
@@ -23,7 +23,8 @@
#define _NET_IF_ARP_H 1
#include <features.h>
-#include <sys/socket.h>
+#include <bits/types.h>
+#include <bits/types/struct_sockaddr.h>
__BEGIN_DECLS
@@ -22,7 +22,7 @@
#include <features.h>
-#include <sys/socket.h>
+#include <bits/types/struct_sockaddr.h>
#include <netinet/in.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 <bits/types.h>
+#include <bits/wordsize.h>
+#if __WORDSIZE == 64
+# define __ss_aligntype __uint64_t
+#else
+# define __ss_aligntype __uint32_t
+#endif
+
#endif /* bits/sockaddr.h */
@@ -24,10 +24,6 @@
#endif
-#include <bits/types.h>
-#include <bits/types/size_t.h>
-#include <bits/types/socklen_t.h>
-
/* Get the architecture-dependent definition of enum __socket_type. */
#include <bits/socket_type.h>
@@ -165,30 +161,6 @@
/* Maximum queue length specifiable by listen. */
#define SOMAXCONN 128
-/* Get the definition of the macro to define the common sockaddr members. */
-#include <bits/sockaddr.h>
-
-/* 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
@@ -437,11 +409,4 @@ struct ucred
# undef IOC_OUT
#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 */
@@ -27,6 +27,7 @@
#include <unistd.h>
#include <net/if.h>
#include <net/if_arp.h>
+#include <sys/socket.h>
#include <sys/ioctl.h>
#include <asm/types.h>
@@ -20,18 +20,19 @@
#ifndef _BITS_ERRQUEUE_H
#define _BITS_ERRQUEUE_H 1
-#include <sys/types.h>
-#include <sys/socket.h>
+#include <bits/types.h>
+#include <bits/types/struct_sockaddr.h>
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
@@ -23,7 +23,8 @@
#define _NET_IF_ARP_H 1
#include <features.h>
-#include <sys/socket.h>
+#include <bits/types.h>
+#include <bits/types/struct_sockaddr.h>
__BEGIN_DECLS
@@ -22,10 +22,11 @@
#include <features.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
+#include <bits/types.h>
+#include <bits/types/struct_sockaddr.h>
#include <bits/wordsize.h>
+#include <netinet/in.h>
/* 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)
@@ -22,8 +22,7 @@
#include <bits/types.h>
#include <bits/sockaddr.h>
-#include <sys/socket.h>
-#include <sys/ioctl.h>
+#include <sys/ioctl.h> /* for SIOCPROTOPRIVATE */
/* Constants from linux/atalk.h as of kernel version 5.0. */