Nix 2.36.0
Nix, the purely functional package manager; unstable internal interfaces
Loading...
Searching...
No Matches
unix-domain-socket.hh
Go to the documentation of this file.
1#pragma once
3
4#include "nix/util/types.hh"
6#include "nix/util/socket.hh"
7
8#include <filesystem>
9#include <span>
10#include <vector>
11
12#include <unistd.h>
13
14namespace nix {
15
20
24AutoCloseFD createUnixDomainSocket(const std::filesystem::path & path, mode_t mode);
25
29void bind(Socket fd, const std::filesystem::path & path);
30
34void connect(Socket fd, const std::filesystem::path & path);
35
39AutoCloseFD connect(const std::filesystem::path & path);
40
41#ifndef _WIN32
42namespace unix {
43
58void sendMessageWithFds(Descriptor sockfd, std::span<const std::byte> data, std::span<const Descriptor> fds);
59
64{
73 std::vector<AutoCloseFD> fds;
74};
75
92ReceivedMessage receiveMessageWithFds(Descriptor sockfd, std::span<std::byte> data);
93
94} // namespace unix
95#endif
96
97} // namespace nix
Definition file-descriptor.hh:265
File descriptor operations for almost arbitrary file descriptors.
int Descriptor
Definition file-descriptor.hh:36
int Socket
Definition socket.hh:17
Definition unix-domain-socket.hh:64
size_t bytesReceived
Definition unix-domain-socket.hh:68
std::vector< AutoCloseFD > fds
Definition unix-domain-socket.hh:73
void bind(Socket fd, const std::filesystem::path &path)
Definition unix-domain-socket.cc:184
ReceivedMessage receiveMessageWithFds(Descriptor sockfd, std::span< std::byte > data)
Definition unix-domain-socket.cc:275
void connect(Socket fd, const std::filesystem::path &path)
Definition unix-domain-socket.cc:190
AutoCloseFD createUnixDomainSocket()
Definition unix-domain-socket.cc:24
void sendMessageWithFds(Descriptor sockfd, std::span< const std::byte > data, std::span< const Descriptor > fds)
Definition unix-domain-socket.cc:204