Nix 2.36.0
Nix, the purely functional package manager; unstable internal interfaces
Loading...
Searching...
No Matches
pathlocks.hh File Reference
#include <filesystem>
#include "nix/util/file-descriptor.hh"

Go to the source code of this file.

Classes

class  nix::PathLocks
struct  nix::FdLock

Enumerations

enum  LockType { ltRead , ltWrite , ltNone }

Functions

AutoCloseFD nix::openLockFile (const std::filesystem::path &path, bool create)
void nix::deleteLockFile (const std::filesystem::path &path, Descriptor desc)
bool nix::lockFile (Descriptor desc, LockType lockType, bool wait)

Function Documentation

◆ deleteLockFile()

void nix::deleteLockFile ( const std::filesystem::path & path,
Descriptor desc )

Delete an open lock file.

◆ openLockFile()

AutoCloseFD nix::openLockFile ( const std::filesystem::path & path,
bool create )

Open (possibly create) a lock file and return the file descriptor. -1 is returned if create is false and the lock could not be opened because it doesn't exist. Any other error throws an exception.