hc
2023-05-26 a23f51ed7a39e452c1037343a84d7db1ca2c5bd7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
From 2872f5d8bcef84e62b15b37ba4ffeccfb6402dad Mon Sep 17 00:00:00 2001
From: rofl0r <retnyg@gmx.net>
Date: Wed, 22 Jan 2014 00:48:28 +0100
Subject: [PATCH 1/3] libc-compat.h: fix some issues arising from in6.h
 
namely redefinition of some structs provided by netinet/in.h.
---
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Upstream-Status: Submitted
 
 include/uapi/linux/libc-compat.h | 25 ++++++++-----------------
 1 file changed, 8 insertions(+), 17 deletions(-)
 
Index: linux-4.15/include/uapi/linux/libc-compat.h
===================================================================
--- linux-4.15.orig/include/uapi/linux/libc-compat.h    2018-02-05 17:37:44.724314379 -0500
+++ linux-4.15/include/uapi/linux/libc-compat.h    2018-02-05 17:38:02.148913820 -0500
@@ -49,13 +49,12 @@
 #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. */
-#if defined(_NET_IF_H) && defined(__USE_MISC)
+/* Coordinate with libc net/if.h header. */
+#if defined(_NET_IF_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_IF_IFCONF 0
@@ -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 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 */