[PATCH] D55354: [Sanitizer] getmntinfo support in FreeBSD

David CARLIER via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 6 08:55:12 PST 2018


devnexen updated this revision to Diff 176989.

Repository:
  rCRT Compiler Runtime

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55354/new/

https://reviews.llvm.org/D55354

Files:
  lib/sanitizer_common/sanitizer_common_interceptors.inc
  lib/sanitizer_common/sanitizer_platform_interceptors.h
  test/sanitizer_common/TestCases/NetBSD/getmntinfo.cc
  test/sanitizer_common/TestCases/Posix/getmntinfo.cc


Index: test/sanitizer_common/TestCases/Posix/getmntinfo.cc
===================================================================
--- test/sanitizer_common/TestCases/Posix/getmntinfo.cc
+++ test/sanitizer_common/TestCases/Posix/getmntinfo.cc
@@ -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");
Index: lib/sanitizer_common/sanitizer_platform_interceptors.h
===================================================================
--- lib/sanitizer_common/sanitizer_platform_interceptors.h
+++ lib/sanitizer_common/sanitizer_platform_interceptors.h
@@ -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
Index: lib/sanitizer_common/sanitizer_common_interceptors.inc
===================================================================
--- lib/sanitizer_common/sanitizer_common_interceptors.inc
+++ lib/sanitizer_common/sanitizer_common_interceptors.inc
@@ -7278,7 +7278,11 @@
   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;
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55354.176989.patch
Type: text/x-patch
Size: 2038 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181206/640f6ee3/attachment.bin>


More information about the llvm-commits mailing list