lix/src/libstore/lock.hh

38 lines
620 B
C++
Raw Normal View History

2020-10-11 16:34:36 +00:00
#pragma once
2020-10-11 16:34:36 +00:00
#include "sync.hh"
#include "types.hh"
#include "util.hh"
namespace nix {
class UserLock
{
private:
Path fnUserLock;
AutoCloseFD fdUserLock;
2020-05-18 13:50:29 +00:00
bool isEnabled = false;
string user;
2020-05-18 13:50:29 +00:00
uid_t uid = 0;
gid_t gid = 0;
std::vector<gid_t> supplementaryGIDs;
2012-07-27 13:59:18 +00:00
public:
2017-01-25 11:45:38 +00:00
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; }
2012-07-27 13:59:18 +00:00
};
}