[PATCH] Don't fail on EINTR, unless we have set a timeout.
Julien Lerouge
jlerouge at apple.com
Wed Jun 25 19:35:05 PDT 2014
Hi tareqsiraj,
Hello,
lldb can interrupt waitpid, so EINTR shouldn't be an error. This fixes the case
where there is no timeout. In the case where there is a timeout though, the
code is still wrong since it doesn't check that the alarm really went off.
Without this patch, I cannot debug a program that forks itself using
sys::ExecuteAndWait with lldb.
Thanks,
Julien
http://reviews.llvm.org/D4308
Files:
lib/Support/Unix/Program.inc
Index: lib/Support/Unix/Program.inc
===================================================================
--- lib/Support/Unix/Program.inc
+++ lib/Support/Unix/Program.inc
@@ -350,7 +350,11 @@
// Parent process: Wait for the child process to terminate.
int status;
ProcessInfo WaitResult;
- WaitResult.Pid = waitpid(ChildPid, &status, WaitPidOptions);
+
+ do {
+ WaitResult.Pid = waitpid(ChildPid, &status, WaitPidOptions);
+ } while (WaitUntilTerminates && WaitResult.Pid == -1 && errno == EINTR);
+
if (WaitResult.Pid != PI.Pid) {
if (WaitResult.Pid == 0) {
// Non-blocking wait.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D4308.10876.patch
Type: text/x-patch
Size: 610 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140626/c8911bac/attachment.bin>
More information about the llvm-commits
mailing list