comparison dep/animia/src/fd/bsd.cc @ 146:d8a61e7e2a36

dep/animia: move fd stuff to a new fd.cc, don't force the user to include windows.h
author Paper <mrpapersonic@gmail.com>
date Mon, 13 Nov 2023 13:52:58 -0500
parents e6668085e24d
children aa4df5a84338
comparison
equal deleted inserted replaced
145:8e9b71970bda 146:d8a61e7e2a36
23 23
24 namespace animia::internal::unix { 24 namespace animia::internal::unix {
25 25
26 /* this is a cleaned up version of a function from... Apple? 26 /* this is a cleaned up version of a function from... Apple?
27 ...anyway, what it essentially does is gets the size and stuff from 27 ...anyway, what it essentially does is gets the size and stuff from
28 sysctl() and reserves the space in a vector to store the PIDs */ 28 sysctl() and reserves the space in a vector to store the PIDs
29
30 TODO: https://kaashif.co.uk/2015/06/18/how-to-get-a-list-of-processes-on-openbsd-in-c/ */
29 bool UnixFdTools::GetAllPids(std::set<pid_t>& pids) { 31 bool UnixFdTools::GetAllPids(std::set<pid_t>& pids) {
30 struct kinfo_proc* result = NULL; 32 struct kinfo_proc* result = NULL;
31 size_t length = 0; 33 size_t length = 0;
32 static const int name[] = {CTL_KERN, KERN_PROC, KERN_PROC_ALL, 0}; 34 static const int name[] = {CTL_KERN, KERN_PROC, KERN_PROC_ALL, 0};
33 35