#include "base/linux_util.h"
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <iomanip>
#include <memory>
#include <string_view>
#include "base/base_export.h"
#include "base/files/dir_reader_posix.h"
#include "base/files/file_util.h"
#include "base/files/scoped_file.h"
#include "base/strings/safe_sprintf.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
#include "base/strings/string_tokenizer.h"
#include "base/strings/string_util.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
namespace base {
namespace {
#if !BUILDFLAG(IS_CHROMEOS_ASH)
std::string GetKeyValueFromOSReleaseFile(const std::string& input,
const char* key) { … }
bool ReadDistroFromOSReleaseFile(const char* file) { … }
class DistroNameGetter { … };
#endif
bool GetThreadsFromProcessDir(const char* dir_path, std::vector<pid_t>* tids) { … }
constexpr int kDistroSize = …;
}
char g_linux_distro[kDistroSize] = …"CrOS";
#elif BUILDFLAG(IS_ANDROID)
"Android";
#else
"Unknown";
#endif
BASE_EXPORT std::string GetKeyValueFromOSReleaseFileForTesting(
const std::string& input,
const char* key) { … }
std::string GetLinuxDistro() { … }
void SetLinuxDistro(const std::string& distro) { … }
bool GetThreadsForProcess(pid_t pid, std::vector<pid_t>* tids) { … }
bool GetThreadsForCurrentProcess(std::vector<pid_t>* tids) { … }
pid_t FindThreadIDWithSyscall(pid_t pid, const std::string& expected_data,
bool* syscall_supported) { … }
pid_t FindThreadID(pid_t pid, pid_t ns_tid, bool* ns_pid_supported) { … }
}