diff dep/animia/src/fd/linux.cc @ 150:ffa535b6d630

*: avoid usage of std::[pair,tuple] https://arne-mertz.de/2017/03/smelly-pair-tuple/ it's better to use real structures and such where variables are easily known... also apparently using [] on structs is actually valid? I had no idea.
author Paper <mrpapersonic@gmail.com>
date Tue, 14 Nov 2023 16:27:33 -0500
parents aa4df5a84338
children 54744a48a7d7
line wrap: on
line diff
--- a/dep/animia/src/fd/linux.cc	Tue Nov 14 13:40:11 2023 -0500
+++ b/dep/animia/src/fd/linux.cc	Tue Nov 14 16:27:33 2023 -0500
@@ -124,7 +124,7 @@
 	return true;
 }
 
-bool LinuxFdTools::EnumerateOpenFiles(const std::set<pid_t>& pids, std::vector<std::pair<pid_t, std::string>>& files) {
+bool LinuxFdTools::EnumerateOpenFiles(const std::set<pid_t>& pids, std::vector<OpenFile>& files) {
 	for (const auto& pid : pids) {
 		const std::string path = PROC_LOCATION "/" + std::to_string(pid) + "/fd";
 
@@ -137,7 +137,11 @@
 			if (!IsRegularFile(name))
 				continue;
 
-			files.push_back({pid, name});
+			OpenFile file;
+			file.pid = pid;
+			file.path = name;
+
+			files.push_back(file);
 		}
 	}
 	return true;