aboutsummaryrefslogtreecommitdiffstats
path: root/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/0001-Define-in_-structs-for-non-glibc-system-libs.patch
blob: 8d1ec69ae911ea096c6a87b06cb9c7cbe637b01c (plain)
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
From f414dea1316a48aba3e8e293201ebd51652d3ef4 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sun, 9 Jul 2017 15:17:29 -0700
Subject: [PATCH] Define in_* structs for non-glibc system libs

These defines and structs are required to be coming from
userspace netinet/in.h, which is being overridden in klibc
however, libc-compat.h from kernel is only written keeping
glibc in mind, and does not provide adequate guards for musl
to infer that these structs should be defined in linux/in.h

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 usr/include/netinet/in.h | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

Index: git/usr/include/netinet/in.h
===================================================================
--- git.orig/usr/include/netinet/in.h
+++ git/usr/include/netinet/in.h
@@ -5,6 +5,42 @@
 #ifndef _NETINET_IN_H
 #define _NETINET_IN_H
 
+#ifndef __GLIBC__
+#include <linux/libc-compat.h>
+
+#undef __UAPI_DEF_IN_ADDR
+#undef __UAPI_DEF_IN_IPPROTO
+#undef __UAPI_DEF_IN_PKTINFO
+#undef __UAPI_DEF_IP_MREQ
+#undef __UAPI_DEF_SOCKADDR_IN
+#undef __UAPI_DEF_IN_CLASS
+#undef __UAPI_DEF_IN6_ADDR
+#undef __UAPI_DEF_IN6_ADDR_ALT
+#undef __UAPI_DEF_SOCKADDR_IN6
+#undef __UAPI_DEF_IPV6_MREQ
+#undef __UAPI_DEF_IPPROTO_V6
+#undef __UAPI_DEF_IPV6_OPTIONS
+#undef __UAPI_DEF_IN6_PKTINFO
+#undef __UAPI_DEF_IP6_MTUINFO
+#undef __UAPI_DEF_IF_IFREQ
+
+#define __UAPI_DEF_IN_ADDR      1
+#define __UAPI_DEF_IN_IPPROTO   1
+#define __UAPI_DEF_IN_PKTINFO   1
+#define __UAPI_DEF_IP_MREQ      1
+#define __UAPI_DEF_SOCKADDR_IN  1
+#define __UAPI_DEF_IN_CLASS     1
+#define __UAPI_DEF_IN6_ADDR     1
+#define __UAPI_DEF_IN6_ADDR_ALT 1
+#define __UAPI_DEF_SOCKADDR_IN6 1
+#define __UAPI_DEF_IPV6_MREQ    1
+#define __UAPI_DEF_IPPROTO_V6   1
+#define __UAPI_DEF_IPV6_OPTIONS 1
+#define __UAPI_DEF_IN6_PKTINFO  1
+#define __UAPI_DEF_IP6_MTUINFO  1
+#define __UAPI_DEF_IF_IFREQ     1
+#endif
+
 #include <klibc/extern.h>
 #include <stdint.h>
 #include <endian.h>		/* Must be included *before* <linux/in.h> */
Index: git/usr/include/net/if.h
===================================================================
--- git.orig/usr/include/net/if.h
+++ git/usr/include/net/if.h
@@ -1,6 +1,17 @@
 #ifndef _NET_IF_H
 #define _NET_IF_H
 
+#ifndef __GLIBC__
+#include <linux/libc-compat.h>
+#undef __UAPI_DEF_IF_IFREQ
+#define __UAPI_DEF_IF_IFREQ            1
+#undef __UAPI_DEF_IF_IFNAMSIZ
+#define __UAPI_DEF_IF_IFNAMSIZ         1
+#undef __UAPI_DEF_IF_IFMAP
+#define __UAPI_DEF_IF_IFMAP            1
+#undef __UAPI_DEF_IF_NET_DEVICE_FLAGS
+#define __UAPI_DEF_IF_NET_DEVICE_FLAGS 1
+#endif
 #include <sys/socket.h>
 #include <sys/types.h>
 #include <linux/if.h>