1 //===-- PipePosix.h ---------------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef liblldb_Host_posix_PipePosix_h_
11 #define liblldb_Host_posix_PipePosix_h_
12 #if defined(__cplusplus)
14 #include "lldb/Host/PipeBase.h"
16 namespace lldb_private {
18 //----------------------------------------------------------------------
19 /// @class PipePosix PipePosix .h "lldb/Host/posix/PipePosix.h"
20 /// @brief A posix-based implementation of Pipe, a class that abtracts
23 /// A class that abstracts the LLDB core from host pipe functionality.
24 //----------------------------------------------------------------------
25 class PipePosix : public PipeBase
28 static int kInvalidDescriptor;
32 ~PipePosix() override;
35 CreateNew(bool child_process_inherit) override;
37 CreateNew(llvm::StringRef name, bool child_process_inherit) override;
39 OpenAsReader(llvm::StringRef name, bool child_process_inherit) override;
41 OpenAsWriterWithTimeout(llvm::StringRef name, bool child_process_inherit, const std::chrono::microseconds &timeout) override;
44 CanRead() const override;
46 CanWrite() const override;
49 GetReadFileDescriptor() const override;
51 GetWriteFileDescriptor() const override;
53 ReleaseReadFileDescriptor() override;
55 ReleaseWriteFileDescriptor() override;
57 // Close both descriptors
62 Delete(llvm::StringRef name) override;
65 Write(const void *buf, size_t size, size_t &bytes_written) override;
67 ReadWithTimeout(void *buf, size_t size, const std::chrono::microseconds &timeout, size_t &bytes_read) override;
71 CloseReadFileDescriptor();
73 CloseWriteFileDescriptor();
78 } // namespace lldb_private
80 #endif // #if defined(__cplusplus)
81 #endif // liblldb_Host_posix_PipePosix_h_