19#include "llvm/Support/raw_ostream.h"
24 bool transfer_ownership)
26 HANDLE h = INVALID_HANDLE_VALUE;
28 h = ::GetStdHandle(STD_INPUT_HANDLE);
29 else if (fh == stdout)
30 h = ::GetStdHandle(STD_OUTPUT_HANDLE);
31 else if (fh == stderr)
32 h = ::GetStdHandle(STD_ERROR_HANDLE);
34 h != INVALID_HANDLE_VALUE && ::GetFileType(h) == FILE_TYPE_CHAR;
38 bool transfer_ownership)
40 HANDLE h = INVALID_HANDLE_VALUE;
41 if (fd == STDIN_FILENO)
42 h = ::GetStdHandle(STD_INPUT_HANDLE);
43 else if (fd == STDOUT_FILENO)
44 h = ::GetStdHandle(STD_OUTPUT_HANDLE);
45 else if (fd == STDERR_FILENO)
46 h = ::GetStdHandle(STD_ERROR_HANDLE);
48 h != INVALID_HANDLE_VALUE && ::GetFileType(h) == FILE_TYPE_CHAR;
64#if defined(ENABLE_VIRTUAL_TERMINAL_PROCESSING)
96 llvm::raw_fd_ostream(_fileno(
m_stream),
false)
97 .write((
const char *)buf, num_bytes);
static llvm::raw_ostream & error(Stream &strm)
static int kInvalidDescriptor
LazyBool m_is_real_terminal
LazyBool m_is_interactive
static bool DescriptorIsValid(int descriptor)
LazyBool m_supports_colors
lldb::file_t WaitableHandle
std::mutex offset_access_mutex
Status Write(const void *buf, size_t &num_bytes) override
Write bytes from buf to a file at the current file position.
int GetDescriptor() const override
Get underlying OS file descriptor for this file, or kInvalidDescriptor.
ValueGuard DescriptorIsValid() const
off_t SeekFromStart(off_t offset, Status *error_ptr=nullptr) override
Seek to an offset relative to the beginning of the file.
Status Read(void *buf, size_t &num_bytes) override
Read bytes from a file from the current file position into buf.
int Fileno(FILE *fh) const override
Map a stream to its underlying file descriptor.
Status Sync() override
Sync to disk.
void CalculateInteractiveAndTerminal() override
Refresh the cached interactive / terminal / color flags by inspecting the underlying descriptor.
bool TryWriteStreamUnlocked(const void *buf, size_t &num_bytes, Status &error) override
Hook for stream writes that bypass the default fwrite path.
NativeFileWindows()=default
Status Write(const void *src, size_t &num_bytes, off_t &offset) override
Write bytes to a file at the specified file offset.
WaitableHandle GetWaitableHandle() override
Get a handle that can be used for OS polling interfaces, such as WaitForMultipleObjects,...
Status Read(void *dst, size_t &num_bytes, off_t &offset) override
Read bytes from a file from the specified file offset.
bool m_is_windows_console
Set when this file wraps stdin/stdout/stderr connected to a console; triggers the raw_fd_ostream path...
int Dup(int fd) const override
Duplicate a file descriptor.
static Status FromErrorString(const char *str)
A class that represents a running process on the host machine.