[PATCH] D61096: posix_spawn should retry upon EINTR

JF Bastien via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 24 15:39:40 PDT 2019


jfb marked 2 inline comments as done.
jfb added a comment.

In D61096#1477806 <https://reviews.llvm.org/D61096#1477806>, @jkorous wrote:

> Hmm, we have this utility function `RetryAfterSignal()` but it doesn't have `maxRetries`.
>
> http://llvm.org/doxygen/namespacellvm_1_1sys.html#aea8b04d954b2cebd8a26d5d712634312


That one won't work because `posix_spawn` doesn't set `errno`, it returns the error code directly.



================
Comment at: lib/Support/Unix/Program.inc:257
+                        const_cast<char **>(Envp));
+    } while (Err == EINTR && ++retries < maxRetries);
 
----------------
jkorous wrote:
> Nit: shouldn't it be `<=` or `s/retries/tries/`?
Say `maxRetries` is `1`. First we try, it fails, we'll retry because `0 < 1`, and then if it fails again we won't retry because `1 < 1` is `false`. So we got one try and one retry. I think you're counting the initial try as a retry whereas I'm not :-)


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61096/new/

https://reviews.llvm.org/D61096





More information about the llvm-commits mailing list