14#ifndef LLVM_SUPPORT_RAW_SOCKET_STREAM_H
15#define LLVM_SUPPORT_RAW_SOCKET_STREAM_H
60class ListeningSocket {
63 std::string SocketPath;
71 ListeningSocket(
int SocketFD,
StringRef SocketPath,
int PipeFD[2]);
79 LLVM_ABI ListeningSocket(ListeningSocket &&LS);
81 ListeningSocket &
operator=(
const ListeningSocket &) =
delete;
103 const std::chrono::milliseconds &
Timeout = std::chrono::milliseconds(-1));
122 uint64_t current_pos()
const override {
return 0; }
150 const std::chrono::milliseconds &
Timeout = std::chrono::milliseconds(-1));
Tagged union holding either a T or a Error.
static LLVM_ABI Expected< ListeningSocket > createUnix(StringRef SocketPath, int MaxBacklog=llvm::hardware_concurrency().compute_thread_count())
Creates a listening socket bound to the specified file system path.
ListeningSocket(const ListeningSocket &LS)=delete
ListeningSocket & operator=(const ListeningSocket &)=delete
LLVM_ABI void shutdown()
Closes the FD, unlinks the socket file, and writes to PipeFD.
LLVM_ABI ~ListeningSocket()
LLVM_ABI Expected< std::unique_ptr< raw_socket_stream > > accept(const std::chrono::milliseconds &Timeout=std::chrono::milliseconds(-1))
Accepts an incoming connection on the listening socket.
StringRef - Represent a constant reference to a string, i.e.
LLVM_ABI raw_fd_stream(StringRef Filename, std::error_code &EC)
Open the specified file for reading/writing/seeking.
static Expected< std::unique_ptr< raw_socket_stream > > createConnectedUnix(StringRef SocketPath)
Create a raw_socket_stream connected to the UNIX domain socket at SocketPath.
raw_socket_stream(int SocketFD)
ssize_t read(char *Ptr, size_t Size, const std::chrono::milliseconds &Timeout=std::chrono::milliseconds(-1))
Attempt to read from the raw_socket_stream's file descriptor.
This is an optimization pass for GlobalISel generic memory operations.
ThreadPoolStrategy hardware_concurrency(unsigned ThreadCount=0)
Returns a default thread strategy where all available hardware resources are to be used,...
@ Timeout
Reached timeout while waiting for the owner to release the lock.