[Lldb-commits] [PATCH] D59606: [lldb] [WIP/RFC] Add missing retries on EINTR

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Mar 21 01:03:53 PDT 2019

labath added inline comments.

Comment at: lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp:255-258
+        llvm::sys::RetryAfterSignal(-1, ::cfsetospeed,
+            &options, B115200);
+        llvm::sys::RetryAfterSignal(-1, ::cfsetispeed,
+            &options, B115200);
IIUC, these only manipulate the `options` struct, so I don't see how they could fail with EINTR. OTOH, the `tcsetattr` call below is documented to return EINTR at least on NetBSD <http://netbsd.gw.com/cgi-bin/man-cgi?cfsetospeed+3+NetBSD-current>.

Comment at: lldb/tools/debugserver/source/DNB.cpp:173
       const pid_t pid = (pid_t)death_event.ident;
-      const pid_t child_pid = waitpid(pid, &status, 0);
+      const pid_t child_pid = llvm::sys::RetryAfterSignal(-1, waitpid,
+          pid, &status, 0);
You can't use llvm code from debugserver. I am not really sure what `darwin-debug` is, but the same may be true for that as well. If I were you, I'd just leave these two alone.

Comment at: lldb/tools/lldb-server/lldb-platform.cpp:319
       // Collect child zombie processes.
-      while (waitpid(-1, nullptr, WNOHANG) > 0)
+      while (llvm::sys::RetryAfterSignal(-1, waitpid,
+            -1, nullptr, WNOHANG) > 0)
I don't think this is necessary here with WNOHANG and everything.



More information about the lldb-commits mailing list