Created
June 7, 2020 03:33
-
-
Save Justasic/d419c41b0693b0cb4219e5da37b3a4e2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
commit 0e30377471bb47e5600ca544049fd912b8fd6f1f | |
Author: Justin Crawford <[email protected]> | |
Date: Sun Jun 7 05:33:08 2020 +0200 | |
Musl-libc patches | |
diff --git a/include/uapi/linux/libc-compat.h b/include/uapi/linux/libc-compat.h | |
index 8254c937c9f4..0636c2aa487c 100644 | |
--- a/include/uapi/linux/libc-compat.h | |
+++ b/include/uapi/linux/libc-compat.h | |
@@ -49,10 +49,9 @@ | |
#ifndef _UAPI_LIBC_COMPAT_H | |
#define _UAPI_LIBC_COMPAT_H | |
-/* We have included glibc headers... */ | |
-#if defined(__GLIBC__) | |
+#ifndef __KERNEL__ /* we're used from userspace */ | |
-/* 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 | |
@@ -99,15 +98,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 | |
@@ -115,10 +106,10 @@ | |
#define __UAPI_DEF_IN6_PKTINFO 0 | |
#define __UAPI_DEF_IP6_MTUINFO 0 | |
-#else | |
+#else /* defined(_NETINET_IN_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 the libc will check the | |
* __UAPI_DEF_* defines and adjust appropriately. */ | |
#define __UAPI_DEF_IN_ADDR 1 | |
#define __UAPI_DEF_IN_IPPROTO 1 | |
@@ -128,7 +119,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 +161,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 /* __KERNEL__ */ | |
/* Definitions for if.h */ | |
#ifndef __UAPI_DEF_IF_IFCONF | |
@@ -262,6 +253,6 @@ | |
#define __UAPI_DEF_XATTR 1 | |
#endif | |
-#endif /* __GLIBC__ */ | |
+#endif /* __KERNEL__ */ | |
#endif /* _UAPI_LIBC_COMPAT_H */ | |
diff --git a/include/uapi/linux/tcp.h b/include/uapi/linux/tcp.h | |
index f2acb2566333..5297d1c94f37 100644 | |
--- a/include/uapi/linux/tcp.h | |
+++ b/include/uapi/linux/tcp.h | |
@@ -21,7 +21,9 @@ | |
#include <linux/types.h> | |
#include <asm/byteorder.h> | |
#include <linux/socket.h> | |
+#include <linux/libc-compat.h> | |
+#if __UAPI_DEF_TCPHDR | |
struct tcphdr { | |
__be16 source; | |
__be16 dest; | |
@@ -56,6 +58,7 @@ struct tcphdr { | |
__sum16 check; | |
__be16 urg_ptr; | |
}; | |
+#endif | |
/* | |
* The union cast uses a gcc extension to avoid aliasing problems |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment