ustat.h.patch 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. *** a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc 2018-10-31 11:20:33.419203838 -0700
  2. --- b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc 2018-10-31 12:18:50.202725160 -0700
  3. ***************
  4. *** 81,87 ****
  5. #include <sys/statvfs.h>
  6. #include <sys/timex.h>
  7. #include <sys/user.h>
  8. - #include <sys/ustat.h>
  9. #include <linux/cyclades.h>
  10. #include <linux/if_eql.h>
  11. #include <linux/if_plip.h>
  12. --- 81,86 ----
  13. ***************
  14. *** 163,172 ****
  15. unsigned struct_old_utsname_sz = sizeof(struct old_utsname);
  16. unsigned struct_oldold_utsname_sz = sizeof(struct oldold_utsname);
  17. unsigned struct_itimerspec_sz = sizeof(struct itimerspec);
  18. - unsigned struct_ustat_sz = sizeof(struct ustat);
  19. #endif // SANITIZER_LINUX
  20. #if SANITIZER_LINUX && !SANITIZER_ANDROID
  21. unsigned struct_rlimit64_sz = sizeof(struct rlimit64);
  22. unsigned struct_timex_sz = sizeof(struct timex);
  23. unsigned struct_msqid_ds_sz = sizeof(struct msqid_ds);
  24. --- 162,183 ----
  25. unsigned struct_old_utsname_sz = sizeof(struct old_utsname);
  26. unsigned struct_oldold_utsname_sz = sizeof(struct oldold_utsname);
  27. unsigned struct_itimerspec_sz = sizeof(struct itimerspec);
  28. #endif // SANITIZER_LINUX
  29. #if SANITIZER_LINUX && !SANITIZER_ANDROID
  30. + // Use pre-computed size of struct ustat to avoid <sys/ustat.h> which
  31. + // has been removed from glibc 2.28.
  32. + #if defined(__aarch64__) || defined(__s390x__) || defined (__mips64) \
  33. + || defined(__powerpc64__) || defined(__arch64__) || defined(__sparcv9) \
  34. + || defined(__x86_64__)
  35. + #define SIZEOF_STRUCT_USTAT 32
  36. + #elif defined(__arm__) || defined(__i386__) || defined(__mips__) \
  37. + || defined(__powerpc__) || defined(__s390__)
  38. + #define SIZEOF_STRUCT_USTAT 20
  39. + #else
  40. + #error Unknown size of struct ustat
  41. + #endif
  42. + unsigned struct_ustat_sz = SIZEOF_STRUCT_USTAT;
  43. unsigned struct_rlimit64_sz = sizeof(struct rlimit64);
  44. unsigned struct_timex_sz = sizeof(struct timex);
  45. unsigned struct_msqid_ds_sz = sizeof(struct msqid_ds);