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

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