kernel: use upstream patches for musl
[openwrt/openwrt.git] / toolchain / musl / patches / 010-kernel-suppress-some-more-Linux-uapi-definitions.patch
1 From 8e85d2c268000b51cc690f3a55a820d8f8a6c0bc Mon Sep 17 00:00:00 2001
2 From: Hauke Mehrtens <hauke@hauke-m.de>
3 Date: Thu, 22 Jun 2017 22:04:28 +0200
4 Subject: [PATCH] Add additional uapi guards for Linux kernel header files
5
6 With Linux kernel 4.15 it will be possible to guard more parts of the
7 Linux header files from a libc. Make use of this in musl to guard all
8 the structures and other definitions from the Linux header files which
9 are also defined by the header files provided by musl. This will make
10 musl compile with the unmodified Linux kernel user space headers.
11
12 This extends the definitions done in commit 04983f227238 ("make
13 netinet/in.h suppress clashing definitions from kernel headers")
14
15 The needed patches were recently accepted for Linux 4.15:
16 https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c0bace798436bca0fdc221ff61143f1376a9c3de
17 https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=6926e041a8920c8ec27e4e155efa760aa01551fd
18 ---
19 include/net/if.h | 7 +++++++
20 include/netinet/if_ether.h | 1 +
21 include/sys/xattr.h | 2 ++
22 3 files changed, 10 insertions(+)
23
24 --- a/include/net/if.h
25 +++ b/include/net/if.h
26 @@ -125,6 +125,13 @@ struct ifconf {
27 #define ifc_req ifc_ifcu.ifcu_req
28 #define _IOT_ifconf _IOT(_IOTS(struct ifconf),1,0,0,0,0)
29
30 +#define __UAPI_DEF_IF_IFCONF 0
31 +#define __UAPI_DEF_IF_IFMAP 0
32 +#define __UAPI_DEF_IF_IFNAMSIZ 0
33 +#define __UAPI_DEF_IF_IFREQ 0
34 +#define __UAPI_DEF_IF_NET_DEVICE_FLAGS 0
35 +#define __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO 0
36 +
37 #endif
38
39 #ifdef __cplusplus
40 --- a/include/netinet/if_ether.h
41 +++ b/include/netinet/if_ether.h
42 @@ -133,5 +133,6 @@ do { \
43 (enaddr)[5] = ((uint8_t *)ipaddr)[3]; \
44 } while(0)
45
46 +#define __UAPI_DEF_ETHHDR 0
47
48 #endif
49 --- a/include/sys/xattr.h
50 +++ b/include/sys/xattr.h
51 @@ -24,6 +24,8 @@ int removexattr(const char *, const char
52 int lremovexattr(const char *, const char *);
53 int fremovexattr(int, const char *);
54
55 +#define __UAPI_DEF_XATTR 0
56 +
57 #ifdef __cplusplus
58 }
59 #endif