From: Chaoren Lin Date: Wed, 29 Apr 2015 18:25:18 +0000 (+0000) Subject: Expose Close{Read/Write}FileDescriptor for pipes. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=66f2e12f7ac928367b40f38c0df2fd50edd537a6;p=platform%2Fupstream%2Fllvm.git Expose Close{Read/Write}FileDescriptor for pipes. llvm-svn: 236136 --- diff --git a/lldb/include/lldb/Host/PipeBase.h b/lldb/include/lldb/Host/PipeBase.h index 5ef2bb5..8680a25 100644 --- a/lldb/include/lldb/Host/PipeBase.h +++ b/lldb/include/lldb/Host/PipeBase.h @@ -40,6 +40,8 @@ class PipeBase virtual int GetWriteFileDescriptor() const = 0; virtual int ReleaseReadFileDescriptor() = 0; virtual int ReleaseWriteFileDescriptor() = 0; + virtual void CloseReadFileDescriptor() = 0; + virtual void CloseWriteFileDescriptor() = 0; // Close both descriptors virtual void Close() = 0; diff --git a/lldb/include/lldb/Host/posix/PipePosix.h b/lldb/include/lldb/Host/posix/PipePosix.h index 1609bb4..04e83fd 100644 --- a/lldb/include/lldb/Host/posix/PipePosix.h +++ b/lldb/include/lldb/Host/posix/PipePosix.h @@ -56,6 +56,11 @@ public: ReleaseReadFileDescriptor() override; int ReleaseWriteFileDescriptor() override; + void + CloseReadFileDescriptor() override; + void + CloseWriteFileDescriptor() override; + // Close both descriptors void @@ -69,11 +74,6 @@ public: Error ReadWithTimeout(void *buf, size_t size, const std::chrono::microseconds &timeout, size_t &bytes_read) override; - void - CloseReadFileDescriptor(); - void - CloseWriteFileDescriptor(); - private: int m_fds[2]; }; diff --git a/lldb/include/lldb/Host/windows/PipeWindows.h b/lldb/include/lldb/Host/windows/PipeWindows.h index 00307ed..7170c7c 100644 --- a/lldb/include/lldb/Host/windows/PipeWindows.h +++ b/lldb/include/lldb/Host/windows/PipeWindows.h @@ -42,6 +42,8 @@ class PipeWindows : public PipeBase int GetWriteFileDescriptor() const override; int ReleaseReadFileDescriptor() override; int ReleaseWriteFileDescriptor() override; + void CloseReadFileDescriptor() override; + void CloseWriteFileDescriptor() override; void Close() override; @@ -57,9 +59,6 @@ class PipeWindows : public PipeBase private: Error OpenNamedPipe(llvm::StringRef name, bool child_process_inherit, bool is_read); - void CloseReadEndpoint(); - void CloseWriteEndpoint(); - HANDLE m_read; HANDLE m_write; diff --git a/lldb/source/Host/windows/PipeWindows.cpp b/lldb/source/Host/windows/PipeWindows.cpp index 3f20cc5..d4afd6e 100644 --- a/lldb/source/Host/windows/PipeWindows.cpp +++ b/lldb/source/Host/windows/PipeWindows.cpp @@ -85,7 +85,7 @@ PipeWindows::CreateNew(llvm::StringRef name, bool child_process_inherit) Error result = OpenNamedPipe(name, child_process_inherit, false); if (!result.Success()) { - CloseReadEndpoint(); + CloseReadFileDescriptor(); return result; } @@ -215,7 +215,7 @@ PipeWindows::ReleaseWriteFileDescriptor() } void -PipeWindows::CloseReadEndpoint() +PipeWindows::CloseReadFileDescriptor() { if (!CanRead()) return; @@ -229,7 +229,7 @@ PipeWindows::CloseReadEndpoint() } void -PipeWindows::CloseWriteEndpoint() +PipeWindows::CloseWriteFileDescriptor() { if (!CanWrite()) return; @@ -243,8 +243,8 @@ PipeWindows::CloseWriteEndpoint() void PipeWindows::Close() { - CloseReadEndpoint(); - CloseWriteEndpoint(); + CloseReadFileDescriptor(); + CloseWriteFileDescriptor(); } Error