aboutsummaryrefslogtreecommitdiff
#pragma once

#include "types.hh"


namespace nix {


/* 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. */
int openLockFile(const Path & path, bool create);

/* Delete an open lock file. */
void deleteLockFile(const Path & path, int fd);

enum LockType { ltRead, ltWrite, ltNone };

bool lockFile(int fd, LockType lockType, bool wait);


class PathLocks 
{
private:
    typedef std::pair<int, Path> FDPair;
    list<FDPair> fds;
    bool deletePaths;

public:
    PathLocks();
    PathLocks(const PathSet & paths,
        const string & waitMsg = "");
    bool lockPaths(const PathSet & _paths,
        const string & waitMsg = "",
        bool wait = true);
    ~PathLocks();
    void unlock();
    void setDeletion(bool deletePaths);
};


bool pathIsLockedByMe(const Path & path);


}
l. Add mariadb:dev. Efraim Flashner 2023-02-17gnu: Add chathistorysync....* gnu/packages/irc.scm (chathistorysync): New variable. Co-authored-by: ( <paren@disroot.org> Signed-off-by: Christopher Baines <mail@cbaines.net> jgart 2023-02-17gnu: Add go-gopkg-in-irc-v3....* gnu/packages/irc.scm (go-gopkg-in-irc-v3): New variable. Co-authored-by: ( <paren@disroot.org> Signed-off-by: Christopher Baines <mail@cbaines.net> jgart 2023-01-12gnu: kirc: Update to 0.3.2....* gnu/packages/irc.scm (kirc): Update to 0.3.2. Signed-off-by: 宋文武 <iyzsong@member.fsf.org> jgart 2023-01-12gnu: litterbox: Update to 1.9....* gnu/packages/irc.scm (litterbox): Update to 1.9. Signed-off-by: 宋文武 <iyzsong@member.fsf.org> jgart 2023-01-12gnu: catgirl: Update to 2.1....* gnu/packages/irc.scm (catgirl): Update to 2.1. Signed-off-by: 宋文武 <iyzsong@member.fsf.org> jgart 2023-01-12gnu: weechat: Update to 3.8....* gnu/packages/irc.scm (weechat): Update to 3.8. [arguments]: Do not build tests any more: since version 3.8, ‘make test’ is successful when tests are not built. [native-inputs]: Remove dependency on cpputest as tests are not built any more. Signed-off-by: 宋文武 <iyzsong@member.fsf.org> Sébastien Helleu 2022-12-11gnu: ii: Use G-expressions....* gnu/packages/irc.scm (ii)[arguments]: Rewrite as G-expressions. Tobias Geerinckx-Rice 2022-12-11gnu: ii: Update to 2.0....* gnu/packages/irc.scm (ii): Update to 2.0. Tobias Geerinckx-Rice