clangd broke because it can't look through symlinks. compile_commands manipulation does not fix it, clangd configuration does not fix it, a vfs overlay does not fix it, and while a combination of those can fix it with a bind mount in place that's just too cursed to even consider clangd bug: https://github.com/llvm/llvm-project/issues/116877 Change-Id: I8e3e8489548eb3a7aa65ac9d12a5ec8abf814aec
45 lines
776 B
C++
45 lines
776 B
C++
#pragma once
|
|
///@file
|
|
|
|
#include <memory>
|
|
|
|
#include <sys/types.h>
|
|
#include <vector>
|
|
|
|
namespace nix {
|
|
|
|
struct UserLock
|
|
{
|
|
virtual ~UserLock() { }
|
|
|
|
/**
|
|
* Get the first and last UID.
|
|
*/
|
|
std::pair<uid_t, uid_t> getUIDRange()
|
|
{
|
|
auto first = getUID();
|
|
return {first, first + getUIDCount() - 1};
|
|
}
|
|
|
|
/**
|
|
* Get the first UID.
|
|
*/
|
|
virtual uid_t getUID() = 0;
|
|
|
|
virtual uid_t getUIDCount() = 0;
|
|
|
|
virtual gid_t getGID() = 0;
|
|
|
|
virtual std::vector<gid_t> getSupplementaryGIDs() = 0;
|
|
};
|
|
|
|
/**
|
|
* Acquire a user lock for a UID range of size `nrIds`. Note that this
|
|
* may return nullptr if no user is available.
|
|
*/
|
|
std::unique_ptr<UserLock> acquireUserLock(uid_t nrIds, bool useUserNamespace);
|
|
|
|
bool useBuildUsers();
|
|
|
|
}
|