Files
TheRock/compiler/amd-llvm/lldb/tools/debugserver/source/RNBSocket.h
T
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

78 lines
2.0 KiB
C++

//===-- RNBSocket.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 12/12/07.
//
//===----------------------------------------------------------------------===//
#ifndef LLDB_TOOLS_DEBUGSERVER_SOURCE_RNBSOCKET_H
#define LLDB_TOOLS_DEBUGSERVER_SOURCE_RNBSOCKET_H
#include "DNBTimer.h"
#include "RNBDefs.h"
#include <string>
#include <sys/socket.h>
#include <sys/types.h>
#ifdef WITH_LOCKDOWN
#include "lockdown.h"
#endif
class RNBSocket {
public:
typedef void (*PortBoundCallback)(const void *baton, uint16_t port);
RNBSocket()
: m_fd(-1),
#ifdef WITH_LOCKDOWN
m_fd_from_lockdown(false), m_ld_conn(),
#endif
m_timer(true) // Make a thread safe timer
{
}
~RNBSocket(void) { Disconnect(false); }
rnb_err_t Listen(const char *listen_host, uint16_t port,
PortBoundCallback callback, const void *callback_baton);
rnb_err_t Connect(const char *host, uint16_t port);
rnb_err_t useFD(int fd);
#ifdef WITH_LOCKDOWN
rnb_err_t ConnectToService();
#endif
rnb_err_t OpenFile(const char *path);
rnb_err_t Disconnect(bool save_errno);
rnb_err_t Read(std::string &p);
rnb_err_t Write(const void *buffer, size_t length);
bool IsConnected() const { return m_fd != -1; }
void SaveErrno(int curr_errno);
DNBTimer &Timer() { return m_timer; }
static int SetSocketOption(int fd, int level, int option_name,
int option_value);
private:
RNBSocket(const RNBSocket &) = delete;
protected:
rnb_err_t ClosePort(int &fd, bool save_errno);
int m_fd; // Socket we use to communicate once conn established
#ifdef WITH_LOCKDOWN
bool m_fd_from_lockdown;
lockdown_connection m_ld_conn;
#endif
DNBTimer m_timer;
};
#endif // LLDB_TOOLS_DEBUGSERVER_SOURCE_RNBSOCKET_H