[PATCH] D27281: [libFuzzer] Diff 9 - 1 - Properly use unsigned for Process ID.

Marcos Pividori via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 13 09:56:19 PST 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL289558: [libFuzzer] Properly use unsigned for Process ID. (authored by mpividori).

Changed prior to commit:
  https://reviews.llvm.org/D27281?vs=81129&id=81242#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D27281

Files:
  llvm/trunk/lib/Fuzzer/FuzzerLoop.cpp
  llvm/trunk/lib/Fuzzer/FuzzerUtil.h
  llvm/trunk/lib/Fuzzer/FuzzerUtilPosix.cpp
  llvm/trunk/lib/Fuzzer/FuzzerUtilWindows.cpp


Index: llvm/trunk/lib/Fuzzer/FuzzerLoop.cpp
===================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerLoop.cpp
+++ llvm/trunk/lib/Fuzzer/FuzzerLoop.cpp
@@ -265,7 +265,7 @@
 }
 
 void Fuzzer::CrashCallback() {
-  Printf("==%d== ERROR: libFuzzer: deadly signal\n", GetPid());
+  Printf("==%lu== ERROR: libFuzzer: deadly signal\n", GetPid());
   if (EF->__sanitizer_print_stack_trace)
     EF->__sanitizer_print_stack_trace();
   Printf("NOTE: libFuzzer has rudimentary signal handlers.\n"
@@ -278,7 +278,7 @@
 }
 
 void Fuzzer::InterruptCallback() {
-  Printf("==%d== libFuzzer: run interrupted; exiting\n", GetPid());
+  Printf("==%lu== libFuzzer: run interrupted; exiting\n", GetPid());
   PrintFinalStats();
   _Exit(0);  // Stop right now, don't perform any at-exit actions.
 }
@@ -300,7 +300,7 @@
     Printf("       and the timeout value is %d (use -timeout=N to change)\n",
            Options.UnitTimeoutSec);
     DumpCurrentUnit("timeout-");
-    Printf("==%d== ERROR: libFuzzer: timeout after %d seconds\n", GetPid(),
+    Printf("==%lu== ERROR: libFuzzer: timeout after %d seconds\n", GetPid(),
            Seconds);
     if (EF->__sanitizer_print_stack_trace)
       EF->__sanitizer_print_stack_trace();
@@ -312,7 +312,7 @@
 
 void Fuzzer::RssLimitCallback() {
   Printf(
-      "==%d== ERROR: libFuzzer: out-of-memory (used: %zdMb; limit: %zdMb)\n",
+      "==%lu== ERROR: libFuzzer: out-of-memory (used: %zdMb; limit: %zdMb)\n",
       GetPid(), GetPeakRSSMb(), Options.RssLimitMb);
   Printf("   To change the out-of-memory limit use -rss_limit_mb=<N>\n\n");
   if (EF->__sanitizer_print_memory_profile)
Index: llvm/trunk/lib/Fuzzer/FuzzerUtilPosix.cpp
===================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerUtilPosix.cpp
+++ llvm/trunk/lib/Fuzzer/FuzzerUtilPosix.cpp
@@ -87,7 +87,7 @@
   sleep(Seconds); // Use C API to avoid coverage from instrumented libc++.
 }
 
-int GetPid() { return getpid(); }
+unsigned long GetPid() { return (unsigned long)getpid(); }
 
 size_t GetPeakRSSMb() {
   struct rusage usage;
Index: llvm/trunk/lib/Fuzzer/FuzzerUtilWindows.cpp
===================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerUtilWindows.cpp
+++ llvm/trunk/lib/Fuzzer/FuzzerUtilWindows.cpp
@@ -140,7 +140,7 @@
 
 void SleepSeconds(int Seconds) { Sleep(Seconds * 1000); }
 
-int GetPid() { return GetCurrentProcessId(); }
+unsigned long GetPid() { return GetCurrentProcessId(); }
 
 size_t GetPeakRSSMb() {
   PROCESS_MEMORY_COUNTERS info;
Index: llvm/trunk/lib/Fuzzer/FuzzerUtil.h
===================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerUtil.h
+++ llvm/trunk/lib/Fuzzer/FuzzerUtil.h
@@ -47,7 +47,7 @@
 
 void SleepSeconds(int Seconds);
 
-int GetPid();
+unsigned long GetPid();
 
 size_t GetPeakRSSMb();
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27281.81242.patch
Type: text/x-patch
Size: 2889 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161213/c916e9db/attachment.bin>


More information about the llvm-commits mailing list