1 From d9d97cac3702b99a00cd113de98c41eb535d47ed Mon Sep 17 00:00:00 2001
2 From: Efraim Flashner <efraim@flashner.co.il>
3 Date: Sun, 14 Oct 2018 12:11:30 +0300
4 Subject: [PATCH] patch modified from the gcc patch series, also dealing with
8 .../sanitizer_platform_limits_posix.cc | 15 +++++++++++++--
9 1 file changed, 13 insertions(+), 2 deletions(-)
11 diff --git a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc b/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
12 index 29fea6e..570b9a5 100644
13 --- a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
14 +++ b/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
16 #include <sys/statvfs.h>
17 #include <sys/timex.h>
19 -#include <sys/ustat.h>
20 #include <linux/cyclades.h>
21 #include <linux/if_eql.h>
22 #include <linux/if_plip.h>
23 @@ -222,7 +221,19 @@ namespace __sanitizer {
24 #endif // SANITIZER_LINUX || SANITIZER_FREEBSD
26 #if SANITIZER_LINUX && !SANITIZER_ANDROID
27 - unsigned struct_ustat_sz = sizeof(struct ustat);
28 + // Use pre-computed size of struct ustat to avoid <sys/ustat.h> which
29 + // has been removed from glibc 2.28.
30 +#if defined(__aarch64__) || defined(__s390x__) || defined (__mips64) \
31 + || defined(__powerpc64__) || defined(__arch64__) || defined(__sparcv9) \
32 + || defined(__x86_64__)
33 +#define SIZEOF_STRUCT_USTAT 32
34 +#elif defined(__arm__) || defined(__i386__) || defined(__mips__) \
35 + || defined(__powerpc__) || defined(__s390__)
36 +#define SIZEOF_STRUCT_USTAT 20
38 +#error Unknown size of struct ustat
40 + unsigned struct_ustat_sz = SIZEOF_STRUCT_USTAT;
41 unsigned struct_rlimit64_sz = sizeof(struct rlimit64);
42 unsigned struct_statvfs64_sz = sizeof(struct statvfs64);
43 #endif // SANITIZER_LINUX && !SANITIZER_ANDROID