1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2024-09-20 23:28:26 -04:00
nix/src/libstore/lock.hh

38 lines
630 B
C++
Raw Normal View History

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