kernel: improve uapi headers coexistence with musl
[openwrt/openwrt.git] / target / linux / generic / patches-4.0 / 270-uapi-kernel.h-glibc-specific-inclusion-of-sysinfo.h.patch
1 From 8b05e325824d3b38e52a7748b3b5dc34dc1c0f6d Mon Sep 17 00:00:00 2001
2 From: David Heidelberger <david.heidelberger@ixit.cz>
3 Date: Mon, 29 Jun 2015 14:37:54 +0200
4 Subject: [PATCH 1/3] uapi/kernel.h: glibc specific inclusion of sysinfo.h
5
6 including sysinfo.h from kernel.h makes no sense whatsoever,
7 but removing it breaks glibc's userspace header,
8 which includes kernel.h instead of sysinfo.h from their sys/sysinfo.h.
9 this seems to be a historical mistake.
10 on musl, including any header that uses kernel.h directly or indirectly
11 plus sys/sysinfo.h will produce a compile error due to redefinition of
12 struct sysinfo from sys/sysinfo.h.
13 so for now, only include it on glibc or when including from kernel
14 in order not to break their headers.
15
16 Signed-off-by: John Spencer <maillist-linux@barfooze.de>
17 Signed-off-by: David Heidelberger <david.heidelberger@ixit.cz>
18 Signed-off-by: Jonas Gorski <jogo@openwrt.org>
19 ---
20 include/uapi/linux/kernel.h | 2 ++
21 1 file changed, 2 insertions(+)
22
23 --- a/include/uapi/linux/kernel.h
24 +++ b/include/uapi/linux/kernel.h
25 @@ -1,7 +1,9 @@
26 #ifndef _UAPI_LINUX_KERNEL_H
27 #define _UAPI_LINUX_KERNEL_H
28
29 +#if defined(__KERNEL__) || defined( __GLIBC__)
30 #include <linux/sysinfo.h>
31 +#endif
32
33 /*
34 * 'kernel.h' contains some often-used function prototypes etc