llvm/lldb/source/Host/posix/PipePosix.cpp

//===-- PipePosix.cpp -----------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "lldb/Host/posix/PipePosix.h"
#include "lldb/Host/FileSystem.h"
#include "lldb/Host/HostInfo.h"
#include "lldb/Utility/SelectHelper.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/Support/Errno.h"
#include <functional>
#include <thread>

#include <cerrno>
#include <climits>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>

usingnamespacelldb;
usingnamespacelldb_private;

int PipePosix::kInvalidDescriptor =;

enum PIPES {}; // Constants 0 and 1 for READ and WRITE

// pipe2 is supported by a limited set of platforms
// TODO: Add more platforms that support pipe2.
#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) ||       \
    defined(__OpenBSD__)
#define PIPE2_SUPPORTED
#else
#define PIPE2_SUPPORTED
#endif

static constexpr auto OPEN_WRITER_SLEEP_TIMEOUT_MSECS =;

#if defined(FD_CLOEXEC) && !PIPE2_SUPPORTED
static bool SetCloexecFlag(int fd) {
  int flags = ::fcntl(fd, F_GETFD);
  if (flags == -1)
    return false;
  return (::fcntl(fd, F_SETFD, flags | FD_CLOEXEC) == 0);
}
#endif

static std::chrono::time_point<std::chrono::steady_clock> Now() {}

PipePosix::PipePosix()
    :{}

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

PipePosix::PipePosix(PipePosix &&pipe_posix)
    :{}

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

PipePosix::~PipePosix() {}

Status PipePosix::CreateNew(bool child_processes_inherit) {}

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

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

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

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

int PipePosix::GetReadFileDescriptor() const {}

int PipePosix::GetReadFileDescriptorUnlocked() const {}

int PipePosix::GetWriteFileDescriptor() const {}

int PipePosix::GetWriteFileDescriptorUnlocked() const {}

int PipePosix::ReleaseReadFileDescriptor() {}

int PipePosix::ReleaseReadFileDescriptorUnlocked() {}

int PipePosix::ReleaseWriteFileDescriptor() {}

int PipePosix::ReleaseWriteFileDescriptorUnlocked() {}

void PipePosix::Close() {}

void PipePosix::CloseUnlocked() {}

Status PipePosix::Delete(llvm::StringRef name) {}

bool PipePosix::CanRead() const {}

bool PipePosix::CanReadUnlocked() const {}

bool PipePosix::CanWrite() const {}

bool PipePosix::CanWriteUnlocked() const {}

void PipePosix::CloseReadFileDescriptor() {}
void PipePosix::CloseReadFileDescriptorUnlocked() {}

void PipePosix::CloseWriteFileDescriptor() {}

void PipePosix::CloseWriteFileDescriptorUnlocked() {}

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

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