nix-super/src/libstore/lock.hh

38 lines
630 B
C++
Raw Normal View History

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