glibc2.28-ustat.diff 1.2 KB

1234567891011121314151617181920212223242526272829303132
  1. --- libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc 2018/04/25 07:39:32 259630
  2. +++ libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc 2018/05/24 20:07:25 260687
  3. @@ -138,7 +138,6 @@
  4. # include <sys/procfs.h>
  5. #endif
  6. #include <sys/user.h>
  7. -#include <sys/ustat.h>
  8. #include <linux/cyclades.h>
  9. #include <linux/if_eql.h>
  10. #include <linux/if_plip.h>
  11. @@ -231,7 +230,19 @@
  12. #endif // SANITIZER_LINUX || SANITIZER_FREEBSD
  13. #if SANITIZER_LINUX && !SANITIZER_ANDROID
  14. - unsigned struct_ustat_sz = sizeof(struct ustat);
  15. + // Use pre-computed size of struct ustat to avoid <sys/ustat.h> which
  16. + // has been removed from glibc 2.28.
  17. +#if defined(__aarch64__) || defined(__s390x__) || defined (__mips64) \
  18. + || defined(__powerpc64__) || defined(__arch64__) || defined(__sparcv9) \
  19. + || defined(__x86_64__)
  20. +#define SIZEOF_STRUCT_USTAT 32
  21. +#elif defined(__arm__) || defined(__i386__) || defined(__mips__) \
  22. + || defined(__powerpc__) || defined(__s390__)
  23. +#define SIZEOF_STRUCT_USTAT 20
  24. +#else
  25. +#error Unknown size of struct ustat
  26. +#endif
  27. + unsigned struct_ustat_sz = SIZEOF_STRUCT_USTAT;
  28. unsigned struct_rlimit64_sz = sizeof(struct rlimit64);
  29. unsigned struct_statvfs64_sz = sizeof(struct statvfs64);
  30. #endif // SANITIZER_LINUX && !SANITIZER_ANDROID