diff options
author | Tom Hubrecht <github@mail.hubrecht.ovh> | 2024-05-28 14:41:48 +0200 |
---|---|---|
committer | Tom Hubrecht <github@mail.hubrecht.ovh> | 2024-05-29 11:01:34 +0200 |
commit | 5b5a75979a0b954a5deefe79c8040bac1ad9c76a (patch) | |
tree | 13e4c9c53fe92827df4d0605dcc04b4689c0c4b1 /src/libutil/unix-domain-socket.hh | |
parent | e81ed5f12d0702ed402faa8b5ee725f2203db60c (diff) |
util.{hh,cc}: Split out unix-domain-socket.{hh,cc}
Change-Id: I3f9a628e0f8998b6146f5caa8ae9842361a66b8b
Diffstat (limited to 'src/libutil/unix-domain-socket.hh')
-rw-r--r-- | src/libutil/unix-domain-socket.hh | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/libutil/unix-domain-socket.hh b/src/libutil/unix-domain-socket.hh new file mode 100644 index 000000000..692ad2627 --- /dev/null +++ b/src/libutil/unix-domain-socket.hh @@ -0,0 +1,31 @@ +#pragma once +///@file + +#include "file-descriptor.hh" +#include "types.hh" + +#include <unistd.h> + +namespace nix { + +/** + * Create a Unix domain socket. + */ +AutoCloseFD createUnixDomainSocket(); + +/** + * Create a Unix domain socket in listen mode. + */ +AutoCloseFD createUnixDomainSocket(const Path & path, mode_t mode); + +/** + * Bind a Unix domain socket to a path. + */ +void bind(int fd, const std::string & path); + +/** + * Connect to a Unix domain socket. + */ +void connect(int fd, const std::string & path); + +} |