[PATCH] D20410: [LibFuzzer] Fix implementation of ``GetPeakRSSMb()`` on Mac OSX

Dan Liew via llvm-commits llvm-commits at lists.llvm.org
Thu May 19 16:19:30 PDT 2016


delcypher updated this revision to Diff 57877.
delcypher added a comment.

Remove use of #ifdefs


http://reviews.llvm.org/D20410

Files:
  lib/Fuzzer/FuzzerUtil.cpp

Index: lib/Fuzzer/FuzzerUtil.cpp
===================================================================
--- lib/Fuzzer/FuzzerUtil.cpp
+++ lib/Fuzzer/FuzzerUtil.cpp
@@ -282,7 +282,15 @@
   struct rusage usage;
   if (getrusage(RUSAGE_SELF, &usage))
     return 0;
-  return usage.ru_maxrss >> 10;
+  if (LIBFUZZER_LINUX) {
+    // ru_maxrss is in KiB
+    return usage.ru_maxrss >> 10;
+  } else if (LIBFUZZER_APPLE) {
+    // ru_maxrss is in bytes
+    return usage.ru_maxrss >> 20;
+  }
+  assert(0 && "GetPeakRSSMb() is not implemented for your platform");
+  return 0;
 }
 
 }  // namespace fuzzer


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D20410.57877.patch
Type: text/x-patch
Size: 598 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160519/88176e44/attachment.bin>


More information about the llvm-commits mailing list