[PATCH] D82282: [AIX] Implement wait4

Serge Pavlov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 21 21:41:30 PDT 2020


sepavloff created this revision.
sepavloff added a reviewer: hubert.reinterpretcast.
Herald added a subscriber: hiraditya.
Herald added a project: LLVM.

AIX does not have wait4. This change implements wait4 as a wrapper
over kernel function kwaitpid. The same method was used by GLIBC,
at least in the version 2.3.3.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D82282

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
@@ -329,6 +329,15 @@
   return true;
 }
 
+#if defined(_AIX) && !defined(wait4)
+extern pid_t kwaitpid(int *stat_loc, pid_t pid, int options,
+                      struct rusage *ru_loc, siginfo_t *infop);
+static pid_t wait4(pid_t pid, int *status, int options,
+                   struct rusage *usage) {
+  return kwaitpid(status, pid, options, usage, NULL);
+}
+#endif
+
 namespace llvm {
 
 ProcessInfo sys::Wait(const ProcessInfo &PI, unsigned SecondsToWait,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D82282.272329.patch
Type: text/x-patch
Size: 651 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200622/6d001eab/attachment.bin>


More information about the llvm-commits mailing list