Nix 2.36.0
Nix, the purely functional package manager; unstable internal interfaces
Loading...
Searching...
No Matches
unix-socket-server.hh
Go to the documentation of this file.
1#pragma once
3
5
6#include <filesystem>
7#include <functional>
8#include <optional>
9#include <sys/types.h>
10
11namespace nix::unix {
12
17{
18 std::optional<pid_t> pid;
19 std::optional<uid_t> uid;
20 std::optional<gid_t> gid;
21};
22
27
36using UnixSocketHandler = fun<void(AutoCloseFD socket)>;
37
44{
48 std::filesystem::path socketPath;
49
53 mode_t socketMode = 0666;
54
55#ifndef _WIN32
61 std::string activationName = "";
62
67 Descriptor auxiliaryFd = INVALID_DESCRIPTOR;
68
72 std::function<void()> onAuxiliaryFdPollin = nullptr;
73#endif
74};
75
76MakeError(AbortServeSocket, BaseError);
77
98[[noreturn]] void serveUnixSocket(const ServeUnixSocketOptions & options, UnixSocketHandler handler);
99
100} // namespace nix::unix
Definition file-descriptor.hh:265
Definition error.hh:136
Definition fun.hh:19
File descriptor operations for almost arbitrary file descriptors.
int Descriptor
Definition file-descriptor.hh:36
Definition unix-socket-server.hh:17
Definition unix-socket-server.hh:44
std::filesystem::path socketPath
Definition unix-socket-server.hh:48
Descriptor auxiliaryFd
Definition unix-socket-server.hh:67
std::string activationName
Definition unix-socket-server.hh:61
mode_t socketMode
Definition unix-socket-server.hh:53
std::function< void()> onAuxiliaryFdPollin
Definition unix-socket-server.hh:72
fun< void(AutoCloseFD socket)> UnixSocketHandler
Definition unix-socket-server.hh:36
PeerInfo getPeerInfo(Descriptor remote)
Definition unix-socket-server.cc:27
void serveUnixSocket(const ServeUnixSocketOptions &options, UnixSocketHandler handler)
Definition unix-socket-server.cc:70