comparison dep/animia/src/fd/xnu.cc @ 202:71832ffe425a

animia: re-add kvm fd source this is all being merged from my wildly out-of-date laptop. SORRY! in other news, I edited the CI file to install the wayland client as well, so the linux CI build might finally get wayland stuff.
author Paper <paper@paper.us.eu.org>
date Tue, 02 Jan 2024 06:05:06 -0500
parents bc1ae1810855
children 2f5a9247e501
comparison
equal deleted inserted replaced
201:8f6f8dd2eb23 202:71832ffe425a
14 #include <sys/types.h> 14 #include <sys/types.h>
15 #include <sys/user.h> 15 #include <sys/user.h>
16 16
17 namespace animia::internal::xnu { 17 namespace animia::internal::xnu {
18 18
19 bool XnuFdTools::EnumerateOpenProcesses(process_proc_t process_proc) { 19 bool EnumerateOpenProcesses(process_proc_t process_proc) {
20 size_t pids_size = 512; 20 size_t pids_size = 512;
21 std::unique_ptr<pid_t[]> pids; 21 std::unique_ptr<pid_t[]> pids;
22 22
23 int returned_size = 0; 23 int returned_size = 0;
24 do { 24 do {
36 } 36 }
37 37
38 return true; 38 return true;
39 } 39 }
40 40
41 bool XnuFdTools::EnumerateOpenFiles(const std::set<pid_t>& pids, open_file_proc_t open_file_proc) { 41 bool EnumerateOpenFiles(const std::set<pid_t>& pids, open_file_proc_t open_file_proc) {
42 if (!open_file_proc) 42 if (!open_file_proc)
43 return false; 43 return false;
44 44
45 for (const auto& pid : pids) { 45 for (const auto& pid : pids) {
46 int bufsz = proc_pidinfo(pid, PROC_PIDLISTFDS, 0, NULL, 0); 46 int bufsz = proc_pidinfo(pid, PROC_PIDLISTFDS, 0, NULL, 0);