LLDB mainline
Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | List of all members
lldb_private::PipePosix Class Reference

A posix-based implementation of Pipe, a class that abtracts unix style pipes. More...

#include "lldb/Host/posix/PipePosix.h"

Inheritance diagram for lldb_private::PipePosix:
Inheritance graph
[legend]

Public Member Functions

 PipePosix ()
 
 PipePosix (lldb::pipe_t read, lldb::pipe_t write)
 
 PipePosix (const PipePosix &)=delete
 
 PipePosix (PipePosix &&pipe_posix)
 
PipePosixoperator= (const PipePosix &)=delete
 
PipePosixoperator= (PipePosix &&pipe_posix)
 
 ~PipePosix () override
 
Status CreateNew (bool child_process_inherit) override
 
Status CreateNew (llvm::StringRef name, bool child_process_inherit) override
 
Status CreateWithUniqueName (llvm::StringRef prefix, bool child_process_inherit, llvm::SmallVectorImpl< char > &name) override
 
Status OpenAsReader (llvm::StringRef name, bool child_process_inherit) override
 
Status OpenAsWriterWithTimeout (llvm::StringRef name, bool child_process_inherit, const std::chrono::microseconds &timeout) override
 
bool CanRead () const override
 
bool CanWrite () const override
 
lldb::pipe_t GetReadPipe () const override
 
lldb::pipe_t GetWritePipe () const override
 
int GetReadFileDescriptor () const override
 
int GetWriteFileDescriptor () const override
 
int ReleaseReadFileDescriptor () override
 
int ReleaseWriteFileDescriptor () override
 
void CloseReadFileDescriptor () override
 
void CloseWriteFileDescriptor () override
 
void Close () override
 
Status Delete (llvm::StringRef name) override
 
Status WriteWithTimeout (const void *buf, size_t size, const std::chrono::microseconds &timeout, size_t &bytes_written) override
 
Status ReadWithTimeout (void *buf, size_t size, const std::chrono::microseconds &timeout, size_t &bytes_read) override
 
- Public Member Functions inherited from lldb_private::PipeBase
virtual ~PipeBase ()
 
virtual Status CreateNew (bool child_process_inherit)=0
 
virtual Status CreateNew (llvm::StringRef name, bool child_process_inherit)=0
 
virtual Status CreateWithUniqueName (llvm::StringRef prefix, bool child_process_inherit, llvm::SmallVectorImpl< char > &name)=0
 
virtual Status OpenAsReader (llvm::StringRef name, bool child_process_inherit)=0
 
Status OpenAsWriter (llvm::StringRef name, bool child_process_inherit)
 
virtual Status OpenAsWriterWithTimeout (llvm::StringRef name, bool child_process_inherit, const std::chrono::microseconds &timeout)=0
 
virtual bool CanRead () const =0
 
virtual bool CanWrite () const =0
 
virtual lldb::pipe_t GetReadPipe () const =0
 
virtual lldb::pipe_t GetWritePipe () const =0
 
virtual int GetReadFileDescriptor () const =0
 
virtual int GetWriteFileDescriptor () const =0
 
virtual int ReleaseReadFileDescriptor ()=0
 
virtual int ReleaseWriteFileDescriptor ()=0
 
virtual void CloseReadFileDescriptor ()=0
 
virtual void CloseWriteFileDescriptor ()=0
 
virtual void Close ()=0
 
virtual Status Delete (llvm::StringRef name)=0
 
virtual Status WriteWithTimeout (const void *buf, size_t size, const std::chrono::microseconds &timeout, size_t &bytes_written)=0
 
Status Write (const void *buf, size_t size, size_t &bytes_written)
 
virtual Status ReadWithTimeout (void *buf, size_t size, const std::chrono::microseconds &timeout, size_t &bytes_read)=0
 
Status Read (void *buf, size_t size, size_t &bytes_read)
 

Static Public Attributes

