[klibc] [klibc:master] include: Always include <sys/types.h> instead of <linux/types.h>
klibc-bot for Ben Hutchings
ben at decadent.org.uk
Mon Dec 27 09:18:06 PST 2021
Commit-ID: d96dc346ee46d205e01ee363a7f0d9c1b394371a
Gitweb: http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=d96dc346ee46d205e01ee363a7f0d9c1b394371a
Author: Ben Hutchings <ben at decadent.org.uk>
AuthorDate: Mon, 27 Dec 2021 17:32:15 +0100
Committer: Ben Hutchings <ben at decadent.org.uk>
CommitDate: Mon, 27 Dec 2021 17:34:36 +0100
[klibc] include: Always include <sys/types.h> instead of <linux/types.h>
Many of our header files indirectly include <linux/types.h>, which can
conflict with our <sys/types.h>. In particular:
In file included from /usr/lib/klibc/include/linux/byteorder/little_endian.h:12,
from /usr/lib/klibc/include/asm/byteorder.h:5,
from /usr/lib/klibc/include/byteswap.h:9,
from <stdin>:1:
/usr/lib/klibc/include/linux/types.h:22: warning: "__bitwise" redefined
22 | #define __bitwise __bitwise__
|
In file included from /usr/lib/klibc/include/byteswap.h:8,
from <stdin>:1:
/usr/lib/klibc/include/klibc/compiler.h:144: note: this is the location of the previous definition
144 | # define __bitwise
|
If our <sys/types.h> is included first, it defines the header
guard macro for <linux/types.h>, avoiding any conflict. So
include <sys/types.h> first in each of these headers.
Signed-off-by: Ben Hutchings <ben at decadent.org.uk>
---
usr/include/byteswap.h | 2 +-
usr/include/klibc/endian.h | 2 +-
usr/include/net/if_packet.h | 1 +
usr/include/net/route.h | 1 +
usr/include/netinet/if_ether.h | 1 +
usr/include/netinet/in.h | 1 +
usr/include/netinet/in6.h | 1 +
usr/include/netpacket/packet.h | 1 +
usr/include/sys/capability.h | 1 +
usr/include/sys/ioctl.h | 1 +
usr/include/sys/md.h | 2 ++
usr/include/sys/prctl.h | 1 +
usr/include/sys/sysinfo.h | 1 +
usr/include/sys/utime.h | 1 +
14 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/usr/include/byteswap.h b/usr/include/byteswap.h
index 6f41a28b..d70f1f9a 100644
--- a/usr/include/byteswap.h
+++ b/usr/include/byteswap.h
@@ -5,7 +5,7 @@
#ifndef _BYTESWAP_H
#define _BYTESWAP_H
-#include <klibc/compiler.h>
+#include <sys/types.h>
#include <asm/byteorder.h>
#define bswap_16(x) __swab16(x)
diff --git a/usr/include/klibc/endian.h b/usr/include/klibc/endian.h
index 99563de7..8586888a 100644
--- a/usr/include/klibc/endian.h
+++ b/usr/include/klibc/endian.h
@@ -7,7 +7,7 @@
#ifndef _KLIBC_ENDIAN_H
#define _KLIBC_ENDIAN_H
-#include <klibc/compiler.h>
+#include <sys/types.h>
#include <asm/byteorder.h>
/* Linux' asm/byteorder.h defines either __LITTLE_ENDIAN or
diff --git a/usr/include/net/if_packet.h b/usr/include/net/if_packet.h
index b5e8e0e1..33ee0aad 100644
--- a/usr/include/net/if_packet.h
+++ b/usr/include/net/if_packet.h
@@ -1 +1,2 @@
+#include <sys/types.h>
#include <linux/if_packet.h>
diff --git a/usr/include/net/route.h b/usr/include/net/route.h
index a60df24c..8b4305b2 100644
--- a/usr/include/net/route.h
+++ b/usr/include/net/route.h
@@ -1 +1,2 @@
+#include <sys/types.h>
#include <linux/route.h>
diff --git a/usr/include/netinet/if_ether.h b/usr/include/netinet/if_ether.h
index 060ef220..a0b8cdee 100644
--- a/usr/include/netinet/if_ether.h
+++ b/usr/include/netinet/if_ether.h
@@ -1 +1,2 @@
+#include <sys/types.h>
#include <linux/if_ether.h>
diff --git a/usr/include/netinet/in.h b/usr/include/netinet/in.h
index 2952bb2a..7a13d2d8 100644
--- a/usr/include/netinet/in.h
+++ b/usr/include/netinet/in.h
@@ -5,6 +5,7 @@
#ifndef _NETINET_IN_H
#define _NETINET_IN_H
+#include <sys/types.h>
#include <klibc/extern.h>
#include <stdint.h>
#include <endian.h> /* Must be included *before* <linux/in.h> */
diff --git a/usr/include/netinet/in6.h b/usr/include/netinet/in6.h
index 7e6da92e..91a4e126 100644
--- a/usr/include/netinet/in6.h
+++ b/usr/include/netinet/in6.h
@@ -5,6 +5,7 @@
#ifndef _NETINET_IN6_H
#define _NETINET_IN6_H
+#include <sys/types.h>
#include <linux/in6.h>
#endif /* _NETINET_IN6_H */
diff --git a/usr/include/netpacket/packet.h b/usr/include/netpacket/packet.h
index b5e8e0e1..33ee0aad 100644
--- a/usr/include/netpacket/packet.h
+++ b/usr/include/netpacket/packet.h
@@ -1 +1,2 @@
+#include <sys/types.h>
#include <linux/if_packet.h>
diff --git a/usr/include/sys/capability.h b/usr/include/sys/capability.h
index 41b5b4ac..8b929846 100644
--- a/usr/include/sys/capability.h
+++ b/usr/include/sys/capability.h
@@ -1,6 +1,7 @@
#ifndef _SYS_CAPABILITY_H
#define _SYS_CAPABILITY_H
+#include <sys/types.h>
#include <klibc/extern.h>
#include <linux/capability.h>
diff --git a/usr/include/sys/ioctl.h b/usr/include/sys/ioctl.h
index 81ae7561..7b0b687d 100644
--- a/usr/include/sys/ioctl.h
+++ b/usr/include/sys/ioctl.h
@@ -5,6 +5,7 @@
#ifndef _SYS_IOCTL_H
#define _SYS_IOCTL_H
+#include <sys/types.h>
#include <klibc/extern.h>
#include <linux/ioctl.h>
#include <asm/ioctls.h>
diff --git a/usr/include/sys/md.h b/usr/include/sys/md.h
index 184e4aae..63be3d88 100644
--- a/usr/include/sys/md.h
+++ b/usr/include/sys/md.h
@@ -21,6 +21,8 @@
#ifndef _SYS_MD_H
#define _SYS_MD_H
+#include <sys/types.h>
+
#define LEVEL_MULTIPATH (-4)
#define LEVEL_LINEAR (-1)
#define LEVEL_FAULTY (-5)
diff --git a/usr/include/sys/prctl.h b/usr/include/sys/prctl.h
index c12c191f..b0f41f54 100644
--- a/usr/include/sys/prctl.h
+++ b/usr/include/sys/prctl.h
@@ -1,6 +1,7 @@
#ifndef _SYS_PRCTL_H
#define _SYS_PRCTL_H
+#include <sys/types.h>
#include <klibc/extern.h>
#include <linux/prctl.h>
diff --git a/usr/include/sys/sysinfo.h b/usr/include/sys/sysinfo.h
index dba68dc6..8469ba0a 100644
--- a/usr/include/sys/sysinfo.h
+++ b/usr/include/sys/sysinfo.h
@@ -5,6 +5,7 @@
#ifndef _SYS_SYSINFO_H
#define _SYS_SYSINFO_H
+#include <sys/types.h>
#include <linux/kernel.h>
extern int sysinfo(struct sysinfo *info);
diff --git a/usr/include/sys/utime.h b/usr/include/sys/utime.h
index 56288a86..55415dbe 100644
--- a/usr/include/sys/utime.h
+++ b/usr/include/sys/utime.h
@@ -5,6 +5,7 @@
#ifndef _SYS_UTIME_H
#define _SYS_UTIME_H
+#include <sys/types.h>
#include <linux/utime.h>
#endif /* _SYS_UTIME_H */
More information about the klibc
mailing list