[Lldb-commits] [PATCH] D111314: [lldb] [ConnectionFileDescriptorPosix] Use a single NativeFile
Michał Górny via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Thu Oct 7 07:31:14 PDT 2021
mgorny created this revision.
mgorny added reviewers: labath, teemperor, krytarowski, emaste.
mgorny requested review of this revision.
Replace separate read and write NativeFile instances with a single
instance shared for reading and writing. There is no clear indication
why two instances were used in the first place, and replacing them
with just one does not seem to cause any regressions in tests or manual
'process connect file://...'.
https://reviews.llvm.org/D111314
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
@@ -85,9 +85,8 @@
: Connection(), m_pipe(), m_mutex(), m_shutting_down(false),
m_waiting_for_accept(false), m_child_processes_inherit(false) {
m_write_sp =
- std::make_shared<NativeFile>(fd, File::eOpenOptionWriteOnly, owns_fd);
- m_read_sp =
- std::make_shared<NativeFile>(fd, File::eOpenOptionReadOnly, false);
+ std::make_shared<NativeFile>(fd, File::eOpenOptionReadWrite, owns_fd);
+ m_read_sp = m_write_sp;
Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION |
LIBLLDB_LOG_OBJECT));
@@ -219,9 +218,8 @@
m_write_sp = m_read_sp;
} else {
m_read_sp = std::make_shared<NativeFile>(
- fd, File::eOpenOptionReadOnly, false);
- m_write_sp = std::make_shared<NativeFile>(
- fd, File::eOpenOptionWriteOnly, false);
+ fd, File::eOpenOptionReadWrite, false);
+ m_write_sp = m_read_sp;
}
m_uri = std::string(*addr);
return eConnectionStatusSuccess;
@@ -259,9 +257,8 @@
}
}
m_read_sp =
- std::make_shared<NativeFile>(fd, File::eOpenOptionReadOnly, true);
- m_write_sp =
- std::make_shared<NativeFile>(fd, File::eOpenOptionWriteOnly, false);
+ std::make_shared<NativeFile>(fd, File::eOpenOptionReadWrite, true);
+ m_write_sp = m_read_sp;
return eConnectionStatusSuccess;
}
#endif
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111314.377842.patch
Type: text/x-patch
Size: 1742 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20211007/8c3bb6ee/attachment.bin>
More information about the lldb-commits
mailing list