[Lldb-commits] [lldb] r236136 - Expose Close{Read/Write}FileDescriptor for pipes.

Chaoren Lin chaorenl at google.com
Wed Apr 29 11:25:18 PDT 2015


Author: chaoren
Date: Wed Apr 29 13:25:18 2015
New Revision: 236136

URL: http://llvm.org/viewvc/llvm-project?rev=236136&view=rev
Log:
Expose Close{Read/Write}FileDescriptor for pipes.

Modified:
    lldb/trunk/include/lldb/Host/PipeBase.h
    lldb/trunk/include/lldb/Host/posix/PipePosix.h
    lldb/trunk/include/lldb/Host/windows/PipeWindows.h
    lldb/trunk/source/Host/windows/PipeWindows.cpp

Modified: lldb/trunk/include/lldb/Host/PipeBase.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/PipeBase.h?rev=236136&r1=236135&r2=236136&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/PipeBase.h (original)
+++ lldb/trunk/include/lldb/Host/PipeBase.h Wed Apr 29 13:25:18 2015
@@ -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;

Modified: lldb/trunk/include/lldb/Host/posix/PipePosix.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/posix/PipePosix.h?rev=236136&r1=236135&r2=236136&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/posix/PipePosix.h (original)
+++ lldb/trunk/include/lldb/Host/posix/PipePosix.h Wed Apr 29 13:25:18 2015
@@ -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];
 };

Modified: lldb/trunk/include/lldb/Host/windows/PipeWindows.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/windows/PipeWindows.h?rev=236136&r1=236135&r2=236136&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/windows/PipeWindows.h (original)
+++ lldb/trunk/include/lldb/Host/windows/PipeWindows.h Wed Apr 29 13:25:18 2015
@@ -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;
 

Modified: lldb/trunk/source/Host/windows/PipeWindows.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/windows/PipeWindows.cpp?rev=236136&r1=236135&r2=236136&view=diff
==============================================================================
--- lldb/trunk/source/Host/windows/PipeWindows.cpp (original)
+++ lldb/trunk/source/Host/windows/PipeWindows.cpp Wed Apr 29 13:25:18 2015
@@ -85,7 +85,7 @@ PipeWindows::CreateNew(llvm::StringRef n
     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





More information about the lldb-commits mailing list