[compiler-rt] r348500 - [Sanitizer] getmntinfo support in FreeBSD
David Carlier via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 6 09:04:18 PST 2018
Author: devnexen
Date: Thu Dec 6 09:04:18 2018
New Revision: 348500
URL: http://llvm.org/viewvc/llvm-project?rev=348500&view=rev
Log:
[Sanitizer] getmntinfo support in FreeBSD
Reviewers: krytarowski
Reviewed By: krytarowski
Differential Revision: https://reviews.llvm.org/D55354
Added:
compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/getmntinfo.cc
- copied, changed from r348499, compiler-rt/trunk/test/sanitizer_common/TestCases/NetBSD/getmntinfo.cc
Removed:
compiler-rt/trunk/test/sanitizer_common/TestCases/NetBSD/getmntinfo.cc
Modified:
compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc
compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_interceptors.h
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc?rev=348500&r1=348499&r2=348500&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc Thu Dec 6 09:04:18 2018
@@ -7278,7 +7278,11 @@ INTERCEPTOR(int, getmntinfo, void **mntb
if (cnt > 0 && mntbufp) {
COMMON_INTERCEPTOR_WRITE_RANGE(ctx, mntbufp, sizeof(void *));
if (*mntbufp)
+#if SANITIZER_NETBSD
COMMON_INTERCEPTOR_WRITE_RANGE(ctx, *mntbufp, cnt * struct_statvfs_sz);
+#else
+ COMMON_INTERCEPTOR_WRITE_RANGE(ctx, *mntbufp, cnt * struct_statfs_sz);
+#endif
}
return cnt;
}
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_interceptors.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_interceptors.h?rev=348500&r1=348499&r2=348500&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_interceptors.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_interceptors.h Thu Dec 6 09:04:18 2018
@@ -518,7 +518,7 @@
#define SANITIZER_INTERCEPT_NETENT SI_NETBSD
#define SANITIZER_INTERCEPT_SETVBUF (SI_NETBSD || SI_FREEBSD || \
SI_LINUX || SI_MAC)
-#define SANITIZER_INTERCEPT_GETMNTINFO SI_NETBSD
+#define SANITIZER_INTERCEPT_GETMNTINFO (SI_NETBSD || SI_FREEBSD)
#define SANITIZER_INTERCEPT_MI_VECTOR_HASH SI_NETBSD
#define SANITIZER_INTERCEPT_GETVFSSTAT SI_NETBSD
#define SANITIZER_INTERCEPT_REGEX SI_NETBSD
Removed: compiler-rt/trunk/test/sanitizer_common/TestCases/NetBSD/getmntinfo.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/sanitizer_common/TestCases/NetBSD/getmntinfo.cc?rev=348499&view=auto
==============================================================================
--- compiler-rt/trunk/test/sanitizer_common/TestCases/NetBSD/getmntinfo.cc (original)
+++ compiler-rt/trunk/test/sanitizer_common/TestCases/NetBSD/getmntinfo.cc (removed)
@@ -1,25 +0,0 @@
-// RUN: %clangxx -O0 -g %s -o %t && %run %t 2>&1 | FileCheck %s
-
-#include <sys/types.h>
-
-#include <sys/statvfs.h>
-
-#include <err.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-int main(void) {
- printf("getmntinfo\n");
-
- struct statvfs *fss;
- int nfss = getmntinfo(&fss, MNT_NOWAIT);
- if (nfss <= 0)
- errx(1, "getmntinfo");
-
- for (int i = 0; i < nfss; i++)
- printf("%d: %s\n", i, fss[i].f_fstypename);
-
- // CHECK: getmntinfo
-
- return 0;
-}
Copied: compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/getmntinfo.cc (from r348499, compiler-rt/trunk/test/sanitizer_common/TestCases/NetBSD/getmntinfo.cc)
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/getmntinfo.cc?p2=compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/getmntinfo.cc&p1=compiler-rt/trunk/test/sanitizer_common/TestCases/NetBSD/getmntinfo.cc&r1=348499&r2=348500&rev=348500&view=diff
==============================================================================
--- compiler-rt/trunk/test/sanitizer_common/TestCases/NetBSD/getmntinfo.cc (original)
+++ compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/getmntinfo.cc Thu Dec 6 09:04:18 2018
@@ -1,8 +1,14 @@
// RUN: %clangxx -O0 -g %s -o %t && %run %t 2>&1 | FileCheck %s
+//
+// UNSUPPORTED: linux, darwin, solaris
#include <sys/types.h>
+#if defined(__NetBSD__)
#include <sys/statvfs.h>
+#else
+#include <sys/mount.h>
+#endif
#include <err.h>
#include <stdio.h>
@@ -11,7 +17,11 @@
int main(void) {
printf("getmntinfo\n");
+#if defined(__NetBSD__)
struct statvfs *fss;
+#else
+ struct statfs *fss;
+#endif
int nfss = getmntinfo(&fss, MNT_NOWAIT);
if (nfss <= 0)
errx(1, "getmntinfo");
More information about the llvm-commits
mailing list