[Lldb-commits] [lldb] 9d63b90 - [lldb] [Host/ConnectionFileDescriptor] Do not use non-blocking mode

Michał Górny via lldb-commits lldb-commits at lists.llvm.org
Mon Oct 25 07:24:08 PDT 2021


Author: Michał Górny
Date: 2021-10-25T16:24:00+02:00
New Revision: 9d63b90b59a6283531199e29038954db9ae23d74

URL: https://github.com/llvm/llvm-project/commit/9d63b90b59a6283531199e29038954db9ae23d74
DIFF: https://github.com/llvm/llvm-project/commit/9d63b90b59a6283531199e29038954db9ae23d74.diff

LOG: [lldb] [Host/ConnectionFileDescriptor] Do not use non-blocking mode

Disable non-blocking mode that's enabled only for file:// and serial://
protocols.  All read operations should be going through the select(2)
in ConnectionFileDescriptor::BytesAvaliable, which effectively erases
(non-)blocking mode differences in reading.  We do want to perform
writes in the blocking mode.

Differential Revision: https://reviews.llvm.org/D112442

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp b/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp
index e333394f0ea79..8e8ff8a4e3a03 100644
--- a/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp
+++ b/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp
@@ -722,13 +722,6 @@ ConnectionStatus ConnectionFileDescriptor::ConnectFile(llvm::StringRef s,
     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 @@ ConnectionFileDescriptor::ConnectSerialPort(llvm::StringRef s,
     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) {


        


More information about the lldb-commits mailing list