[Lldb-commits] [PATCH] D112442: [lldb] [Host/ConnectionFileDescriptor] Do not use non-blocking mode

Michał Górny via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Oct 25 05:38:38 PDT 2021


mgorny created this revision.
mgorny added reviewers: labath, krytarowski, emaste, teemperor.
mgorny requested review of this revision.

Disable non-blocking mode that's enabled only for file:// and serial://
protocols.  We do not seem to have a really good reason for it, and it
only complicates handling partial writes.


https://reviews.llvm.org/D112442

Files:
  lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp


Index: lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp
===================================================================
--- lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp
+++ lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp
@@ -722,13 +722,6 @@
     llvm::sys::RetryAfterSignal(-1, ::tcsetattr, fd, TCSANOW, &options);
   }
 
-  int flags = ::fcntl(fd, F_GETFL, 0);
-  if (flags >= 0) {
-    if ((flags & O_NONBLOCK) == 0) {
-      flags |= O_NONBLOCK;
-      ::fcntl(fd, F_SETFL, flags);
-    }
-  }
   m_io_sp =
       std::make_shared<NativeFile>(fd, File::eOpenOptionReadWrite, true);
   return eConnectionStatusSuccess;
@@ -761,14 +754,6 @@
     return eConnectionStatusError;
   }
 
-  int flags = ::fcntl(fd, F_GETFL, 0);
-  if (flags >= 0) {
-    if ((flags & O_NONBLOCK) == 0) {
-      flags |= O_NONBLOCK;
-      ::fcntl(fd, F_SETFL, flags);
-    }
-  }
-
   llvm::Expected<std::unique_ptr<SerialPort>> serial_sp = SerialPort::Create(
       fd, File::eOpenOptionReadWrite, serial_options.get(), true);
   if (!serial_sp) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D112442.381952.patch
Type: text/x-patch
Size: 1064 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20211025/19df4cfc/attachment.bin>


More information about the lldb-commits mailing list