blob: fbdac66149d67aa4bdac6578923778ee377b98c3 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
//===-- PipePosix.h ---------------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef liblldb_Host_posix_PipePosix_h_
#define liblldb_Host_posix_PipePosix_h_
#if defined(__cplusplus)
#include "lldb/Host/PipeBase.h"
namespace lldb_private {
//----------------------------------------------------------------------
/// @class PipePosix PipePosix .h "lldb/Host/posix/PipePosix.h"
/// @brief A posix-based implementation of Pipe, a class that abtracts
/// unix style pipes.
///
/// A class that abstracts the LLDB core from host pipe functionality.
//----------------------------------------------------------------------
class PipePosix : public PipeBase
{
public:
static int kInvalidDescriptor;
PipePosix();
~PipePosix() override;
Error
CreateNew(bool child_process_inherit) override;
Error
CreateNew(llvm::StringRef name, bool child_process_inherit) override;
Error
CreateWithUniqueName(llvm::StringRef prefix, bool child_process_inherit, llvm::SmallVectorImpl<char>& name) override;
Error
OpenAsReader(llvm::StringRef name, bool child_process_inherit) override;
Error
OpenAsWriterWithTimeout(llvm::StringRef name, bool child_process_inherit, const std::chrono::microseconds &timeout) override;
bool
CanRead() const override;
bool
CanWrite() const override;
int
GetReadFileDescriptor() const override;
int
GetWriteFileDescriptor() const override;
int
ReleaseReadFileDescriptor() override;
int
ReleaseWriteFileDescriptor() override;
// Close both descriptors
void
Close() override;
Error
Delete(llvm::StringRef name) override;
Error
Write(const void *buf, size_t size, size_t &bytes_written) override;
Error
ReadWithTimeout(void *buf, size_t size, const std::chrono::microseconds &timeout, size_t &bytes_read) override;
private:
void
CloseReadFileDescriptor();
void
CloseWriteFileDescriptor();
int m_fds[2];
};
} // namespace lldb_private
#endif // #if defined(__cplusplus)
#endif // liblldb_Host_posix_PipePosix_h_
|