[Lldb-commits] [PATCH] D58230: [lldb] [MainLoop] Add kevent() EINTR handling

Michał Górny via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Feb 14 04:37:20 PST 2019


mgorny created this revision.
mgorny added reviewers: krytarowski, labath.
mgorny added a project: LLDB.
Herald added a subscriber: abidh.

Add missing EINTR handling for kevent() calls.  If the call is
interrupted, return from Poll() as if zero events were returned and let
the polling resume on next iteration.  This fixes test flakiness
on NetBSD.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D58230

Files:
  lldb/source/Host/common/MainLoop.cpp


Index: lldb/source/Host/common/MainLoop.cpp
===================================================================
--- lldb/source/Host/common/MainLoop.cpp
+++ lldb/source/Host/common/MainLoop.cpp
@@ -107,8 +107,14 @@
   num_events = kevent(loop.m_kqueue, in_events.data(), in_events.size(),
                       out_events, llvm::array_lengthof(out_events), nullptr);
 
-  if (num_events < 0)
-    return Status(errno, eErrorTypePOSIX);
+  if (num_events < 0) {
+    if (errno == EINTR) {
+      // in case of EINTR, let the main loop run one iteration
+      // we need to zero num_events to avoid assertions failing
+      num_events = 0;
+    } else
+      return Status(errno, eErrorTypePOSIX);
+  }
   return Status();
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58230.186818.patch
Type: text/x-patch
Size: 729 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190214/bebe2bbf/attachment-0001.bin>


More information about the lldb-commits mailing list