Nix
2.36.0
Nix, the purely functional package manager; unstable internal interfaces
Toggle main menu visibility
Loading...
Searching...
No Matches
muxable-pipe.hh
Go to the documentation of this file.
1
#pragma once
3
4
#include "
nix/util/file-descriptor.hh
"
5
#include "
nix/util/fun.hh
"
6
#ifdef _WIN32
7
# include "
nix/util/windows-async-pipe.hh
"
8
#endif
9
10
#ifndef _WIN32
11
# include <poll.h>
12
#else
13
# include <ioapiset.h>
14
#endif
15
16
namespace
nix {
17
26
using
MuxablePipe
=
27
#ifndef _WIN32
28
Pipe
29
#else
30
windows::AsyncPipe
31
#endif
32
;
33
39
struct
MuxablePipePollState
40
{
41
#ifndef _WIN32
42
std::vector<struct pollfd> pollStatus;
43
std::map<int, size_t> fdToPollStatus;
44
#else
45
OVERLAPPED_ENTRY oentries[0x20] = {0};
46
ULONG removed;
47
bool
gotEOF =
false
;
48
49
#endif
50
54
void
poll
(
55
#ifdef _WIN32
56
HANDLE ioport,
57
#endif
58
std::optional<unsigned int> timeout);
59
60
using
CommChannel =
61
#ifndef _WIN32
62
Descriptor
63
#else
64
windows::AsyncPipe
*
65
#endif
66
;
67
76
void
iterate
(
77
std::set<CommChannel> & channels,
78
fun
<
void
(
Descriptor
fd, std::string_view data)> handleRead,
79
fun
<
void
(
Descriptor
fd)> handleEOF);
80
};
81
82
}
// namespace nix
nix::Pipe
Definition
file-descriptor.hh:331
nix::fun
Definition
fun.hh:19
nix::windows::AsyncPipe
Definition
windows-async-pipe.hh:16
file-descriptor.hh
File descriptor operations for almost arbitrary file descriptors.
nix::Descriptor
int Descriptor
Definition
file-descriptor.hh:36
fun.hh
nix::MuxablePipe
Pipe MuxablePipe
Definition
muxable-pipe.hh:26
nix::MuxablePipePollState
Definition
muxable-pipe.hh:40
nix::MuxablePipePollState::poll
void poll(std::optional< unsigned int > timeout)
Definition
muxable-pipe.cc:9
nix::MuxablePipePollState::iterate
void iterate(std::set< CommChannel > &channels, fun< void(Descriptor fd, std::string_view data)> handleRead, fun< void(Descriptor fd)> handleEOF)
Definition
muxable-pipe.cc:18
windows-async-pipe.hh
libutil
include
nix
util
muxable-pipe.hh
Generated by
1.18.0