static int kInvalidDescriptor = -1
 

Private Member Functions

bool CanReadUnlocked () const
 
bool CanWriteUnlocked () const
 
int GetReadFileDescriptorUnlocked () const
 
int GetWriteFileDescriptorUnlocked () const
 
int ReleaseReadFileDescriptorUnlocked ()
 
int ReleaseWriteFileDescriptorUnlocked ()
 
void CloseReadFileDescriptorUnlocked ()
 
void CloseWriteFileDescriptorUnlocked ()
 
void CloseUnlocked ()
 

Private Attributes

int m_fds [2]
 
std::mutex m_read_mutex
 Mutexes for m_fds;.
 
std::mutex m_write_mutex
 

Detailed Description

A posix-based implementation of Pipe, a class that abtracts unix style pipes.

A class that abstracts the LLDB core from host pipe functionality.

Definition at line 21 of file PipePosix.h.

Constructor & Destructor Documentation

◆ PipePosix() [1/4]

PipePosix::PipePosix ( )

Definition at line 56 of file PipePosix.cpp.

◆ PipePosix() [2/4]

PipePosix::PipePosix ( lldb::pipe_t  read,
lldb::pipe_t  write 
)

Definition at line 59 of file PipePosix.cpp.

◆ PipePosix() [3/4]

lldb_private::PipePosix::PipePosix ( const PipePosix )
delete

◆ PipePosix() [4/4]

PipePosix::PipePosix ( PipePosix &&  pipe_posix)

Definition at line 62 of file PipePosix.cpp.

◆ ~PipePosix()

PipePosix::~PipePosix ( )
override

Definition at line 78 of file PipePosix.cpp.

References Close().

Member Function Documentation

◆ CanRead()

bool PipePosix::CanRead ( ) const
overridevirtual

◆ CanReadUnlocked()

bool PipePosix::CanReadUnlocked ( ) const
private

◆ CanWrite()

bool PipePosix::CanWrite ( ) const
overridevirtual

◆ CanWriteUnlocked()

bool PipePosix::CanWriteUnlocked ( ) const
private

◆ Close()

void PipePosix::Close ( )
overridevirtual

◆ CloseReadFileDescriptor()

void PipePosix::CloseReadFileDescriptor ( )
overridevirtual

◆ CloseReadFileDescriptorUnlocked()

void PipePosix::CloseReadFileDescriptorUnlocked ( )
private

Definition at line 284 of file PipePosix.cpp.

References CanReadUnlocked(), kInvalidDescriptor, m_fds, and READ.

Referenced by CloseReadFileDescriptor(), and CloseUnlocked().

◆ CloseUnlocked()

void PipePosix::CloseUnlocked ( )
private

Definition at line 253 of file PipePosix.cpp.

References CloseReadFileDescriptorUnlocked(), and CloseWriteFileDescriptorUnlocked().

Referenced by Close(), and CreateNew().

◆ CloseWriteFileDescriptor()

void PipePosix::CloseWriteFileDescriptor ( )
overridevirtual

◆ CloseWriteFileDescriptorUnlocked()

void PipePosix::CloseWriteFileDescriptorUnlocked ( )
private

Definition at line 296 of file PipePosix.cpp.

References CanWriteUnlocked(), kInvalidDescriptor, m_fds, and WRITE.

Referenced by CloseUnlocked(), and CloseWriteFileDescriptor().

◆ CreateNew() [1/2]

Status PipePosix::CreateNew ( bool  child_process_inherit)
overridevirtual

◆ CreateNew() [2/2]

Status PipePosix::CreateNew ( llvm::StringRef  name,
bool  child_process_inherit 
)
overridevirtual

◆ CreateWithUniqueName()

Status PipePosix::CreateWithUniqueName ( llvm::StringRef  prefix,
bool  child_process_inherit,
llvm::SmallVectorImpl< char > &  name 
)
overridevirtual

