aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Support/Unix/Program.inc
diff options
context:
space:
mode:
authorSerge Pavlov <sepavloff@gmail.com>2021-01-27 11:10:34 +0700
committerSerge Pavlov <sepavloff@gmail.com>2021-01-28 10:50:04 +0700
commit5c1cea6f406366b85f3c200a1c48f713da4450ba (patch)
tree6ebe0460012cbc556eb2f129fa221e904044650a /llvm/lib/Support/Unix/Program.inc
parent2b9ed4fca64d3eaacca016621fa3735052a7fb1c (diff)
downloadllvm-5c1cea6f406366b85f3c200a1c48f713da4450ba.zip
llvm-5c1cea6f406366b85f3c200a1c48f713da4450ba.tar.gz
llvm-5c1cea6f406366b85f3c200a1c48f713da4450ba.tar.bz2
[Support] Fix build for Haiku
This change fixes two issues with building LLVM on Haiku. The first issue is that LLVM requires wait4(), which on Haiku is hidden behind the _BSD_SOURCE feature flag when using the --std=c++14 flag. Additionally, the wait4() function is only available in libbsd.so, so this is now a dependency. The other fix is that Haiku does not have the (non-standard) rusage.maxrss member, so by default the used memory info will be set to 0 on this platform. Reviewed By: sepavloff Differential Revision: https://reviews.llvm.org/D87920 Patch by Niels Sascha Reedijk.
Diffstat (limited to 'llvm/lib/Support/Unix/Program.inc')
-rw-r--r--llvm/lib/Support/Unix/Program.inc4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Support/Unix/Program.inc b/llvm/lib/Support/Unix/Program.inc
index fb56fa4..d42681f 100644
--- a/llvm/lib/Support/Unix/Program.inc
+++ b/llvm/lib/Support/Unix/Program.inc
@@ -452,8 +452,12 @@ ProcessInfo llvm::sys::Wait(const ProcessInfo &PI, unsigned SecondsToWait,
if (ProcStat) {
std::chrono::microseconds UserT = toDuration(Info.ru_utime);
std::chrono::microseconds KernelT = toDuration(Info.ru_stime);
+#ifndef __HAIKU__
uint64_t PeakMemory = static_cast<uint64_t>(Info.ru_maxrss);
*ProcStat = ProcessStatistics{UserT + KernelT, UserT, PeakMemory};
+#else
+ *ProcStat = ProcessStatistics{UserT + KernelT, UserT, 0};
+#endif
}
// Return the proper exit status. Detect error conditions