270-uapi-kernel.h-glibc-specific-inclusion-of-sysinfo.h.patch 1.3 KB

12345678910111213141516171819202122232425262728293031323334
  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. including sysinfo.h from kernel.h makes no sense whatsoever,
  6. but removing it breaks glibc's userspace header,
  7. which includes kernel.h instead of sysinfo.h from their sys/sysinfo.h.
  8. this seems to be a historical mistake.
  9. on musl, including any header that uses kernel.h directly or indirectly
  10. plus sys/sysinfo.h will produce a compile error due to redefinition of
  11. struct sysinfo from sys/sysinfo.h.
  12. so for now, only include it on glibc or when including from kernel
  13. in order not to break their headers.
  14. Signed-off-by: John Spencer <maillist-linux@barfooze.de>
  15. Signed-off-by: David Heidelberger <david.heidelberger@ixit.cz>
  16. Signed-off-by: Jonas Gorski <jogo@openwrt.org>
  17. ---
  18. include/uapi/linux/kernel.h | 2 ++
  19. 1 file changed, 2 insertions(+)
  20. --- a/include/uapi/linux/kernel.h
  21. +++ b/include/uapi/linux/kernel.h
  22. @@ -1,7 +1,9 @@
  23. #ifndef _UAPI_LINUX_KERNEL_H
  24. #define _UAPI_LINUX_KERNEL_H
  25. +#if defined(__KERNEL__) || defined( __GLIBC__)
  26. #include <linux/sysinfo.h>
  27. +#endif
  28. /*
  29. * 'kernel.h' contains some often-used function prototypes etc