[PATCH] D155793: [Support] Avoid wait4 on Fuchsia
Petr Hosek via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Jul 23 17:34:44 PDT 2023
phosek updated this revision to Diff 543340.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D155793/new/
https://reviews.llvm.org/D155793
Files:
llvm/lib/Support/Unix/Program.inc
Index: llvm/lib/Support/Unix/Program.inc
===================================================================
--- llvm/lib/Support/Unix/Program.inc
+++ llvm/lib/Support/Unix/Program.inc
@@ -340,10 +340,10 @@
namespace llvm {
namespace sys {
-#ifndef _AIX
-using ::wait4;
-#else
+#if defined(_AIX)
static pid_t(wait4)(pid_t pid, int *status, int options, struct rusage *usage);
+#elif !defined(__Fuchsia__)
+using ::wait4;
#endif
} // namespace sys
@@ -414,6 +414,7 @@
// Parent process: Wait for the child process to terminate.
int status = 0;
ProcessInfo WaitResult;
+#ifndef __Fuchsia__
rusage Info;
if (ProcStat)
ProcStat->reset();
@@ -421,6 +422,7 @@
do {
WaitResult.Pid = sys::wait4(ChildPid, &status, WaitPidOptions, &Info);
} while (WaitUntilTerminates && WaitResult.Pid == -1 && errno == EINTR);
+#endif
if (WaitResult.Pid != PI.Pid) {
if (WaitResult.Pid == 0) {
@@ -459,6 +461,7 @@
sigaction(SIGALRM, &Old, nullptr);
}
+#ifndef __Fuchsia__
if (ProcStat) {
std::chrono::microseconds UserT = toDuration(Info.ru_utime);
std::chrono::microseconds KernelT = toDuration(Info.ru_stime);
@@ -468,6 +471,7 @@
#endif
*ProcStat = ProcessStatistics{UserT + KernelT, UserT, PeakMemory};
}
+#endif
// Return the proper exit status. Detect error conditions
// so we can return -1 for them and set ErrMsg informatively.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D155793.543340.patch
Type: text/x-patch
Size: 1402 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230724/13dece32/attachment.bin>
More information about the llvm-commits
mailing list