◆ Delete()

Status PipePosix::Delete ( llvm::StringRef  name)
overridevirtual

◆ GetReadFileDescriptor()

int PipePosix::GetReadFileDescriptor ( ) const
overridevirtual

◆ GetReadFileDescriptorUnlocked()

int PipePosix::GetReadFileDescriptorUnlocked ( ) const
private

Definition at line 213 of file PipePosix.cpp.

References m_fds, and READ.

Referenced by GetReadFileDescriptor(), and ReadWithTimeout().

◆ GetReadPipe()

lldb::pipe_t lldb_private::PipePosix::GetReadPipe ( ) const
inlineoverridevirtual

Implements lldb_private::PipeBase.

Definition at line 48 of file PipePosix.h.

References GetReadFileDescriptor().

◆ GetWriteFileDescriptor()

int PipePosix::GetWriteFileDescriptor ( ) const
overridevirtual

◆ GetWriteFileDescriptorUnlocked()

int PipePosix::GetWriteFileDescriptorUnlocked ( ) const
private

Definition at line 222 of file PipePosix.cpp.

References m_fds, and WRITE.

Referenced by GetWriteFileDescriptor(), and WriteWithTimeout().

◆ GetWritePipe()

lldb::pipe_t lldb_private::PipePosix::GetWritePipe ( ) const
inlineoverridevirtual

◆ OpenAsReader()

Status PipePosix::OpenAsReader ( llvm::StringRef  name,
bool  child_process_inherit 
)
overridevirtual

◆ OpenAsWriterWithTimeout()

Status PipePosix::OpenAsWriterWithTimeout ( llvm::StringRef  name,
bool  child_process_inherit,
const std::chrono::microseconds &  timeout 
)
overridevirtual

◆ operator=() [1/2]

PipePosix & lldb_private::PipePosix::operator= ( const PipePosix )
delete

◆ operator=() [2/2]

PipePosix & PipePosix::operator= ( PipePosix &&  pipe_posix)

Definition at line 67 of file PipePosix.cpp.

References m_fds, m_read_mutex, m_write_mutex, READ, and WRITE.

◆ ReadWithTimeout()

Status PipePosix::ReadWithTimeout ( void *  buf,
size_t  size,
const std::chrono::microseconds &  timeout,
size_t &  bytes_read 
)
overridevirtual

◆ ReleaseReadFileDescriptor()

int PipePosix::ReleaseReadFileDescriptor ( )
overridevirtual

◆ ReleaseReadFileDescriptorUnlocked()

int PipePosix::ReleaseReadFileDescriptorUnlocked ( )
private

Definition at line 231 of file PipePosix.cpp.

References kInvalidDescriptor, m_fds, and READ.

Referenced by ReleaseReadFileDescriptor().

◆ ReleaseWriteFileDescriptor()

int PipePosix::ReleaseWriteFileDescriptor ( )
overridevirtual

◆ ReleaseWriteFileDescriptorUnlocked()

int PipePosix::ReleaseWriteFileDescriptorUnlocked ( )
private

Definition at line 242 of file PipePosix.cpp.

References kInvalidDescriptor, m_fds, and WRITE.

Referenced by ReleaseWriteFileDescriptor().

◆ WriteWithTimeout()

Status PipePosix::WriteWithTimeout ( const void *  buf,
size_t  size,
const std::chrono::microseconds &  timeout,
size_t &  bytes_written 
)
overridevirtual

Member Data Documentation

◆ kInvalidDescriptor

int PipePosix::kInvalidDescriptor = -1
static

◆ m_fds

int lldb_private::PipePosix::m_fds[2]
private

◆ m_read_mutex

std::mutex lldb_private::PipePosix::m_read_mutex
mutableprivate

◆ m_write_mutex

std::mutex lldb_private::PipePosix::m_write_mutex
mutableprivate

The documentation for this class was generated from the following files: