aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/lock.hh
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2020-12-20 14:02:12 +0000
committerJohn Ericson <John.Ericson@Obsidian.Systems>2020-12-20 14:02:12 +0000
commitbd96403da6a1181e46a52be7befade0c00f9e743 (patch)
tree0f66b119acd03c11e2cad776087889b7827261dc /src/libstore/lock.hh
parentbdc772022766e65fa8ea6d29fff0735529ab47f3 (diff)
parentec3e20283216374c15843c403363a890221d3fcb (diff)
Merge remote-tracking branch 'upstream/master' into trustless-remote-builder-simple
Diffstat (limited to 'src/libstore/lock.hh')
-rw-r--r--src/libstore/lock.hh37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/libstore/lock.hh b/src/libstore/lock.hh
new file mode 100644
index 000000000..8fbb67ddc
--- /dev/null
+++ b/src/libstore/lock.hh
@@ -0,0 +1,37 @@
+#pragma once
+
+#include "sync.hh"
+#include "types.hh"
+#include "util.hh"
+
+namespace nix {
+
+class UserLock
+{
+private:
+ Path fnUserLock;
+ AutoCloseFD fdUserLock;
+
+ bool isEnabled = false;
+ string user;
+ uid_t uid = 0;
+ gid_t gid = 0;
+ std::vector<gid_t> supplementaryGIDs;
+
+public:
+ UserLock();
+
+ void kill();
+
+ string getUser() { return user; }
+ uid_t getUID() { assert(uid); return uid; }
+ uid_t getGID() { assert(gid); return gid; }
+ std::vector<gid_t> getSupplementaryGIDs() { return supplementaryGIDs; }
+
+ bool findFreeUser();
+
+ bool enabled() { return isEnabled; }
+
+};
+
+}