Files
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

80 lines
2.3 KiB
C++

//===-- PseudoTerminal.h ----------------------------------------*- C++ -*-===//
//
// 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
//
//===----------------------------------------------------------------------===//
//
// Created by Greg Clayton on 1/8/08.
//
//===----------------------------------------------------------------------===//
#ifndef LLDB_TOOLS_DEBUGSERVER_SOURCE_PSEUDOTERMINAL_H
#define LLDB_TOOLS_DEBUGSERVER_SOURCE_PSEUDOTERMINAL_H
#include <fcntl.h>
#include <string>
#include <termios.h>
class PseudoTerminal {
public:
enum { invalid_fd = -1, invalid_pid = -1 };
enum Status {
success = 0,
err_posix_openpt_failed = -2,
err_grantpt_failed = -3,
err_unlockpt_failed = -4,
err_ptsname_failed = -5,
err_open_secondary_failed = -6,
err_fork_failed = -7,
err_setsid_failed = -8,
err_failed_to_acquire_controlling_terminal = -9,
err_dup2_failed_on_stdin = -10,
err_dup2_failed_on_stdout = -11,
err_dup2_failed_on_stderr = -12
};
// Constructors and Destructors
PseudoTerminal();
~PseudoTerminal();
void ClosePrimary();
void CloseSecondary();
Status OpenFirstAvailablePrimary(int oflag);
Status OpenSecondary(int oflag);
int PrimaryFD() const { return m_primary_fd; }
int SecondaryFD() const { return m_secondary_fd; }
int ReleasePrimaryFD() {
// Release ownership of the primary pseudo terminal file
// descriptor without closing it. (the destructor for this
// class will close it otherwise!)
int fd = m_primary_fd;
m_primary_fd = invalid_fd;
return fd;
}
int ReleaseSecondaryFD() {
// Release ownership of the secondary pseudo terminal file
// descriptor without closing it (the destructor for this
// class will close it otherwise!)
int fd = m_secondary_fd;
m_secondary_fd = invalid_fd;
return fd;
}
const char *SecondaryName() const;
pid_t Fork(Status &error);
protected:
// Classes that inherit from PseudoTerminal can see and modify these
int m_primary_fd;
int m_secondary_fd;
private:
PseudoTerminal(const PseudoTerminal &rhs) = delete;
PseudoTerminal &operator=(const PseudoTerminal &rhs) = delete;
};
#endif // LLDB_TOOLS_DEBUGSERVER_SOURCE_PSEUDOTERMINAL_H