Mercurial > minori
diff dep/animia/src/fd/linux.cc @ 139:478f3b366199
dep/animia: separate lots of things, use base class for OS stuff
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Sun, 12 Nov 2023 16:43:07 -0500 |
parents | 28842a8d0c6b |
children | 1e696863b54c |
line wrap: on
line diff
--- a/dep/animia/src/fd/linux.cc Sun Nov 12 04:53:19 2023 -0500 +++ b/dep/animia/src/fd/linux.cc Sun Nov 12 16:43:07 2023 -0500 @@ -91,7 +91,7 @@ return ret.c_str(); } -bool GetAllPids(std::set<pid_t>& pids) { +bool LinuxFdTools::GetAllPids(std::set<pid_t>& pids) { for (const auto& dir : get_all_files_in_dir(PROC_LOCATION)) { pid_t pid; try { @@ -103,14 +103,14 @@ } } -bool GetProcessName(pid_t pid, std::string& result) { +bool LinuxFdTools::GetProcessName(pid_t pid, std::string& result) { const std::string path = PROC_LOCATION "/" + std::to_string(pid) + "/comm"; std::string result = util::ReadFile(path); result.erase(std::remove(result.begin(), result.end(), '\n'), result.end()); } -bool EnumerateOpenFiles(const std::set<pid_t>& pids, std::vector<std::tuple<pid_t, std::string>>& files) { +bool LinuxFdTools::EnumerateOpenFiles(const std::set<pid_t>& pids, std::vector<std::tuple<pid_t, std::string>>& files) { for (const auto& pid : pids) { const std::string path = PROC_LOCATION "/" + std::to_string(pid) + "/fd";