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

Dan Liew via llvm-commits llvm-commits at lists.llvm.org
Thu May 19 18:44:11 PDT 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL270173: [LibFuzzer] Fix implementation of ``GetPeakRSSMb()`` on Mac OSX. (authored by delcypher).

Changed prior to commit:
  http://reviews.llvm.org/D20410?vs=57877&id=57885#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20410

Files:
  llvm/trunk/lib/Fuzzer/FuzzerUtil.cpp

Index: llvm/trunk/lib/Fuzzer/FuzzerUtil.cpp
===================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerUtil.cpp
+++ llvm/trunk/lib/Fuzzer/FuzzerUtil.cpp
@@ -288,7 +288,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.57885.patch
Type: text/x-patch
Size: 631 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160520/1f6d386f/attachment.bin>


More information about the llvm-commits mailing list