public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc/zack/no-nested-includes] Minimize includes by networking headers 1/n: resolv, ethernet, atalk
@ 2019-06-05 12:25 Zack Weinberg
0 siblings, 0 replies; 2+ messages in thread
From: Zack Weinberg @ 2019-06-05 12:25 UTC (permalink / raw)
To: glibc-cvs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="us-ascii", Size: 24371 bytes --]
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=828ffb06e83a41f9e7585eadf4e4ba2de358058a
commit 828ffb06e83a41f9e7585eadf4e4ba2de358058a
Author: Zack Weinberg <zackw@panix.com>
Date: Sat Jun 1 19:32:01 2019 -0400
Minimize includes by networking headers 1/n: resolv, ethernet, atalk
The networking headers are messy and complicated so Iâm doing the
inclusion minimization in small batches. This does everything that
sorts alphabetically before netinet/.
* resolv/resolv.h: Include bits/types.h, bits/types/FILE.h,
and bits/types/size_t.h; donât include sys/param.h, sys/types.h,
or stdio.h. Use __uint16_t and __uint32_t instead of uint16_t and
uint32_t.
* resolv/arpa/nameser.h: Include features.h, bits/types.h, and
bits/types/size_t.h; donât include sys/param.h, sys/types.h, or
stdint.h. Use __uint16_t and __uint32_t instead of uint16_t and
uint32_t.
* resolv/arpa/nameser_compat.h: Include features.h.
* sysdeps/mach/hurd/net/ethernet.h: Include bits/types.h;
donât include sys/types.h or stdint.h. Use __uint8_t and
__uint16_t instead of uint8_t and uint16_t.
* sysdeps/unix/sysv/linux/net/ethernet.h: Include features.h and
bits/types.h; donât include sys/types.h or stdint.h.
Use __uint8_t and __uint16_t instead of uint8_t and uint16_t.
* sysdeps/unix/sysv/linux/netinet/if_ether.h: Include features.h
and bits/types.h. Use __uint8_t instead of uint8_t.
* sysdeps/mach/hurd/net/if_arp.h: Donât include sys/types.h or
stdint.h. Use __uint32_t instead of uint32_t.
* sysdeps/unix/sysv/linux/net/if_arp.h: Include features.h.
Donât include sys/types.h or stdint.h. Use __uint32_t instead of
uint32_t.
* sysdeps/mach/hurd/net/route.h: Donât include sys/types.h.
* sysdeps/unix/sysv/linux/net/route.h: Donât include sys/types.h.
* sysdeps/unix/sysv/linux/net/if_ppp.h: Include features.h and
bits/types.h. Donât include sys/types.h or stdint.h. Use
__uint8_t and __uint32_t instead of uint8_t and uint32_t.
* sysdeps/unix/sysv/linux/net/if_shaper.h: Include features.h and
bits/types.h. Donât include sys/types.h or stdint.h. Use
__uint16_t and __uint32_t instead of uint16_t and uint32_t.
* sysdeps/unix/sysv/linux/netatalk/at.h: Include features.h,
bits/types.h, and sys/ioctl.h. Donât include asm/types.h or
linux/atalk.h. Copy over all user-appropriate definitions from
linux/atalk.h with adjustments for glibc context.
* grp/initgroups.c, nscd/initgrcache.c, nss/nss_db/db-XXX.c
* resolv/ns_print.c, resolv/tst-ns_name_compress.c
* resolv/tst-res_hnok.c, support/resolv_test.c:
Include stdio.h.
* nscd/initgrcache.c, nscd/netgroupcache.c
* nss/nss_compat/compat-grp.c, nss/nss_compat/compat-pwd.c
* nss/nss_compat/compat-spwd.c, resolv/ns_print.c:
Include sys/param.h for MIN and/or MAX.
* resolv/tst-resolv-res_init-skeleton.c: Include signal.h.
* scripts/check-obsolete-constructs.py
(HEADER_ALLOWED_INCLUDES, SYSDEP_ALLOWED_INCLUDES): Update.
Diff:
---
grp/initgroups.c | 1 +
nscd/initgrcache.c | 2 ++
nscd/netgroupcache.c | 1 +
nss/nss_compat/compat-grp.c | 1 +
nss/nss_compat/compat-pwd.c | 1 +
nss/nss_compat/compat-spwd.c | 1 +
nss/nss_db/db-XXX.c | 1 +
resolv/arpa/nameser.h | 34 +++++++++++++-------------
resolv/arpa/nameser_compat.h | 1 +
resolv/ns_print.c | 2 ++
resolv/resolv.h | 13 +++++-----
resolv/tst-ns_name_compress.c | 1 +
resolv/tst-res_hnok.c | 1 +
resolv/tst-resolv-res_init-skeleton.c | 1 +
scripts/check-obsolete-constructs.py | 27 ++++++++-------------
support/resolv_test.c | 1 +
sysdeps/mach/hurd/net/ethernet.h | 12 ++++-----
sysdeps/mach/hurd/net/if_arp.h | 5 +---
sysdeps/mach/hurd/net/route.h | 3 +--
sysdeps/unix/sysv/linux/net/ethernet.h | 12 ++++-----
sysdeps/unix/sysv/linux/net/if_arp.h | 5 ++--
sysdeps/unix/sysv/linux/net/if_ppp.h | 10 ++++----
sysdeps/unix/sysv/linux/net/if_shaper.h | 8 +++---
sysdeps/unix/sysv/linux/net/route.h | 2 +-
sysdeps/unix/sysv/linux/netatalk/at.h | 39 ++++++++++++++++++++++++++++--
sysdeps/unix/sysv/linux/netinet/if_ether.h | 18 ++++++++------
26 files changed, 121 insertions(+), 82 deletions(-)
diff --git a/grp/initgroups.c b/grp/initgroups.c
index a22f33c..6edfb0a 100644
--- a/grp/initgroups.c
+++ b/grp/initgroups.c
@@ -19,6 +19,7 @@
#include <errno.h>
#include <grp.h>
#include <limits.h>
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
diff --git a/nscd/initgrcache.c b/nscd/initgrcache.c
index cf38c59..6786665 100644
--- a/nscd/initgrcache.c
+++ b/nscd/initgrcache.c
@@ -20,10 +20,12 @@
#include <errno.h>
#include <grp.h>
#include <libintl.h>
+#include <stdio.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <sys/mman.h>
+#include <sys/param.h>
#include <scratch_buffer.h>
#include <config.h>
diff --git a/nscd/netgroupcache.c b/nscd/netgroupcache.c
index cda276e..8fcb092 100644
--- a/nscd/netgroupcache.c
+++ b/nscd/netgroupcache.c
@@ -24,6 +24,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <sys/mman.h>
+#include <sys/param.h>
#include "../inet/netgroup.h"
#include "nscd.h"
diff --git a/nss/nss_compat/compat-grp.c b/nss/nss_compat/compat-grp.c
index 8f01e44..c46a0dc 100644
--- a/nss/nss_compat/compat-grp.c
+++ b/nss/nss_compat/compat-grp.c
@@ -24,6 +24,7 @@
#include <nsswitch.h>
#include <stdio_ext.h>
#include <string.h>
+#include <sys/param.h>
#include <libc-lock.h>
#include <kernel-features.h>
diff --git a/nss/nss_compat/compat-pwd.c b/nss/nss_compat/compat-pwd.c
index 37f883f..4b6734a 100644
--- a/nss/nss_compat/compat-pwd.c
+++ b/nss/nss_compat/compat-pwd.c
@@ -25,6 +25,7 @@
#include <pwd.h>
#include <stdio_ext.h>
#include <string.h>
+#include <sys/param.h>
#include <libc-lock.h>
#include <kernel-features.h>
diff --git a/nss/nss_compat/compat-spwd.c b/nss/nss_compat/compat-spwd.c
index bd310ab..3eaa6e8 100644
--- a/nss/nss_compat/compat-spwd.c
+++ b/nss/nss_compat/compat-spwd.c
@@ -25,6 +25,7 @@
#include <shadow.h>
#include <stdio_ext.h>
#include <string.h>
+#include <sys/param.h>
#include <libc-lock.h>
#include <kernel-features.h>
diff --git a/nss/nss_db/db-XXX.c b/nss/nss_db/db-XXX.c
index e17bbff..ac3586e 100644
--- a/nss/nss_db/db-XXX.c
+++ b/nss/nss_db/db-XXX.c
@@ -18,6 +18,7 @@
#include <dlfcn.h>
#include <fcntl.h>
+#include <stdio.h>
#include <stdint.h>
#include <sys/mman.h>
#include <libc-lock.h>
diff --git a/resolv/arpa/nameser.h b/resolv/arpa/nameser.h
index a99d5ec..4ce57bd 100644
--- a/resolv/arpa/nameser.h
+++ b/resolv/arpa/nameser.h
@@ -48,9 +48,9 @@
#ifndef _ARPA_NAMESER_H_
#define _ARPA_NAMESER_H_
-#include <sys/param.h>
-#include <sys/types.h>
-#include <stdint.h>
+#include <features.h>
+#include <bits/types.h>
+#include <bits/types/size_t.h>
/*
* Define constants based on RFC 883, RFC 1034, RFC 1035
@@ -92,7 +92,7 @@ typedef enum __ns_sect {
*/
typedef struct __ns_msg {
const unsigned char *_msg, *_eom;
- uint16_t _id, _flags, _counts[ns_s_max];
+ __uint16_t _id, _flags, _counts[ns_s_max];
const unsigned char *_sections[ns_s_max];
ns_sect _sect;
int _rrnum;
@@ -116,10 +116,10 @@ extern const struct _ns_flagdata _ns_flagdata[];
*/
typedef struct __ns_rr {
char name[NS_MAXDNAME];
- uint16_t type;
- uint16_t rr_class;
- uint32_t ttl;
- uint16_t rdlength;
+ __uint16_t type;
+ __uint16_t rr_class;
+ __uint32_t ttl;
+ __uint16_t rdlength;
const unsigned char * rdata;
} ns_rr;
@@ -355,24 +355,24 @@ typedef enum __ns_cert_types {
*/
#define NS_GET16(s, cp) do { \
const unsigned char *t_cp = (const unsigned char *)(cp); \
- (s) = ((uint16_t)t_cp[0] << 8) \
- | ((uint16_t)t_cp[1]) \
+ (s) = ((__uint16_t)t_cp[0] << 8) \
+ | ((__uint16_t)t_cp[1]) \
; \
(cp) += NS_INT16SZ; \
} while (0)
#define NS_GET32(l, cp) do { \
const unsigned char *t_cp = (const unsigned char *)(cp); \
- (l) = ((uint32_t)t_cp[0] << 24) \
- | ((uint32_t)t_cp[1] << 16) \
- | ((uint32_t)t_cp[2] << 8) \
- | ((uint32_t)t_cp[3]) \
+ (l) = ((__uint32_t)t_cp[0] << 24) \
+ | ((__uint32_t)t_cp[1] << 16) \
+ | ((__uint32_t)t_cp[2] << 8) \
+ | ((__uint32_t)t_cp[3]) \
; \
(cp) += NS_INT32SZ; \
} while (0)
#define NS_PUT16(s, cp) do { \
- uint16_t t_s = (uint16_t)(s); \
+ __uint16_t t_s = (__uint16_t)(s); \
unsigned char *t_cp = (unsigned char *)(cp); \
*t_cp++ = t_s >> 8; \
*t_cp = t_s; \
@@ -380,7 +380,7 @@ typedef enum __ns_cert_types {
} while (0)
#define NS_PUT32(l, cp) do { \
- uint32_t t_l = (uint32_t)(l); \
+ __uint32_t t_l = (__uint32_t)(l); \
unsigned char *t_cp = (unsigned char *)(cp); \
*t_cp++ = t_l >> 24; \
*t_cp++ = t_l >> 16; \
@@ -408,7 +408,7 @@ int ns_sprintrrf (const unsigned char *, size_t, const char *,
const char *, char *, size_t) __THROW;
int ns_format_ttl (unsigned long, char *, size_t) __THROW;
int ns_parse_ttl (const char *, unsigned long *) __THROW;
-uint32_t ns_datetosecs (const char *, int *) __THROW;
+__uint32_t ns_datetosecs (const char *, int *) __THROW;
int ns_name_ntol (const unsigned char *, unsigned char *, size_t)
__THROW;
int ns_name_ntop (const unsigned char *, char *, size_t) __THROW;
diff --git a/resolv/arpa/nameser_compat.h b/resolv/arpa/nameser_compat.h
index 37c178b..8996d37 100644
--- a/resolv/arpa/nameser_compat.h
+++ b/resolv/arpa/nameser_compat.h
@@ -29,6 +29,7 @@
#ifndef _ARPA_NAMESER_COMPAT_
#define _ARPA_NAMESER_COMPAT_
+#include <features.h>
#include <bits/endian.h>
/*%
diff --git a/resolv/ns_print.c b/resolv/ns_print.c
index d61f504..1dbcfb8 100644
--- a/resolv/ns_print.c
+++ b/resolv/ns_print.c
@@ -19,6 +19,7 @@
/* Import. */
#include <sys/types.h>
+#include <sys/param.h>
#include <sys/socket.h>
#include <netinet/in.h>
@@ -28,6 +29,7 @@
#include <assert.h>
#include <errno.h>
#include <resolv.h>
+#include <stdio.h>
#include <string.h>
#include <ctype.h>
diff --git a/resolv/resolv.h b/resolv/resolv.h
index b4ef66f..5783de6 100644
--- a/resolv/resolv.h
+++ b/resolv/resolv.h
@@ -54,11 +54,12 @@
#include <features.h>
-#include <sys/param.h>
-#include <sys/types.h>
-#include <stdio.h>
#include <netinet/in.h>
#include <arpa/nameser.h>
+
+#include <bits/types.h>
+#include <bits/types/FILE.h>
+#include <bits/types/size_t.h>
#include <bits/types/res_state.h>
/*
@@ -248,10 +249,10 @@ int loc_aton (const char *__ascii, unsigned char *__binary) __THROW;
const char * loc_ntoa (const unsigned char *__binary, char *__ascii) __THROW;
int dn_skipname (const unsigned char *, const unsigned char *)
__THROW;
-void putlong (uint32_t, unsigned char *) __THROW;
-void putshort (uint16_t, unsigned char *) __THROW;
+void putlong (__uint32_t, unsigned char *) __THROW;
+void putshort (__uint16_t, unsigned char *) __THROW;
const char * p_class (int) __THROW;
-const char * p_time (uint32_t) __THROW;
+const char * p_time (__uint32_t) __THROW;
const char * p_type (int) __THROW;
const char * p_rcode (int) __THROW;
const unsigned char * p_cdnname (const unsigned char *,
diff --git a/resolv/tst-ns_name_compress.c b/resolv/tst-ns_name_compress.c
index 00b6e81..019edf7 100644
--- a/resolv/tst-ns_name_compress.c
+++ b/resolv/tst-ns_name_compress.c
@@ -17,6 +17,7 @@
<http://www.gnu.org/licenses/>. */
#include <resolv.h>
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <support/check.h>
diff --git a/resolv/tst-res_hnok.c b/resolv/tst-res_hnok.c
index a85449d..3bc1816 100644
--- a/resolv/tst-res_hnok.c
+++ b/resolv/tst-res_hnok.c
@@ -18,6 +18,7 @@
#include <array_length.h>
#include <resolv.h>
+#include <stdio.h>
#include <string.h>
#include <support/check.h>
#include <support/test-driver.h>
diff --git a/resolv/tst-resolv-res_init-skeleton.c b/resolv/tst-resolv-res_init-skeleton.c
index 678f396..32a7907 100644
--- a/resolv/tst-resolv-res_init-skeleton.c
+++ b/resolv/tst-resolv-res_init-skeleton.c
@@ -25,6 +25,7 @@
#include <gnu/lib-names.h>
#include <netdb.h>
#include <resolv/resolv_context.h>
+#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <support/capture_subprocess.h>
diff --git a/scripts/check-obsolete-constructs.py b/scripts/check-obsolete-constructs.py
index f7db88d..288d4e5 100755
--- a/scripts/check-obsolete-constructs.py
+++ b/scripts/check-obsolete-constructs.py
@@ -609,23 +609,17 @@ HEADER_ALLOWED_INCLUDES = {
# Nonstandardized networking headers
"ifaddrs.h": [ "sys/socket.h" ],
- "resolv.h": [ "arpa/nameser.h", "netinet/in.h",
- "stdio.h", "sys/param.h",
- "sys/types.h" ],
- "arpa/nameser.h": [ "arpa/nameser_compat.h", "stdint.h",
- "sys/param.h", "sys/types.h" ],
- "net/ethernet.h": [ "stdint.h", "sys/types.h",
- "net/if_ether.h" ],
- "net/if_arp.h": [ "stdint.h", "sys/socket.h",
- "sys/types.h" ],
- "net/if_ppp.h": [ "net/if.h", "net/ppp_defs.h", "stdint.h",
- "sys/ioctl.h", "sys/types.h" ],
- "net/if_shaper.h": [ "net/if.h", "stdint.h", "sys/ioctl.h",
- "sys/types.h" ],
- "net/route.h": [ "netinet/in.h", "sys/socket.h",
- "sys/types.h" ],
- "netatalk/at.h": [ "sys/socket.h" ],
+ "resolv.h": [ "arpa/nameser.h", "netinet/in.h" ],
+ "arpa/nameser.h": [ "arpa/nameser_compat.h" ],
+
+ "net/ethernet.h": [ "stdint.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" ],
"netinet/ether.h": [ "netinet/if_ether.h" ],
"netinet/icmp6.h": [ "inttypes.h", "netinet/in.h", "string.h",
"sys/types.h" ],
@@ -688,7 +682,6 @@ SYSDEP_ALLOWED_INCLUDES = {
"net/ethernet.h": [ "linux/if_ether.h" ],
"net/if_slip.h": [ "linux/if_slip.h" ],
"net/ppp_defs.h": [ "asm/types.h", "linux/ppp_defs.h" ],
- "netatalk/at.h": [ "asm/types.h", "linux/atalk.h" ],
"netinet/if_ether.h": [ "linux/if_ether.h" ],
"netinet/if_fddi.h": [ "linux/if_fddi.h" ],
diff --git a/support/resolv_test.c b/support/resolv_test.c
index 903ab2a..45d8ec7 100644
--- a/support/resolv_test.c
+++ b/support/resolv_test.c
@@ -24,6 +24,7 @@
#include <nss.h>
#include <resolv.h>
#include <search.h>
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <support/check.h>
diff --git a/sysdeps/mach/hurd/net/ethernet.h b/sysdeps/mach/hurd/net/ethernet.h
index 8956694..3003523 100644
--- a/sysdeps/mach/hurd/net/ethernet.h
+++ b/sysdeps/mach/hurd/net/ethernet.h
@@ -22,9 +22,7 @@
#define __NET_ETHERNET_H 1
#include <features.h>
-
-#include <sys/types.h>
-#include <stdint.h>
+#include <bits/types.h>
#include <net/if_ether.h> /* IEEE 802.3 Ethernet constants */
__BEGIN_DECLS
@@ -33,15 +31,15 @@ __BEGIN_DECLS
systems. */
struct ether_addr
{
- uint8_t ether_addr_octet[ETH_ALEN];
+ __uint8_t ether_addr_octet[ETH_ALEN];
};
/* 10Mb/s ethernet header */
struct ether_header
{
- uint8_t ether_dhost[ETH_ALEN]; /* destination eth addr */
- uint8_t ether_shost[ETH_ALEN]; /* source ether addr */
- uint16_t ether_type; /* packet type ID field */
+ __uint8_t ether_dhost[ETH_ALEN]; /* destination eth addr */
+ __uint8_t ether_shost[ETH_ALEN]; /* source ether addr */
+ __uint16_t ether_type; /* packet type ID field */
};
/* Ethernet protocol ID's */
diff --git a/sysdeps/mach/hurd/net/if_arp.h b/sysdeps/mach/hurd/net/if_arp.h
index 9e1b223..38665fe 100644
--- a/sysdeps/mach/hurd/net/if_arp.h
+++ b/sysdeps/mach/hurd/net/if_arp.h
@@ -23,10 +23,7 @@
#define _NET_IF_ARP_H 1
#include <features.h>
-
-#include <sys/types.h>
#include <sys/socket.h>
-#include <stdint.h>
__BEGIN_DECLS
@@ -133,7 +130,7 @@ struct arpreq
struct arpd_request
{
unsigned short int req; /* Request type. */
- uint32_t ip; /* IP address of entry. */
+ __uint32_t ip; /* IP address of entry. */
unsigned long int dev; /* Device entry is tied to. */
unsigned long int stamp;
unsigned long int updated;
diff --git a/sysdeps/mach/hurd/net/route.h b/sysdeps/mach/hurd/net/route.h
index 4924f09..fcb79bb 100644
--- a/sysdeps/mach/hurd/net/route.h
+++ b/sysdeps/mach/hurd/net/route.h
@@ -18,12 +18,11 @@
/* Based on the 4.4BSD and Linux version of this file. */
#ifndef _NET_ROUTE_H
-
#define _NET_ROUTE_H 1
+
#include <features.h>
#include <sys/socket.h>
-#include <sys/types.h>
#include <netinet/in.h>
diff --git a/sysdeps/unix/sysv/linux/net/ethernet.h b/sysdeps/unix/sysv/linux/net/ethernet.h
index 7e49297..1833511 100644
--- a/sysdeps/unix/sysv/linux/net/ethernet.h
+++ b/sysdeps/unix/sysv/linux/net/ethernet.h
@@ -21,8 +21,8 @@
#ifndef __NET_ETHERNET_H
#define __NET_ETHERNET_H 1
-#include <sys/types.h>
-#include <stdint.h>
+#include <features.h>
+#include <bits/types.h>
#include <linux/if_ether.h> /* IEEE 802.3 Ethernet constants */
@@ -32,15 +32,15 @@ __BEGIN_DECLS
systems. */
struct ether_addr
{
- uint8_t ether_addr_octet[ETH_ALEN];
+ __uint8_t ether_addr_octet[ETH_ALEN];
} __attribute__ ((__packed__));
/* 10Mb/s ethernet header */
struct ether_header
{
- uint8_t ether_dhost[ETH_ALEN]; /* destination eth addr */
- uint8_t ether_shost[ETH_ALEN]; /* source ether addr */
- uint16_t ether_type; /* packet type ID field */
+ __uint8_t ether_dhost[ETH_ALEN]; /* destination eth addr */
+ __uint8_t ether_shost[ETH_ALEN]; /* source ether addr */
+ __uint16_t ether_type; /* packet type ID field */
} __attribute__ ((__packed__));
/* Ethernet protocol ID's */
diff --git a/sysdeps/unix/sysv/linux/net/if_arp.h b/sysdeps/unix/sysv/linux/net/if_arp.h
index f64dcfd..5013d08 100644
--- a/sysdeps/unix/sysv/linux/net/if_arp.h
+++ b/sysdeps/unix/sysv/linux/net/if_arp.h
@@ -22,9 +22,8 @@
#ifndef _NET_IF_ARP_H
#define _NET_IF_ARP_H 1
-#include <sys/types.h>
+#include <features.h>
#include <sys/socket.h>
-#include <stdint.h>
__BEGIN_DECLS
@@ -171,7 +170,7 @@ struct arpreq_old
struct arpd_request
{
unsigned short int req; /* Request type. */
- uint32_t ip; /* IP address of entry. */
+ __uint32_t ip; /* IP address of entry. */
unsigned long int dev; /* Device entry is tied to. */
unsigned long int stamp;
unsigned long int updated;
diff --git a/sysdeps/unix/sysv/linux/net/if_ppp.h b/sysdeps/unix/sysv/linux/net/if_ppp.h
index 31a20766..1fd813b 100644
--- a/sysdeps/unix/sysv/linux/net/if_ppp.h
+++ b/sysdeps/unix/sysv/linux/net/if_ppp.h
@@ -48,10 +48,10 @@
#ifndef __NET_IF_PPP_H
#define __NET_IF_PPP_H 1
-#include <sys/types.h>
-#include <stdint.h>
-#include <net/if.h>
+#include <features.h>
+#include <bits/types.h>
#include <sys/ioctl.h>
+#include <net/if.h>
#include <net/ppp_defs.h>
__BEGIN_DECLS
@@ -113,8 +113,8 @@ struct npioctl {
/* Structure describing a CCP configuration option, for PPPIOCSCOMPRESS */
struct ppp_option_data {
- uint8_t *ptr;
- uint32_t length;
+ __uint8_t *ptr;
+ __uint32_t length;
int transmit;
};
diff --git a/sysdeps/unix/sysv/linux/net/if_shaper.h b/sysdeps/unix/sysv/linux/net/if_shaper.h
index 77ab630..0ccc2a9 100644
--- a/sysdeps/unix/sysv/linux/net/if_shaper.h
+++ b/sysdeps/unix/sysv/linux/net/if_shaper.h
@@ -18,8 +18,8 @@
#ifndef _NET_IF_SHAPER_H
#define _NET_IF_SHAPER_H 1
-#include <sys/types.h>
-#include <stdint.h>
+#include <features.h>
+#include <bits/types.h>
#include <net/if.h>
#include <sys/ioctl.h>
@@ -43,11 +43,11 @@ __BEGIN_DECLS
struct shaperconf
{
- uint16_t ss_cmd;
+ __uint16_t ss_cmd;
union
{
char ssu_name[14];
- uint32_t ssu_speed;
+ __uint32_t ssu_speed;
} ss_u;
#define ss_speed ss_u.ssu_speed
#define ss_name ss_u.ssu_name
diff --git a/sysdeps/unix/sysv/linux/net/route.h b/sysdeps/unix/sysv/linux/net/route.h
index a6bda21..a0d9a74 100644
--- a/sysdeps/unix/sysv/linux/net/route.h
+++ b/sysdeps/unix/sysv/linux/net/route.h
@@ -21,8 +21,8 @@
#define _NET_ROUTE_H 1
#include <features.h>
+
#include <sys/socket.h>
-#include <sys/types.h>
#include <netinet/in.h>
#include <bits/wordsize.h>
diff --git a/sysdeps/unix/sysv/linux/netatalk/at.h b/sysdeps/unix/sysv/linux/netatalk/at.h
index 61fb675..f78d6b8 100644
--- a/sysdeps/unix/sysv/linux/netatalk/at.h
+++ b/sysdeps/unix/sysv/linux/netatalk/at.h
@@ -18,11 +18,46 @@
#ifndef _NETATALK_AT_H
#define _NETATALK_AT_H 1
-#include <asm/types.h>
+#include <features.h>
+#include <bits/types.h>
#include <bits/sockaddr.h>
-#include <linux/atalk.h>
+
#include <sys/socket.h>
+#include <sys/ioctl.h>
+
+/* Constants from linux/atalk.h as of kernel version 5.0. */
+#define ATPORT_FIRST 1
+#define ATPORT_RESERVED 128
+#define ATPORT_LAST 254 /* 254 is only legal on localtalk */
+#define ATADDR_ANYNET 0
+#define ATADDR_ANYNODE 0
+#define ATADDR_ANYPORT 0
+#define ATADDR_BCAST 255
+#define DDP_MAXSZ 587
+#define DDP_MAXHOPS 15 /* 4 bits of hop counter */
#define SOL_ATALK 258 /* sockopt level for atalk */
+#define SIOCATALKDIFADDR (SIOCPROTOPRIVATE + 0)
+
+struct atalk_addr
+{
+ __uint16_t s_net; /* network byte order */
+ __uint8_t s_node;
+};
+
+struct atalk_netrange
+{
+ __uint8_t nr_phase;
+ __uint16_t nr_firstnet; /* network byte order */
+ __uint16_t nr_lastnet; /* network byte order */
+};
+
+struct sockaddr_at
+{
+ __SOCKADDR_COMMON (sat_);
+ __uint8_t sat_port;
+ struct atalk_addr sat_addr;
+ __uint8_t sat_zero[8];
+};
#endif /* netatalk/at.h */
diff --git a/sysdeps/unix/sysv/linux/netinet/if_ether.h b/sysdeps/unix/sysv/linux/netinet/if_ether.h
index 2c07500..3856905 100644
--- a/sysdeps/unix/sysv/linux/netinet/if_ether.h
+++ b/sysdeps/unix/sysv/linux/netinet/if_ether.h
@@ -57,6 +57,8 @@
* $FreeBSD$
*/
+#include <features.h>
+#include <bits/types.h>
#include <net/ethernet.h>
#include <net/if_arp.h>
@@ -70,10 +72,10 @@ __BEGIN_DECLS
*/
struct ether_arp {
struct arphdr ea_hdr; /* fixed-size header */
- uint8_t arp_sha[ETH_ALEN]; /* sender hardware address */
- uint8_t arp_spa[4]; /* sender protocol address */
- uint8_t arp_tha[ETH_ALEN]; /* target hardware address */
- uint8_t arp_tpa[4]; /* target protocol address */
+ __uint8_t arp_sha[ETH_ALEN]; /* sender hardware address */
+ __uint8_t arp_spa[4]; /* sender protocol address */
+ __uint8_t arp_tha[ETH_ALEN]; /* target hardware address */
+ __uint8_t arp_tpa[4]; /* target protocol address */
};
#define arp_hrd ea_hdr.ar_hrd
#define arp_pro ea_hdr.ar_pro
@@ -88,14 +90,14 @@ struct ether_arp {
*/
#define ETHER_MAP_IP_MULTICAST(ipaddr, enaddr) \
/* struct in_addr *ipaddr; */ \
- /* uint8_t enaddr[ETH_ALEN]; */ \
+ /* __uint8_t enaddr[ETH_ALEN]; */ \
{ \
(enaddr)[0] = 0x01; \
(enaddr)[1] = 0x00; \
(enaddr)[2] = 0x5e; \
- (enaddr)[3] = ((uint8_t *)ipaddr)[1] & 0x7f; \
- (enaddr)[4] = ((uint8_t *)ipaddr)[2]; \
- (enaddr)[5] = ((uint8_t *)ipaddr)[3]; \
+ (enaddr)[3] = ((__uint8_t *)ipaddr)[1] & 0x7f; \
+ (enaddr)[4] = ((__uint8_t *)ipaddr)[2]; \
+ (enaddr)[5] = ((__uint8_t *)ipaddr)[3]; \
}
__END_DECLS
^ permalink raw reply [flat|nested] 2+ messages in thread
* [glibc/zack/no-nested-includes] Minimize includes by networking headers 1/n: resolv, ethernet, atalk
@ 2019-06-18 15:36 Zack Weinberg
0 siblings, 0 replies; 2+ messages in thread
From: Zack Weinberg @ 2019-06-18 15:36 UTC (permalink / raw)
To: glibc-cvs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="us-ascii", Size: 24371 bytes --]
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=5dfe7764f0cd3a2a5165e53497a0efeedc99ae2c
commit 5dfe7764f0cd3a2a5165e53497a0efeedc99ae2c
Author: Zack Weinberg <zackw@panix.com>
Date: Sat Jun 1 19:32:01 2019 -0400
Minimize includes by networking headers 1/n: resolv, ethernet, atalk
The networking headers are messy and complicated so Iâm doing the
inclusion minimization in small batches. This does everything that
sorts alphabetically before netinet/.
* resolv/resolv.h: Include bits/types.h, bits/types/FILE.h,
and bits/types/size_t.h; donât include sys/param.h, sys/types.h,
or stdio.h. Use __uint16_t and __uint32_t instead of uint16_t and
uint32_t.
* resolv/arpa/nameser.h: Include features.h, bits/types.h, and
bits/types/size_t.h; donât include sys/param.h, sys/types.h, or
stdint.h. Use __uint16_t and __uint32_t instead of uint16_t and
uint32_t.
* resolv/arpa/nameser_compat.h: Include features.h.
* sysdeps/mach/hurd/net/ethernet.h: Include bits/types.h;
donât include sys/types.h or stdint.h. Use __uint8_t and
__uint16_t instead of uint8_t and uint16_t.
* sysdeps/unix/sysv/linux/net/ethernet.h: Include features.h and
bits/types.h; donât include sys/types.h or stdint.h.
Use __uint8_t and __uint16_t instead of uint8_t and uint16_t.
* sysdeps/unix/sysv/linux/netinet/if_ether.h: Include features.h
and bits/types.h. Use __uint8_t instead of uint8_t.
* sysdeps/mach/hurd/net/if_arp.h: Donât include sys/types.h or
stdint.h. Use __uint32_t instead of uint32_t.
* sysdeps/unix/sysv/linux/net/if_arp.h: Include features.h.
Donât include sys/types.h or stdint.h. Use __uint32_t instead of
uint32_t.
* sysdeps/mach/hurd/net/route.h: Donât include sys/types.h.
* sysdeps/unix/sysv/linux/net/route.h: Donât include sys/types.h.
* sysdeps/unix/sysv/linux/net/if_ppp.h: Include features.h and
bits/types.h. Donât include sys/types.h or stdint.h. Use
__uint8_t and __uint32_t instead of uint8_t and uint32_t.
* sysdeps/unix/sysv/linux/net/if_shaper.h: Include features.h and
bits/types.h. Donât include sys/types.h or stdint.h. Use
__uint16_t and __uint32_t instead of uint16_t and uint32_t.
* sysdeps/unix/sysv/linux/netatalk/at.h: Include features.h,
bits/types.h, and sys/ioctl.h. Donât include asm/types.h or
linux/atalk.h. Copy over all user-appropriate definitions from
linux/atalk.h with adjustments for glibc context.
* grp/initgroups.c, nscd/initgrcache.c, nss/nss_db/db-XXX.c
* resolv/ns_print.c, resolv/tst-ns_name_compress.c
* resolv/tst-res_hnok.c, support/resolv_test.c:
Include stdio.h.
* nscd/initgrcache.c, nscd/netgroupcache.c
* nss/nss_compat/compat-grp.c, nss/nss_compat/compat-pwd.c
* nss/nss_compat/compat-spwd.c, resolv/ns_print.c:
Include sys/param.h for MIN and/or MAX.
* resolv/tst-resolv-res_init-skeleton.c: Include signal.h.
* scripts/check-obsolete-constructs.py
(HEADER_ALLOWED_INCLUDES, SYSDEP_ALLOWED_INCLUDES): Update.
Diff:
---
grp/initgroups.c | 1 +
nscd/initgrcache.c | 2 ++
nscd/netgroupcache.c | 1 +
nss/nss_compat/compat-grp.c | 1 +
nss/nss_compat/compat-pwd.c | 1 +
nss/nss_compat/compat-spwd.c | 1 +
nss/nss_db/db-XXX.c | 1 +
resolv/arpa/nameser.h | 34 +++++++++++++-------------
resolv/arpa/nameser_compat.h | 1 +
resolv/ns_print.c | 2 ++
resolv/resolv.h | 13 +++++-----
resolv/tst-ns_name_compress.c | 1 +
resolv/tst-res_hnok.c | 1 +
resolv/tst-resolv-res_init-skeleton.c | 1 +
scripts/check-obsolete-constructs.py | 27 ++++++++-------------
support/resolv_test.c | 1 +
sysdeps/mach/hurd/net/ethernet.h | 12 ++++-----
sysdeps/mach/hurd/net/if_arp.h | 5 +---
sysdeps/mach/hurd/net/route.h | 3 +--
sysdeps/unix/sysv/linux/net/ethernet.h | 12 ++++-----
sysdeps/unix/sysv/linux/net/if_arp.h | 5 ++--
sysdeps/unix/sysv/linux/net/if_ppp.h | 10 ++++----
sysdeps/unix/sysv/linux/net/if_shaper.h | 8 +++---
sysdeps/unix/sysv/linux/net/route.h | 2 +-
sysdeps/unix/sysv/linux/netatalk/at.h | 39 ++++++++++++++++++++++++++++--
sysdeps/unix/sysv/linux/netinet/if_ether.h | 18 ++++++++------
26 files changed, 121 insertions(+), 82 deletions(-)
diff --git a/grp/initgroups.c b/grp/initgroups.c
index a22f33c..6edfb0a 100644
--- a/grp/initgroups.c
+++ b/grp/initgroups.c
@@ -19,6 +19,7 @@
#include <errno.h>
#include <grp.h>
#include <limits.h>
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
diff --git a/nscd/initgrcache.c b/nscd/initgrcache.c
index cf38c59..6786665 100644
--- a/nscd/initgrcache.c
+++ b/nscd/initgrcache.c
@@ -20,10 +20,12 @@
#include <errno.h>
#include <grp.h>
#include <libintl.h>
+#include <stdio.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <sys/mman.h>
+#include <sys/param.h>
#include <scratch_buffer.h>
#include <config.h>
diff --git a/nscd/netgroupcache.c b/nscd/netgroupcache.c
index cda276e..8fcb092 100644
--- a/nscd/netgroupcache.c
+++ b/nscd/netgroupcache.c
@@ -24,6 +24,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <sys/mman.h>
+#include <sys/param.h>
#include "../inet/netgroup.h"
#include "nscd.h"
diff --git a/nss/nss_compat/compat-grp.c b/nss/nss_compat/compat-grp.c
index 8f01e44..c46a0dc 100644
--- a/nss/nss_compat/compat-grp.c
+++ b/nss/nss_compat/compat-grp.c
@@ -24,6 +24,7 @@
#include <nsswitch.h>
#include <stdio_ext.h>
#include <string.h>
+#include <sys/param.h>
#include <libc-lock.h>
#include <kernel-features.h>
diff --git a/nss/nss_compat/compat-pwd.c b/nss/nss_compat/compat-pwd.c
index 37f883f..4b6734a 100644
--- a/nss/nss_compat/compat-pwd.c
+++ b/nss/nss_compat/compat-pwd.c
@@ -25,6 +25,7 @@
#include <pwd.h>
#include <stdio_ext.h>
#include <string.h>
+#include <sys/param.h>
#include <libc-lock.h>
#include <kernel-features.h>
diff --git a/nss/nss_compat/compat-spwd.c b/nss/nss_compat/compat-spwd.c
index bd310ab..3eaa6e8 100644
--- a/nss/nss_compat/compat-spwd.c
+++ b/nss/nss_compat/compat-spwd.c
@@ -25,6 +25,7 @@
#include <shadow.h>
#include <stdio_ext.h>
#include <string.h>
+#include <sys/param.h>
#include <libc-lock.h>
#include <kernel-features.h>
diff --git a/nss/nss_db/db-XXX.c b/nss/nss_db/db-XXX.c
index e17bbff..ac3586e 100644
--- a/nss/nss_db/db-XXX.c
+++ b/nss/nss_db/db-XXX.c
@@ -18,6 +18,7 @@
#include <dlfcn.h>
#include <fcntl.h>
+#include <stdio.h>
#include <stdint.h>
#include <sys/mman.h>
#include <libc-lock.h>
diff --git a/resolv/arpa/nameser.h b/resolv/arpa/nameser.h
index a99d5ec..4ce57bd 100644
--- a/resolv/arpa/nameser.h
+++ b/resolv/arpa/nameser.h
@@ -48,9 +48,9 @@
#ifndef _ARPA_NAMESER_H_
#define _ARPA_NAMESER_H_
-#include <sys/param.h>
-#include <sys/types.h>
-#include <stdint.h>
+#include <features.h>
+#include <bits/types.h>
+#include <bits/types/size_t.h>
/*
* Define constants based on RFC 883, RFC 1034, RFC 1035
@@ -92,7 +92,7 @@ typedef enum __ns_sect {
*/
typedef struct __ns_msg {
const unsigned char *_msg, *_eom;
- uint16_t _id, _flags, _counts[ns_s_max];
+ __uint16_t _id, _flags, _counts[ns_s_max];
const unsigned char *_sections[ns_s_max];
ns_sect _sect;
int _rrnum;
@@ -116,10 +116,10 @@ extern const struct _ns_flagdata _ns_flagdata[];
*/
typedef struct __ns_rr {
char name[NS_MAXDNAME];
- uint16_t type;
- uint16_t rr_class;
- uint32_t ttl;
- uint16_t rdlength;
+ __uint16_t type;
+ __uint16_t rr_class;
+ __uint32_t ttl;
+ __uint16_t rdlength;
const unsigned char * rdata;
} ns_rr;
@@ -355,24 +355,24 @@ typedef enum __ns_cert_types {
*/
#define NS_GET16(s, cp) do { \
const unsigned char *t_cp = (const unsigned char *)(cp); \
- (s) = ((uint16_t)t_cp[0] << 8) \
- | ((uint16_t)t_cp[1]) \
+ (s) = ((__uint16_t)t_cp[0] << 8) \
+ | ((__uint16_t)t_cp[1]) \
; \
(cp) += NS_INT16SZ; \
} while (0)
#define NS_GET32(l, cp) do { \
const unsigned char *t_cp = (const unsigned char *)(cp); \
- (l) = ((uint32_t)t_cp[0] << 24) \
- | ((uint32_t)t_cp[1] << 16) \
- | ((uint32_t)t_cp[2] << 8) \
- | ((uint32_t)t_cp[3]) \
+ (l) = ((__uint32_t)t_cp[0] << 24) \
+ | ((__uint32_t)t_cp[1] << 16) \
+ | ((__uint32_t)t_cp[2] << 8) \
+ | ((__uint32_t)t_cp[3]) \
; \
(cp) += NS_INT32SZ; \
} while (0)
#define NS_PUT16(s, cp) do { \
- uint16_t t_s = (uint16_t)(s); \
+ __uint16_t t_s = (__uint16_t)(s); \
unsigned char *t_cp = (unsigned char *)(cp); \
*t_cp++ = t_s >> 8; \
*t_cp = t_s; \
@@ -380,7 +380,7 @@ typedef enum __ns_cert_types {
} while (0)
#define NS_PUT32(l, cp) do { \
- uint32_t t_l = (uint32_t)(l); \
+ __uint32_t t_l = (__uint32_t)(l); \
unsigned char *t_cp = (unsigned char *)(cp); \
*t_cp++ = t_l >> 24; \
*t_cp++ = t_l >> 16; \
@@ -408,7 +408,7 @@ int ns_sprintrrf (const unsigned char *, size_t, const char *,
const char *, char *, size_t) __THROW;
int ns_format_ttl (unsigned long, char *, size_t) __THROW;
int ns_parse_ttl (const char *, unsigned long *) __THROW;
-uint32_t ns_datetosecs (const char *, int *) __THROW;
+__uint32_t ns_datetosecs (const char *, int *) __THROW;
int ns_name_ntol (const unsigned char *, unsigned char *, size_t)
__THROW;
int ns_name_ntop (const unsigned char *, char *, size_t) __THROW;
diff --git a/resolv/arpa/nameser_compat.h b/resolv/arpa/nameser_compat.h
index 37c178b..8996d37 100644
--- a/resolv/arpa/nameser_compat.h
+++ b/resolv/arpa/nameser_compat.h
@@ -29,6 +29,7 @@
#ifndef _ARPA_NAMESER_COMPAT_
#define _ARPA_NAMESER_COMPAT_
+#include <features.h>
#include <bits/endian.h>
/*%
diff --git a/resolv/ns_print.c b/resolv/ns_print.c
index d61f504..1dbcfb8 100644
--- a/resolv/ns_print.c
+++ b/resolv/ns_print.c
@@ -19,6 +19,7 @@
/* Import. */
#include <sys/types.h>
+#include <sys/param.h>
#include <sys/socket.h>
#include <netinet/in.h>
@@ -28,6 +29,7 @@
#include <assert.h>
#include <errno.h>
#include <resolv.h>
+#include <stdio.h>
#include <string.h>
#include <ctype.h>
diff --git a/resolv/resolv.h b/resolv/resolv.h
index b4ef66f..5783de6 100644
--- a/resolv/resolv.h
+++ b/resolv/resolv.h
@@ -54,11 +54,12 @@
#include <features.h>
-#include <sys/param.h>
-#include <sys/types.h>
-#include <stdio.h>
#include <netinet/in.h>
#include <arpa/nameser.h>
+
+#include <bits/types.h>
+#include <bits/types/FILE.h>
+#include <bits/types/size_t.h>
#include <bits/types/res_state.h>
/*
@@ -248,10 +249,10 @@ int loc_aton (const char *__ascii, unsigned char *__binary) __THROW;
const char * loc_ntoa (const unsigned char *__binary, char *__ascii) __THROW;
int dn_skipname (const unsigned char *, const unsigned char *)
__THROW;
-void putlong (uint32_t, unsigned char *) __THROW;
-void putshort (uint16_t, unsigned char *) __THROW;
+void putlong (__uint32_t, unsigned char *) __THROW;
+void putshort (__uint16_t, unsigned char *) __THROW;
const char * p_class (int) __THROW;
-const char * p_time (uint32_t) __THROW;
+const char * p_time (__uint32_t) __THROW;
const char * p_type (int) __THROW;
const char * p_rcode (int) __THROW;
const unsigned char * p_cdnname (const unsigned char *,
diff --git a/resolv/tst-ns_name_compress.c b/resolv/tst-ns_name_compress.c
index 00b6e81..019edf7 100644
--- a/resolv/tst-ns_name_compress.c
+++ b/resolv/tst-ns_name_compress.c
@@ -17,6 +17,7 @@
<http://www.gnu.org/licenses/>. */
#include <resolv.h>
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <support/check.h>
diff --git a/resolv/tst-res_hnok.c b/resolv/tst-res_hnok.c
index a85449d..3bc1816 100644
--- a/resolv/tst-res_hnok.c
+++ b/resolv/tst-res_hnok.c
@@ -18,6 +18,7 @@
#include <array_length.h>
#include <resolv.h>
+#include <stdio.h>
#include <string.h>
#include <support/check.h>
#include <support/test-driver.h>
diff --git a/resolv/tst-resolv-res_init-skeleton.c b/resolv/tst-resolv-res_init-skeleton.c
index 678f396..32a7907 100644
--- a/resolv/tst-resolv-res_init-skeleton.c
+++ b/resolv/tst-resolv-res_init-skeleton.c
@@ -25,6 +25,7 @@
#include <gnu/lib-names.h>
#include <netdb.h>
#include <resolv/resolv_context.h>
+#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <support/capture_subprocess.h>
diff --git a/scripts/check-obsolete-constructs.py b/scripts/check-obsolete-constructs.py
index f7db88d..288d4e5 100755
--- a/scripts/check-obsolete-constructs.py
+++ b/scripts/check-obsolete-constructs.py
@@ -609,23 +609,17 @@ HEADER_ALLOWED_INCLUDES = {
# Nonstandardized networking headers
"ifaddrs.h": [ "sys/socket.h" ],
- "resolv.h": [ "arpa/nameser.h", "netinet/in.h",
- "stdio.h", "sys/param.h",
- "sys/types.h" ],
- "arpa/nameser.h": [ "arpa/nameser_compat.h", "stdint.h",
- "sys/param.h", "sys/types.h" ],
- "net/ethernet.h": [ "stdint.h", "sys/types.h",
- "net/if_ether.h" ],
- "net/if_arp.h": [ "stdint.h", "sys/socket.h",
- "sys/types.h" ],
- "net/if_ppp.h": [ "net/if.h", "net/ppp_defs.h", "stdint.h",
- "sys/ioctl.h", "sys/types.h" ],
- "net/if_shaper.h": [ "net/if.h", "stdint.h", "sys/ioctl.h",
- "sys/types.h" ],
- "net/route.h": [ "netinet/in.h", "sys/socket.h",
- "sys/types.h" ],
- "netatalk/at.h": [ "sys/socket.h" ],
+ "resolv.h": [ "arpa/nameser.h", "netinet/in.h" ],
+ "arpa/nameser.h": [ "arpa/nameser_compat.h" ],
+
+ "net/ethernet.h": [ "stdint.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" ],
"netinet/ether.h": [ "netinet/if_ether.h" ],
"netinet/icmp6.h": [ "inttypes.h", "netinet/in.h", "string.h",
"sys/types.h" ],
@@ -688,7 +682,6 @@ SYSDEP_ALLOWED_INCLUDES = {
"net/ethernet.h": [ "linux/if_ether.h" ],
"net/if_slip.h": [ "linux/if_slip.h" ],
"net/ppp_defs.h": [ "asm/types.h", "linux/ppp_defs.h" ],
- "netatalk/at.h": [ "asm/types.h", "linux/atalk.h" ],
"netinet/if_ether.h": [ "linux/if_ether.h" ],
"netinet/if_fddi.h": [ "linux/if_fddi.h" ],
diff --git a/support/resolv_test.c b/support/resolv_test.c
index 903ab2a..45d8ec7 100644
--- a/support/resolv_test.c
+++ b/support/resolv_test.c
@@ -24,6 +24,7 @@
#include <nss.h>
#include <resolv.h>
#include <search.h>
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <support/check.h>
diff --git a/sysdeps/mach/hurd/net/ethernet.h b/sysdeps/mach/hurd/net/ethernet.h
index 8956694..3003523 100644
--- a/sysdeps/mach/hurd/net/ethernet.h
+++ b/sysdeps/mach/hurd/net/ethernet.h
@@ -22,9 +22,7 @@
#define __NET_ETHERNET_H 1
#include <features.h>
-
-#include <sys/types.h>
-#include <stdint.h>
+#include <bits/types.h>
#include <net/if_ether.h> /* IEEE 802.3 Ethernet constants */
__BEGIN_DECLS
@@ -33,15 +31,15 @@ __BEGIN_DECLS
systems. */
struct ether_addr
{
- uint8_t ether_addr_octet[ETH_ALEN];
+ __uint8_t ether_addr_octet[ETH_ALEN];
};
/* 10Mb/s ethernet header */
struct ether_header
{
- uint8_t ether_dhost[ETH_ALEN]; /* destination eth addr */
- uint8_t ether_shost[ETH_ALEN]; /* source ether addr */
- uint16_t ether_type; /* packet type ID field */
+ __uint8_t ether_dhost[ETH_ALEN]; /* destination eth addr */
+ __uint8_t ether_shost[ETH_ALEN]; /* source ether addr */
+ __uint16_t ether_type; /* packet type ID field */
};
/* Ethernet protocol ID's */
diff --git a/sysdeps/mach/hurd/net/if_arp.h b/sysdeps/mach/hurd/net/if_arp.h
index 9e1b223..38665fe 100644
--- a/sysdeps/mach/hurd/net/if_arp.h
+++ b/sysdeps/mach/hurd/net/if_arp.h
@@ -23,10 +23,7 @@
#define _NET_IF_ARP_H 1
#include <features.h>
-
-#include <sys/types.h>
#include <sys/socket.h>
-#include <stdint.h>
__BEGIN_DECLS
@@ -133,7 +130,7 @@ struct arpreq
struct arpd_request
{
unsigned short int req; /* Request type. */
- uint32_t ip; /* IP address of entry. */
+ __uint32_t ip; /* IP address of entry. */
unsigned long int dev; /* Device entry is tied to. */
unsigned long int stamp;
unsigned long int updated;
diff --git a/sysdeps/mach/hurd/net/route.h b/sysdeps/mach/hurd/net/route.h
index 4924f09..fcb79bb 100644
--- a/sysdeps/mach/hurd/net/route.h
+++ b/sysdeps/mach/hurd/net/route.h
@@ -18,12 +18,11 @@
/* Based on the 4.4BSD and Linux version of this file. */
#ifndef _NET_ROUTE_H
-
#define _NET_ROUTE_H 1
+
#include <features.h>
#include <sys/socket.h>
-#include <sys/types.h>
#include <netinet/in.h>
diff --git a/sysdeps/unix/sysv/linux/net/ethernet.h b/sysdeps/unix/sysv/linux/net/ethernet.h
index 7e49297..1833511 100644
--- a/sysdeps/unix/sysv/linux/net/ethernet.h
+++ b/sysdeps/unix/sysv/linux/net/ethernet.h
@@ -21,8 +21,8 @@
#ifndef __NET_ETHERNET_H
#define __NET_ETHERNET_H 1
-#include <sys/types.h>
-#include <stdint.h>
+#include <features.h>
+#include <bits/types.h>
#include <linux/if_ether.h> /* IEEE 802.3 Ethernet constants */
@@ -32,15 +32,15 @@ __BEGIN_DECLS
systems. */
struct ether_addr
{
- uint8_t ether_addr_octet[ETH_ALEN];
+ __uint8_t ether_addr_octet[ETH_ALEN];
} __attribute__ ((__packed__));
/* 10Mb/s ethernet header */
struct ether_header
{
- uint8_t ether_dhost[ETH_ALEN]; /* destination eth addr */
- uint8_t ether_shost[ETH_ALEN]; /* source ether addr */
- uint16_t ether_type; /* packet type ID field */
+ __uint8_t ether_dhost[ETH_ALEN]; /* destination eth addr */
+ __uint8_t ether_shost[ETH_ALEN]; /* source ether addr */
+ __uint16_t ether_type; /* packet type ID field */
} __attribute__ ((__packed__));
/* Ethernet protocol ID's */
diff --git a/sysdeps/unix/sysv/linux/net/if_arp.h b/sysdeps/unix/sysv/linux/net/if_arp.h
index f64dcfd..5013d08 100644
--- a/sysdeps/unix/sysv/linux/net/if_arp.h
+++ b/sysdeps/unix/sysv/linux/net/if_arp.h
@@ -22,9 +22,8 @@
#ifndef _NET_IF_ARP_H
#define _NET_IF_ARP_H 1
-#include <sys/types.h>
+#include <features.h>
#include <sys/socket.h>
-#include <stdint.h>
__BEGIN_DECLS
@@ -171,7 +170,7 @@ struct arpreq_old
struct arpd_request
{
unsigned short int req; /* Request type. */
- uint32_t ip; /* IP address of entry. */
+ __uint32_t ip; /* IP address of entry. */
unsigned long int dev; /* Device entry is tied to. */
unsigned long int stamp;
unsigned long int updated;
diff --git a/sysdeps/unix/sysv/linux/net/if_ppp.h b/sysdeps/unix/sysv/linux/net/if_ppp.h
index 31a20766..1fd813b 100644
--- a/sysdeps/unix/sysv/linux/net/if_ppp.h
+++ b/sysdeps/unix/sysv/linux/net/if_ppp.h
@@ -48,10 +48,10 @@
#ifndef __NET_IF_PPP_H
#define __NET_IF_PPP_H 1
-#include <sys/types.h>
-#include <stdint.h>
-#include <net/if.h>
+#include <features.h>
+#include <bits/types.h>
#include <sys/ioctl.h>
+#include <net/if.h>
#include <net/ppp_defs.h>
__BEGIN_DECLS
@@ -113,8 +113,8 @@ struct npioctl {
/* Structure describing a CCP configuration option, for PPPIOCSCOMPRESS */
struct ppp_option_data {
- uint8_t *ptr;
- uint32_t length;
+ __uint8_t *ptr;
+ __uint32_t length;
int transmit;
};
diff --git a/sysdeps/unix/sysv/linux/net/if_shaper.h b/sysdeps/unix/sysv/linux/net/if_shaper.h
index 77ab630..0ccc2a9 100644
--- a/sysdeps/unix/sysv/linux/net/if_shaper.h
+++ b/sysdeps/unix/sysv/linux/net/if_shaper.h
@@ -18,8 +18,8 @@
#ifndef _NET_IF_SHAPER_H
#define _NET_IF_SHAPER_H 1
-#include <sys/types.h>
-#include <stdint.h>
+#include <features.h>
+#include <bits/types.h>
#include <net/if.h>
#include <sys/ioctl.h>
@@ -43,11 +43,11 @@ __BEGIN_DECLS
struct shaperconf
{
- uint16_t ss_cmd;
+ __uint16_t ss_cmd;
union
{
char ssu_name[14];
- uint32_t ssu_speed;
+ __uint32_t ssu_speed;
} ss_u;
#define ss_speed ss_u.ssu_speed
#define ss_name ss_u.ssu_name
diff --git a/sysdeps/unix/sysv/linux/net/route.h b/sysdeps/unix/sysv/linux/net/route.h
index a6bda21..a0d9a74 100644
--- a/sysdeps/unix/sysv/linux/net/route.h
+++ b/sysdeps/unix/sysv/linux/net/route.h
@@ -21,8 +21,8 @@
#define _NET_ROUTE_H 1
#include <features.h>
+
#include <sys/socket.h>
-#include <sys/types.h>
#include <netinet/in.h>
#include <bits/wordsize.h>
diff --git a/sysdeps/unix/sysv/linux/netatalk/at.h b/sysdeps/unix/sysv/linux/netatalk/at.h
index 61fb675..f78d6b8 100644
--- a/sysdeps/unix/sysv/linux/netatalk/at.h
+++ b/sysdeps/unix/sysv/linux/netatalk/at.h
@@ -18,11 +18,46 @@
#ifndef _NETATALK_AT_H
#define _NETATALK_AT_H 1
-#include <asm/types.h>
+#include <features.h>
+#include <bits/types.h>
#include <bits/sockaddr.h>
-#include <linux/atalk.h>
+
#include <sys/socket.h>
+#include <sys/ioctl.h>
+
+/* Constants from linux/atalk.h as of kernel version 5.0. */
+#define ATPORT_FIRST 1
+#define ATPORT_RESERVED 128
+#define ATPORT_LAST 254 /* 254 is only legal on localtalk */
+#define ATADDR_ANYNET 0
+#define ATADDR_ANYNODE 0
+#define ATADDR_ANYPORT 0
+#define ATADDR_BCAST 255
+#define DDP_MAXSZ 587
+#define DDP_MAXHOPS 15 /* 4 bits of hop counter */
#define SOL_ATALK 258 /* sockopt level for atalk */
+#define SIOCATALKDIFADDR (SIOCPROTOPRIVATE + 0)
+
+struct atalk_addr
+{
+ __uint16_t s_net; /* network byte order */
+ __uint8_t s_node;
+};
+
+struct atalk_netrange
+{
+ __uint8_t nr_phase;
+ __uint16_t nr_firstnet; /* network byte order */
+ __uint16_t nr_lastnet; /* network byte order */
+};
+
+struct sockaddr_at
+{
+ __SOCKADDR_COMMON (sat_);
+ __uint8_t sat_port;
+ struct atalk_addr sat_addr;
+ __uint8_t sat_zero[8];
+};
#endif /* netatalk/at.h */
diff --git a/sysdeps/unix/sysv/linux/netinet/if_ether.h b/sysdeps/unix/sysv/linux/netinet/if_ether.h
index 2c07500..3856905 100644
--- a/sysdeps/unix/sysv/linux/netinet/if_ether.h
+++ b/sysdeps/unix/sysv/linux/netinet/if_ether.h
@@ -57,6 +57,8 @@
* $FreeBSD$
*/
+#include <features.h>
+#include <bits/types.h>
#include <net/ethernet.h>
#include <net/if_arp.h>
@@ -70,10 +72,10 @@ __BEGIN_DECLS
*/
struct ether_arp {
struct arphdr ea_hdr; /* fixed-size header */
- uint8_t arp_sha[ETH_ALEN]; /* sender hardware address */
- uint8_t arp_spa[4]; /* sender protocol address */
- uint8_t arp_tha[ETH_ALEN]; /* target hardware address */
- uint8_t arp_tpa[4]; /* target protocol address */
+ __uint8_t arp_sha[ETH_ALEN]; /* sender hardware address */
+ __uint8_t arp_spa[4]; /* sender protocol address */
+ __uint8_t arp_tha[ETH_ALEN]; /* target hardware address */
+ __uint8_t arp_tpa[4]; /* target protocol address */
};
#define arp_hrd ea_hdr.ar_hrd
#define arp_pro ea_hdr.ar_pro
@@ -88,14 +90,14 @@ struct ether_arp {
*/
#define ETHER_MAP_IP_MULTICAST(ipaddr, enaddr) \
/* struct in_addr *ipaddr; */ \
- /* uint8_t enaddr[ETH_ALEN]; */ \
+ /* __uint8_t enaddr[ETH_ALEN]; */ \
{ \
(enaddr)[0] = 0x01; \
(enaddr)[1] = 0x00; \
(enaddr)[2] = 0x5e; \
- (enaddr)[3] = ((uint8_t *)ipaddr)[1] & 0x7f; \
- (enaddr)[4] = ((uint8_t *)ipaddr)[2]; \
- (enaddr)[5] = ((uint8_t *)ipaddr)[3]; \
+ (enaddr)[3] = ((__uint8_t *)ipaddr)[1] & 0x7f; \
+ (enaddr)[4] = ((__uint8_t *)ipaddr)[2]; \
+ (enaddr)[5] = ((__uint8_t *)ipaddr)[3]; \
}
__END_DECLS
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-06-18 15:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-05 12:25 [glibc/zack/no-nested-includes] Minimize includes by networking headers 1/n: resolv, ethernet, atalk Zack Weinberg
2019-06-18 15:36 Zack Weinberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).