#include "lldb/Host/File.h"
#include <cerrno>
#include <climits>
#include <cstdarg>
#include <cstdio>
#include <fcntl.h>
#include <optional>
#ifdef _WIN32
#include "lldb/Host/windows/windows.h"
#else
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <termios.h>
#include <unistd.h>
#endif
#include "lldb/Host/Config.h"
#include "lldb/Host/FileSystem.h"
#include "lldb/Host/Host.h"
#include "lldb/Utility/DataBufferHeap.h"
#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/VASPrintf.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/ConvertUTF.h"
#include "llvm/Support/Errno.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Process.h"
usingnamespacelldb;
usingnamespacelldb_private;
Expected;
Expected<const char *>
File::GetStreamOpenModeFromOptions(File::OpenOptions options) { … }
Expected<File::OpenOptions> File::GetOptionsFromMode(llvm::StringRef mode) { … }
int File::kInvalidDescriptor = …;
FILE *File::kInvalidStream = …;
Status File::Read(void *buf, size_t &num_bytes) { … }
Status File::Write(const void *buf, size_t &num_bytes) { … }
bool File::IsValid() const { … }
Status File::Close() { … }
IOObject::WaitableHandle File::GetWaitableHandle() { … }
Status File::GetFileSpec(FileSpec &file_spec) const { … }
int File::GetDescriptor() const { … }
FILE *File::GetStream() { … }
off_t File::SeekFromStart(off_t offset, Status *error_ptr) { … }
off_t File::SeekFromCurrent(off_t offset, Status *error_ptr) { … }
off_t File::SeekFromEnd(off_t offset, Status *error_ptr) { … }
Status File::Read(void *dst, size_t &num_bytes, off_t &offset) { … }
Status File::Write(const void *src, size_t &num_bytes, off_t &offset) { … }
Status File::Flush() { … }
Status File::Sync() { … }
void File::CalculateInteractiveAndTerminal() { … }
bool File::GetIsInteractive() { … }
bool File::GetIsRealTerminal() { … }
bool File::GetIsTerminalWithColors() { … }
size_t File::Printf(const char *format, ...) { … }
size_t File::PrintfVarArg(const char *format, va_list args) { … }
Expected<File::OpenOptions> File::GetOptions() const { … }
uint32_t File::GetPermissions(Status &error) const { … }
bool NativeFile::IsValid() const { … }
Expected<File::OpenOptions> NativeFile::GetOptions() const { … }
int NativeFile::GetDescriptor() const { … }
IOObject::WaitableHandle NativeFile::GetWaitableHandle() { … }
FILE *NativeFile::GetStream() { … }
Status NativeFile::Close() { … }
Status NativeFile::GetFileSpec(FileSpec &file_spec) const { … }
off_t NativeFile::SeekFromStart(off_t offset, Status *error_ptr) { … }
off_t NativeFile::SeekFromCurrent(off_t offset, Status *error_ptr) { … }
off_t NativeFile::SeekFromEnd(off_t offset, Status *error_ptr) { … }
Status NativeFile::Flush() { … }
Status NativeFile::Sync() { … }
#if defined(__APPLE__)
#define MAX_READ_SIZE …
#define MAX_WRITE_SIZE …
#endif
Status NativeFile::Read(void *buf, size_t &num_bytes) { … }
Status NativeFile::Write(const void *buf, size_t &num_bytes) { … }
Status NativeFile::Read(void *buf, size_t &num_bytes, off_t &offset) { … }
Status NativeFile::Write(const void *buf, size_t &num_bytes, off_t &offset) { … }
size_t NativeFile::PrintfVarArg(const char *format, va_list args) { … }
mode_t File::ConvertOpenOptionsForPOSIXOpen(OpenOptions open_options) { … }
llvm::Expected<SerialPort::Options>
SerialPort::OptionsFromURL(llvm::StringRef urlqs) { … }
llvm::Expected<std::unique_ptr<SerialPort>>
SerialPort::Create(int fd, OpenOptions options, Options serial_options,
bool transfer_ownership) { … }
SerialPort::SerialPort(int fd, OpenOptions options,
SerialPort::Options serial_options,
bool transfer_ownership)
: … { … }
Status SerialPort::Close() { … }
char File::ID = …;
char NativeFile::ID = …;
char SerialPort::ID = …;