LLDB mainline
|
An abstract interface for things that know how to map numeric user/group IDs into names. More...
#include <UserIDResolver.h>
Public Types | |
typedef uint32_t | id_t |
Public Member Functions | |
virtual | ~UserIDResolver () |
std::optional< llvm::StringRef > | GetUserName (id_t uid) |
std::optional< llvm::StringRef > | GetGroupName (id_t gid) |
Static Public Member Functions | |
static UserIDResolver & | GetNoopResolver () |
Returns a resolver which returns a failure value for each query. | |
Protected Member Functions | |
virtual std::optional< std::string > | DoGetUserName (id_t uid)=0 |
virtual std::optional< std::string > | DoGetGroupName (id_t gid)=0 |
Private Types | |
using | Map = llvm::DenseMap< id_t, std::optional< std::string > > |
Private Member Functions | |
std::optional< llvm::StringRef > | Get (id_t id, Map &cache, std::optional< std::string >(UserIDResolver::*do_get)(id_t)) |
Private Attributes | |
std::mutex | m_mutex |
Map | m_uid_cache |
Map | m_gid_cache |
An abstract interface for things that know how to map numeric user/group IDs into names.
It caches the resolved names to avoid repeating expensive queries. The cache is internally protected by a mutex, so concurrent queries are safe.
Definition at line 23 of file UserIDResolver.h.
typedef uint32_t lldb_private::UserIDResolver::id_t |
Definition at line 25 of file UserIDResolver.h.
|
private |
Definition at line 44 of file UserIDResolver.h.
|
virtualdefault |
|
protectedpure virtual |
Implemented in lldb_private::platform_gdb_server::PlatformRemoteGDBServer.
Referenced by GetGroupName().
|
protectedpure virtual |
Implemented in lldb_private::platform_gdb_server::PlatformRemoteGDBServer.
Referenced by GetUserName().
|
private |
Definition at line 17 of file UserIDResolver.cpp.
References m_mutex.
Referenced by GetGroupName(), and GetUserName().
|
inline |
Definition at line 31 of file UserIDResolver.h.
References DoGetGroupName(), Get(), and m_gid_cache.
Referenced by lldb_private::ProcessInstanceInfo::Dump(), and lldb_private::ProcessInstanceInfo::DumpAsTableRow().
|
static |
Returns a resolver which returns a failure value for each query.
Useful as a fallback value for the case when we know all lookups will fail.
Definition at line 45 of file UserIDResolver.cpp.
References g_noop_resolver.
Referenced by lldb_private::Platform::GetUserIDResolver().
|
inline |
Definition at line 28 of file UserIDResolver.h.
References DoGetUserName(), Get(), and m_uid_cache.
Referenced by lldb_private::ProcessInstanceInfo::Dump(), and lldb_private::ProcessInstanceInfo::DumpAsTableRow().
|
private |
Definition at line 52 of file UserIDResolver.h.
Referenced by GetGroupName().
|
private |
Definition at line 50 of file UserIDResolver.h.
Referenced by Get().
|
private |
Definition at line 51 of file UserIDResolver.h.
Referenced by GetUserName().