nix-super/src/libutil/unix-domain-socket.hh
John Ericson ac89bb064a Split up util.{hh,cc}
All OS and IO operations should be moved out, leaving only some misc
portable pure functions.

This is useful to avoid copious CPP when doing things like Windows and
Emscripten ports.

Newly exposed functions to break cycles:

 - `restoreSignals`
 - `updateWindowSize`
2023-11-05 12:20:02 -05:00

31 lines
504 B
C++

#pragma once
///@file
#include "types.hh"
#include "file-descriptor.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);
}