10#include "llvm/Support/ManagedStatic.h"
21 std::lock_guard<std::mutex> guard(
m_mutex);
22 auto iter_bool = cache.try_emplace(
id, std::nullopt);
24 iter_bool.first->second = (this->*do_get)(
id);
25 if (iter_bool.first->second)
26 return llvm::StringRef(*iter_bool.first->second);
33 std::optional<std::string> DoGetUserName(id_t uid)
override {
37 std::optional<std::string> DoGetGroupName(id_t gid)
override {
static llvm::ManagedStatic< NoopResolver > g_noop_resolver
An abstract interface for things that know how to map numeric user/group IDs into names.
virtual ~UserIDResolver()
static UserIDResolver & GetNoopResolver()
Returns a resolver which returns a failure value for each query.
llvm::DenseMap< id_t, std::optional< std::string > > Map
std::optional< llvm::StringRef > Get(id_t id, Map &cache, std::optional< std::string >(UserIDResolver::*do_get)(id_t))
A class that represents a running process on the host machine.