Nix 2.93.3
Lix: A modern, delicious implementation of the Nix package manager; unstable internal interfaces
Loading...
Searching...
No Matches
file-descriptor.hh File Reference

Go to the source code of this file.

Classes

class  nix::AutoCloseFD
class  nix::Pipe

Functions

std::string nix::readLine (int fd)
void nix::writeLine (int fd, std::string s)
std::string nix::readFile (int fd)
void nix::readFull (int fd, char *buf, size_t count)
void nix::writeFull (int fd, std::string_view s, bool allowInterrupts)
std::string nix::drainFD (int fd, bool block, const size_t reserveSize)
std::string nix::guessOrInventPathFromFD (int fd)
Generator< Bytes > nix::drainFDSource (int fd, bool block)
void nix::closeExtraFDs ()
void nix::closeOnExec (int fd)
 nix::MakeError (EndOfFile, Error)

Function Documentation

◆ closeExtraFDs()

void nix::closeExtraFDs ( )

Close all file descriptors except stdio fds (ie 0, 1, 2). Good practice in child processes.

◆ closeOnExec()

void nix::closeOnExec ( int fd)

Set the close-on-exec flag for the given file descriptor.

◆ drainFD()

std::string nix::drainFD ( int fd,
bool block = true,
const size_t reserveSize = 0 )

Read a file descriptor until EOF occurs.

◆ readFile()

std::string nix::readFile ( int fd)

Read the contents of a file into a string.

◆ readFull()

void nix::readFull ( int fd,
char * buf,
size_t count )

Wrappers arount read()/write() that read/write exactly the requested number of bytes.

◆ readLine()

std::string nix::readLine ( int fd)

Read a line from a file descriptor.

◆ writeLine()

void nix::writeLine ( int fd,
std::string s )

Write a line to a file descriptor.