74d00a8c38
* properly format/comment all patches * merge debloat patches * merge Kconfig patches * merge swconfig patches * merge hotplug patches * drop 200-fix_localversion.patch - upstream * drop 222-arm_zimage_none.patch - unused * drop 252-mv_cesa_depends.patch - no longer required * drop 410-mtd-move-forward-declaration-of-struct-mtd_info.patch - unused * drop 661-fq_codel_keep_dropped_stats.patch - outdated * drop 702-phy_add_aneg_done_function.patch - upstream * drop 840-rtc7301.patch - unused * drop 841-rtc_pt7c4338.patch - upstream * drop 921-use_preinit_as_init.patch - unused * drop spio-gpio-old and gpio-mmc - unused Signed-off-by: John Crispin <john@phrozen.org>
105 lines
3.6 KiB
Diff
105 lines
3.6 KiB
Diff
From: David Heidelberger <david.heidelberger@ixit.cz>
|
|
Subject: uapi/libc-compat.h: do not rely on __GLIBC__
|
|
|
|
Musl provides the same structs as glibc, but does not provide a define to
|
|
allow its detection. Since the absence of __GLIBC__ also can mean that it
|
|
is included from the kernel, change the __GLIBC__ detection to
|
|
!__KERNEL__, which should always be true when included from userspace.
|
|
|
|
Signed-off-by: John Spencer <maillist-linux@barfooze.de>
|
|
Tested-by: David Heidelberger <david.heidelberger@ixit.cz>
|
|
Signed-off-by: Jonas Gorski <jogo@openwrt.org>
|
|
---
|
|
include/uapi/linux/libc-compat.h | 18 +++++++++---------
|
|
1 file changed, 9 insertions(+), 9 deletions(-)
|
|
|
|
--- a/include/uapi/linux/libc-compat.h
|
|
+++ b/include/uapi/linux/libc-compat.h
|
|
@@ -48,13 +48,13 @@
|
|
#ifndef _UAPI_LIBC_COMPAT_H
|
|
#define _UAPI_LIBC_COMPAT_H
|
|
|
|
-/* We have included glibc headers... */
|
|
-#if defined(__GLIBC__)
|
|
+/* We have included libc headers... */
|
|
+#if !defined(__KERNEL__)
|
|
|
|
-/* Coordinate with glibc net/if.h header. */
|
|
-#if defined(_NET_IF_H) && defined(__USE_MISC)
|
|
+/* Coordinate with libc net/if.h header. */
|
|
+#if defined(_NET_IF_H) && (!defined(__GLIBC__) || defined(__USE_MISC))
|
|
|
|
-/* GLIBC headers included first so don't define anything
|
|
+/* LIBC headers included first so don't define anything
|
|
* that would already be defined. */
|
|
|
|
#define __UAPI_DEF_IF_IFCONF 0
|
|
@@ -65,7 +65,11 @@
|
|
#define __UAPI_DEF_IF_NET_DEVICE_FLAGS 0
|
|
/* For the future if glibc adds IFF_LOWER_UP, IFF_DORMANT and IFF_ECHO */
|
|
#ifndef __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO
|
|
+#ifdef __GLIBC__
|
|
#define __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO 1
|
|
+#else
|
|
+#define __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO 0
|
|
+#endif
|
|
#endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO */
|
|
|
|
#else /* _NET_IF_H */
|
|
@@ -85,10 +89,10 @@
|
|
|
|
#endif /* _NET_IF_H */
|
|
|
|
-/* Coordinate with glibc netinet/in.h header. */
|
|
+/* Coordinate with libc netinet/in.h header. */
|
|
#if defined(_NETINET_IN_H)
|
|
|
|
-/* GLIBC headers included first so don't define anything
|
|
+/* LIBC headers included first so don't define anything
|
|
* that would already be defined. */
|
|
#define __UAPI_DEF_IN_ADDR 0
|
|
#define __UAPI_DEF_IN_IPPROTO 0
|
|
@@ -102,7 +106,7 @@
|
|
* if the glibc code didn't define them. This guard matches
|
|
* the guard in glibc/inet/netinet/in.h which defines the
|
|
* additional in6_addr macros e.g. s6_addr16, and s6_addr32. */
|
|
-#if defined(__USE_MISC) || defined (__USE_GNU)
|
|
+#if !defined(__GLIBC__) || defined(__USE_MISC) || defined (__USE_GNU)
|
|
#define __UAPI_DEF_IN6_ADDR_ALT 0
|
|
#else
|
|
#define __UAPI_DEF_IN6_ADDR_ALT 1
|
|
@@ -117,7 +121,7 @@
|
|
#else
|
|
|
|
/* Linux headers included first, and we must define everything
|
|
- * we need. The expectation is that glibc will check the
|
|
+ * we need. The expectation is that the libc will check the
|
|
* __UAPI_DEF_* defines and adjust appropriately. */
|
|
#define __UAPI_DEF_IN_ADDR 1
|
|
#define __UAPI_DEF_IN_IPPROTO 1
|
|
@@ -127,7 +131,7 @@
|
|
#define __UAPI_DEF_IN_CLASS 1
|
|
|
|
#define __UAPI_DEF_IN6_ADDR 1
|
|
-/* We unconditionally define the in6_addr macros and glibc must
|
|
+/* We unconditionally define the in6_addr macros and the libc must
|
|
* coordinate. */
|
|
#define __UAPI_DEF_IN6_ADDR_ALT 1
|
|
#define __UAPI_DEF_SOCKADDR_IN6 1
|
|
@@ -168,7 +172,7 @@
|
|
/* If we did not see any headers from any supported C libraries,
|
|
* or we are being included in the kernel, then define everything
|
|
* that we need. */
|
|
-#else /* !defined(__GLIBC__) */
|
|
+#else /* defined(__KERNEL__) */
|
|
|
|
/* Definitions for if.h */
|
|
#define __UAPI_DEF_IF_IFCONF 1
|
|
@@ -208,6 +212,6 @@
|
|
/* Definitions for xattr.h */
|
|
#define __UAPI_DEF_XATTR 1
|
|
|
|
-#endif /* __GLIBC__ */
|
|
+#endif /* __KERNEL__ */
|
|
|
|
#endif /* _UAPI_LIBC_COMPAT_H */
|