aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/pathlocks.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstore/pathlocks.hh')
-rw-r--r--src/libstore/pathlocks.hh10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/libstore/pathlocks.hh b/src/libstore/pathlocks.hh
index 2fd0e0d1e..911fe4579 100644
--- a/src/libstore/pathlocks.hh
+++ b/src/libstore/pathlocks.hh
@@ -4,6 +4,16 @@
#include "util.hh"
+/* 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. Both must be called to be fully portable
+ between Unix and Windows. */
+void deleteLockFilePreClose(const Path & path, int fd);
+void deleteLockFilePostClose(const Path & path);
+
typedef enum LockType { ltRead, ltWrite, ltNone };
bool lockFile(int fd, LockType lockType, bool wait);