comparison dep/animone/src/fd/proc.cc @ 337:a7d4e5107531

dep/animone: REFACTOR ALL THE THINGS 1: animone now has its own syntax divergent from anisthesia, making different platforms actually have their own sections 2: process names in animone are now called `comm' (this will probably break things). this is what its called in bsd/linux so I'm just going to use it everywhere 3: the X11 code now checks for the existence of a UTF-8 window title and passes it if available 4: ANYTHING THATS NOT LINUX IS 100% UNTESTED AND CAN AND WILL BREAK! I still actually need to test the bsd code. to be honest I'm probably going to move all of the bsds into separate files because they're all essentially different operating systems at this point
author Paper <paper@paper.us.eu.org>
date Wed, 19 Jun 2024 12:51:15 -0400
parents a4257370de16
children f81bed4e04ac
comparison
equal deleted inserted replaced
336:d260549151d6 337:a7d4e5107531
93 bool EnumerateOpenProcesses(process_proc_t process_proc) { 93 bool EnumerateOpenProcesses(process_proc_t process_proc) {
94 bool success = false; 94 bool success = false;
95 95
96 for (const auto& dir : std::filesystem::directory_iterator{PROC_LOCATION}) { 96 for (const auto& dir : std::filesystem::directory_iterator{PROC_LOCATION}) {
97 Process proc; 97 Process proc;
98 proc.platform = ExecutablePlatform::Posix;
98 99
99 try { 100 try {
100 proc.pid = util::StringToInt(dir.path().stem()); 101 proc.pid = util::StringToInt(dir.path().stem());
101 success = true; 102 success = true;
102 } catch (std::invalid_argument const& ex) { 103 } catch (std::invalid_argument const& ex) {
103 continue; 104 continue;
104 } 105 }
105 106
106 if (!GetProcessName(proc.pid, proc.name)) 107 if (!GetProcessName(proc.pid, proc.comm))
107 continue; 108 continue;
108 109
109 if (!process_proc(proc)) 110 if (!process_proc(proc))
110 return false; 111 return false;
111 } 112 }