commit:     45d38ea5b0262d41b331b74b530d7cac3d8275b7
Author:     Aric Belsito <lluixhi <AT> gmail <DOT> com>
AuthorDate: Mon Apr  9 00:55:15 2018 +0000
Commit:     Aric Belsito <lluixhi <AT> gmail <DOT> com>
CommitDate: Mon Apr  9 00:55:15 2018 +0000
URL:        https://gitweb.gentoo.org/proj/musl.git/commit/?id=45d38ea5

sys-kernel/linux-headers: new patch

 .../files/libc-4.16-portability.patch              | 159 +++++++++++++++++++++
 sys-kernel/linux-headers/linux-headers-4.16.ebuild |   2 +-
 2 files changed, 160 insertions(+), 1 deletion(-)

diff --git a/sys-kernel/linux-headers/files/libc-4.16-portability.patch 
b/sys-kernel/linux-headers/files/libc-4.16-portability.patch
new file mode 100644
index 0000000..9828411
--- /dev/null
+++ b/sys-kernel/linux-headers/files/libc-4.16-portability.patch
@@ -0,0 +1,159 @@
+diff -Naur gentoo-headers-base-4.16.orig/include/uapi/linux/kernel.h 
gentoo-headers-base-4.16/include/uapi/linux/kernel.h
+--- gentoo-headers-base-4.16.orig/include/uapi/linux/kernel.h  2018-04-04 
23:45:32.000000000 -0700
++++ gentoo-headers-base-4.16/include/uapi/linux/kernel.h       2018-04-08 
17:51:18.477168271 -0700
+@@ -2,7 +2,9 @@
+ #ifndef _UAPI_LINUX_KERNEL_H
+ #define _UAPI_LINUX_KERNEL_H
+ 
++#ifdef __GLIBC__
+ #include <linux/sysinfo.h>
++#endif
+ 
+ /*
+  * 'kernel.h' contains some often-used function prototypes etc
+diff -Naur gentoo-headers-base-4.16.orig/include/uapi/linux/libc-compat.h 
gentoo-headers-base-4.16/include/uapi/linux/libc-compat.h
+--- gentoo-headers-base-4.16.orig/include/uapi/linux/libc-compat.h     
2018-04-04 23:45:32.000000000 -0700
++++ gentoo-headers-base-4.16/include/uapi/linux/libc-compat.h  2018-04-08 
17:53:43.004162639 -0700
+@@ -49,47 +49,57 @@
+ #ifndef _UAPI_LIBC_COMPAT_H
+ #define _UAPI_LIBC_COMPAT_H
+ 
+-/* We have included glibc headers... */
+-#if defined(__GLIBC__)
++/* We're used from userspace... */
++#if !defined(__KERNEL__)
+ 
+-/* Coordinate with glibc net/if.h header. */
++/* Coordinate with libc net/if.h header. */
+ #if defined(_NET_IF_H) && 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
+ #define __UAPI_DEF_IF_IFMAP 0
+ #define __UAPI_DEF_IF_IFNAMSIZ 0
+ #define __UAPI_DEF_IF_IFREQ 0
+-/* Everything up to IFF_DYNAMIC, matches net/if.h until glibc 2.23 */
+ #define __UAPI_DEF_IF_NET_DEVICE_FLAGS 0
+-/* For the future if glibc adds IFF_LOWER_UP, IFF_DORMANT and IFF_ECHO */
++/* If libc adds IFF_LOWER_UP, IFF_DORMANT and IFF_ECHO */
++#if !defined(__GLIBC__)
++#define __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO 0
++#else
+ #ifndef __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO
+ #define __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO 1
+ #endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO */
++#endif /* !defined(__GLIBC__) */
+ 
+ #else /* _NET_IF_H */
+ 
+ /* 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 libc will check the
+  * __UAPI_DEF_* defines and adjust appropriately. */
+ 
+ #define __UAPI_DEF_IF_IFCONF 1
+ #define __UAPI_DEF_IF_IFMAP 1
+ #define __UAPI_DEF_IF_IFNAMSIZ 1
+ #define __UAPI_DEF_IF_IFREQ 1
+-/* Everything up to IFF_DYNAMIC, matches net/if.h until glibc 2.23 */
+ #define __UAPI_DEF_IF_NET_DEVICE_FLAGS 1
+-/* For the future if glibc adds IFF_LOWER_UP, IFF_DORMANT and IFF_ECHO */
++/* If libc adds IFF_LOWER_UP, IFF_DORMANT and IFF_ECHO */
+ #define __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO 1
+ 
+ #endif /* _NET_IF_H */
+ 
+-/* Coordinate with glibc netinet/in.h header. */
++/* Coordinate with libc netinet/if_ether.h */
++#ifdef _NETINET_IF_ETHER_H
++#define __UAPI_DEF_ETHHDR 0
++#else
++/* glibc uses __NETINET_IF_ETHER_H and uses the uapi header */
++#define __UAPI_DEF_ETHHDR 1
++#endif /* _NETINET_IF_ETHER_H */
++
++/* 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
+@@ -99,15 +109,7 @@
+ #define __UAPI_DEF_IN_CLASS           0
+ 
+ #define __UAPI_DEF_IN6_ADDR           0
+-/* The exception is the in6_addr macros which must be defined
+- * 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)
+ #define __UAPI_DEF_IN6_ADDR_ALT               0
+-#else
+-#define __UAPI_DEF_IN6_ADDR_ALT               1
+-#endif
+ #define __UAPI_DEF_SOCKADDR_IN6               0
+ #define __UAPI_DEF_IPV6_MREQ          0
+ #define __UAPI_DEF_IPPROTO_V6         0
+@@ -118,7 +120,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 libc will check the
+  * __UAPI_DEF_* defines and adjust appropriately. */
+ #define __UAPI_DEF_IN_ADDR            1
+ #define __UAPI_DEF_IN_IPPROTO         1
+@@ -128,7 +130,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 libc must
+  * coordinate. */
+ #define __UAPI_DEF_IN6_ADDR_ALT               1
+ #define __UAPI_DEF_SOCKADDR_IN6               1
+@@ -170,7 +172,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
+@@ -185,15 +187,20 @@
+ #ifndef __UAPI_DEF_IF_IFREQ
+ #define __UAPI_DEF_IF_IFREQ 1
+ #endif
+-/* Everything up to IFF_DYNAMIC, matches net/if.h until glibc 2.23 */
+ #ifndef __UAPI_DEF_IF_NET_DEVICE_FLAGS
+ #define __UAPI_DEF_IF_NET_DEVICE_FLAGS 1
+ #endif
+-/* For the future if glibc adds IFF_LOWER_UP, IFF_DORMANT and IFF_ECHO */
++/* If libc adds IFF_LOWER_UP, IFF_DORMANT and IFF_ECHO */
+ #ifndef __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO
+ #define __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO 1
+ #endif
+ 
++/* Definitions for if_ether.h */
++/* allow libcs like musl to deactivate this, glibc does not implement this. */
++#ifndef __UAPI_DEF_ETHHDR
++#define __UAPI_DEF_ETHHDR             1
++#endif
++
+ /* Definitions for in.h */
+ #ifndef __UAPI_DEF_IN_ADDR
+ #define __UAPI_DEF_IN_ADDR            1
+@@ -262,6 +269,6 @@
+ #define __UAPI_DEF_XATTR              1
+ #endif
+ 
+-#endif /* __GLIBC__ */
++#endif /* defined(__KERNEL__) */
+ 
+ #endif /* _UAPI_LIBC_COMPAT_H */

diff --git a/sys-kernel/linux-headers/linux-headers-4.16.ebuild 
b/sys-kernel/linux-headers/linux-headers-4.16.ebuild
index 409a4b5..e5cbef5 100644
--- a/sys-kernel/linux-headers/linux-headers-4.16.ebuild
+++ b/sys-kernel/linux-headers/linux-headers-4.16.ebuild
@@ -31,7 +31,7 @@ src_prepare() {
        default
 
        [[ -n ${PATCH_VER} ]] && EPATCH_SUFFIX="patch" epatch "${WORKDIR}"/${PV}
-       epatch "${FILESDIR}"/libc-4.15-portability.patch
+       epatch "${FILESDIR}"/libc-4.16-portability.patch
 }
 
 src_install() {

Reply via email to