--- zzzz-none-000/linux-4.9.276/include/uapi/linux/libc-compat.h 2021-07-20 14:21:16.000000000 +0000 +++ falcon-5530-750/linux-4.9.276/include/uapi/linux/libc-compat.h 2023-04-05 08:19:02.000000000 +0000 @@ -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,18 @@ #endif /* _NET_IF_H */ -/* Coordinate with glibc netinet/in.h header. */ +/* musl defines the ethhdr struct itself in its netinet/if_ether.h. + * Glibc just includes the kernel header and uses a different guard. */ +#if defined(_NETINET_IF_ETHER_H) +#define __UAPI_DEF_ETHHDR 0 +#else +#define __UAPI_DEF_ETHHDR 1 +#endif + +/* 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 +114,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 +129,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 +139,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 @@ -169,7 +181,7 @@ * or we are being included in the kernel, then define everything * that we need. Check for previous __UAPI_* definitions to give * unsupported C libraries a way to opt out of any kernel definition. */ -#else /* !defined(__GLIBC__) */ +#else /* defined(__KERNEL__) */ /* Definitions for if.h */ #ifndef __UAPI_DEF_IF_IFCONF @@ -193,6 +205,9 @@ #define __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO 1 #endif +/* Definitions for if_ether.h */ +#define __UAPI_DEF_ETHHDR 1 + /* Definitions for in.h */ #ifndef __UAPI_DEF_IN_ADDR #define __UAPI_DEF_IN_ADDR 1 @@ -261,6 +276,6 @@ #define __UAPI_DEF_XATTR 1 #endif -#endif /* __GLIBC__ */ +#endif /* __KERNEL__ */ #endif /* _UAPI_LIBC_COMPAT_H */