Nix
2.26.3
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 "
types.hh
"
5
#include "
file-descriptor.hh
"
6
7
#ifdef _WIN32
8
# include <winsock2.h>
9
#endif
10
#include <unistd.h>
11
12
namespace
nix {
13
17
AutoCloseFD
createUnixDomainSocket();
18
22
AutoCloseFD
createUnixDomainSocket(
const
Path
& path, mode_t mode);
23
29
using
Socket
=
30
#ifdef _WIN32
31
SOCKET
32
#else
33
int
34
#endif
35
;
36
37
#ifdef _WIN32
41
# define SHUT_WR SD_SEND
42
# define SHUT_RDWR SD_BOTH
43
#endif
44
50
static
inline
Socket
toSocket(
Descriptor
fd
)
51
{
52
#ifdef _WIN32
53
return
reinterpret_cast<
Socket
>
(
fd
);
54
#else
55
return
fd
;
56
#endif
57
}
58
64
static
inline
Descriptor fromSocket(Socket
fd
)
65
{
66
#ifdef _WIN32
67
return
reinterpret_cast<
Descriptor
>
(
fd
);
68
#else
69
return
fd
;
70
#endif
71
}
72
76
void
bind(
Socket
fd
,
const
std::string & path);
77
81
void
connect(
Socket
fd
,
const
std::string & path);
82
83
}
nix::AutoCloseFD
Definition
file-descriptor.hh:152
file-descriptor.hh
nix::Descriptor
int Descriptor
Definition
file-descriptor.hh:20
fd
return fd
Definition
lexer.l:2948
types.hh
nix::Path
std::string Path
Definition
types.hh:22
nix::Socket
int Socket
Definition
unix-domain-socket.hh:29
src
libutil
unix-domain-socket.hh
Generated by
1.13.2