#include "lldb/Host/posix/HostInfoPosix.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/UserIDResolver.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/Twine.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/raw_ostream.h"
#include <climits>
#include <cstdlib>
#include <grp.h>
#include <mutex>
#include <optional>
#include <pwd.h>
#include <sys/types.h>
#include <sys/utsname.h>
#include <unistd.h>
usingnamespacelldb_private;
size_t HostInfoPosix::GetPageSize() { … }
bool HostInfoPosix::GetHostname(std::string &s) { … }
std::optional<std::string> HostInfoPosix::GetOSKernelDescription() { … }
#ifdef __ANDROID__
#include <android/api-level.h>
#endif
#if defined(__ANDROID_API__) && __ANDROID_API__ < 21
#define USE_GETPWUID
#endif
namespace {
class PosixUserIDResolver : public UserIDResolver { … };
}
struct PasswdEntry { … };
static std::optional<PasswdEntry> GetPassword(id_t uid) { … }
std::optional<std::string> PosixUserIDResolver::DoGetUserName(id_t uid) { … }
std::optional<std::string> PosixUserIDResolver::DoGetGroupName(id_t gid) { … }
static llvm::ManagedStatic<PosixUserIDResolver> g_user_id_resolver;
UserIDResolver &HostInfoPosix::GetUserIDResolver() { … }
uint32_t HostInfoPosix::GetUserID() { … }
uint32_t HostInfoPosix::GetGroupID() { … }
uint32_t HostInfoPosix::GetEffectiveUserID() { … }
uint32_t HostInfoPosix::GetEffectiveGroupID() { … }
FileSpec HostInfoPosix::GetDefaultShell() { … }
bool HostInfoPosix::ComputeSupportExeDirectory(FileSpec &file_spec) { … }
bool HostInfoPosix::ComputeHeaderDirectory(FileSpec &file_spec) { … }
bool HostInfoPosix::GetEnvironmentVar(const std::string &var_name,
std::string &var) { … }