annotate dep/animia/src/fd.cc @ 238:d2b7e974221e

CI/linux: install glib
author Paper <paper@paper.us.eu.org>
date Fri, 19 Jan 2024 11:17:42 -0500
parents 71832ffe425a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
146
d8a61e7e2a36 dep/animia: move fd stuff to a new fd.cc, don't force the user
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
1 #include "animia/fd.h"
d8a61e7e2a36 dep/animia: move fd stuff to a new fd.cc, don't force the user
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
2
152
8700806c2cc2 dep/animia: awesome new breaking changes!
Paper <mrpapersonic@gmail.com>
parents: 150
diff changeset
3 #ifdef WIN32
146
d8a61e7e2a36 dep/animia: move fd stuff to a new fd.cc, don't force the user
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
4 # include "animia/fd/win32.h"
198
bc1ae1810855 dep/animia: switch from using classes to global functions
Paper <mrpapersonic@gmail.com>
parents: 166
diff changeset
5 #endif
bc1ae1810855 dep/animia: switch from using classes to global functions
Paper <mrpapersonic@gmail.com>
parents: 166
diff changeset
6
bc1ae1810855 dep/animia: switch from using classes to global functions
Paper <mrpapersonic@gmail.com>
parents: 166
diff changeset
7 #ifdef LINUX
166
54c5d80a737e dep/animia: add libutil method
paper@DavesDouble.local
parents: 156
diff changeset
8 # include "animia/fd/proc.h"
198
bc1ae1810855 dep/animia: switch from using classes to global functions
Paper <mrpapersonic@gmail.com>
parents: 166
diff changeset
9 #endif
bc1ae1810855 dep/animia: switch from using classes to global functions
Paper <mrpapersonic@gmail.com>
parents: 166
diff changeset
10
bc1ae1810855 dep/animia: switch from using classes to global functions
Paper <mrpapersonic@gmail.com>
parents: 166
diff changeset
11 #ifdef MACOSX
153
bd439dd6ffc5 *: make win stuff actually work, rename bsd.cc to xnu.cc
Paper <mrpapersonic@gmail.com>
parents: 152
diff changeset
12 # include "animia/fd/xnu.h"
198
bc1ae1810855 dep/animia: switch from using classes to global functions
Paper <mrpapersonic@gmail.com>
parents: 166
diff changeset
13 #endif
bc1ae1810855 dep/animia: switch from using classes to global functions
Paper <mrpapersonic@gmail.com>
parents: 166
diff changeset
14
bc1ae1810855 dep/animia: switch from using classes to global functions
Paper <mrpapersonic@gmail.com>
parents: 166
diff changeset
15 #ifdef LIBUTIL
bc1ae1810855 dep/animia: switch from using classes to global functions
Paper <mrpapersonic@gmail.com>
parents: 166
diff changeset
16 # include "animia/fd/libutil.h"
146
d8a61e7e2a36 dep/animia: move fd stuff to a new fd.cc, don't force the user
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
17 #endif
d8a61e7e2a36 dep/animia: move fd stuff to a new fd.cc, don't force the user
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
18
202
71832ffe425a animia: re-add kvm fd source
Paper <paper@paper.us.eu.org>
parents: 201 198
diff changeset
19 #ifdef LIBKVM
71832ffe425a animia: re-add kvm fd source
Paper <paper@paper.us.eu.org>
parents: 201 198
diff changeset
20 # include "animia/fd/kvm.h"
146
d8a61e7e2a36 dep/animia: move fd stuff to a new fd.cc, don't force the user
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
21 #endif
d8a61e7e2a36 dep/animia: move fd stuff to a new fd.cc, don't force the user
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
22
d8a61e7e2a36 dep/animia: move fd stuff to a new fd.cc, don't force the user
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
23 namespace animia::internal {
d8a61e7e2a36 dep/animia: move fd stuff to a new fd.cc, don't force the user
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
24
198
bc1ae1810855 dep/animia: switch from using classes to global functions
Paper <mrpapersonic@gmail.com>
parents: 166
diff changeset
25 bool EnumerateOpenFiles(const std::set<pid_t>& pids, open_file_proc_t open_file_proc) {
bc1ae1810855 dep/animia: switch from using classes to global functions
Paper <mrpapersonic@gmail.com>
parents: 166
diff changeset
26 bool success = false;
bc1ae1810855 dep/animia: switch from using classes to global functions
Paper <mrpapersonic@gmail.com>
parents: 166
diff changeset
27
152
8700806c2cc2 dep/animia: awesome new breaking changes!
Paper <mrpapersonic@gmail.com>
parents: 150
diff changeset
28 #ifdef WIN32
198
bc1ae1810855 dep/animia: switch from using classes to global functions
Paper <mrpapersonic@gmail.com>
parents: 166
diff changeset
29 success ^= win32::EnumerateOpenFiles(pids, open_file_proc);
bc1ae1810855 dep/animia: switch from using classes to global functions
Paper <mrpapersonic@gmail.com>
parents: 166
diff changeset
30 #endif
bc1ae1810855 dep/animia: switch from using classes to global functions
Paper <mrpapersonic@gmail.com>
parents: 166
diff changeset
31
bc1ae1810855 dep/animia: switch from using classes to global functions
Paper <mrpapersonic@gmail.com>
parents: 166
diff changeset
32 #ifdef LINUX
bc1ae1810855 dep/animia: switch from using classes to global functions
Paper <mrpapersonic@gmail.com>
parents: 166
diff changeset
33 success ^= proc::EnumerateOpenFiles(pids, open_file_proc);
bc1ae1810855 dep/animia: switch from using classes to global functions
Paper <mrpapersonic@gmail.com>
parents: 166
diff changeset
34 #endif
bc1ae1810855 dep/animia: switch from using classes to global functions
Paper <mrpapersonic@gmail.com>
parents: 166
diff changeset
35
bc1ae1810855 dep/animia: switch from using classes to global functions
Paper <mrpapersonic@gmail.com>
parents: 166
diff changeset
36 #ifdef MACOSX
bc1ae1810855 dep/animia: switch from using classes to global functions
Paper <mrpapersonic@gmail.com>
parents: 166
diff changeset
37 success ^= xnu::EnumerateOpenFiles(pids, open_file_proc);
bc1ae1810855 dep/animia: switch from using classes to global functions
Paper <mrpapersonic@gmail.com>
parents: 166
diff changeset
38 #endif
bc1ae1810855 dep/animia: switch from using classes to global functions
Paper <mrpapersonic@gmail.com>
parents: 166
diff changeset
39
bc1ae1810855 dep/animia: switch from using classes to global functions
Paper <mrpapersonic@gmail.com>
parents: 166
diff changeset
40 #ifdef LIBUTIL
bc1ae1810855 dep/animia: switch from using classes to global functions
Paper <mrpapersonic@gmail.com>
parents: 166
diff changeset
41 success ^= libutil::EnumerateOpenFiles(pids, open_file_proc);
146
d8a61e7e2a36 dep/animia: move fd stuff to a new fd.cc, don't force the user
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
42 #endif
d8a61e7e2a36 dep/animia: move fd stuff to a new fd.cc, don't force the user
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
43
202
71832ffe425a animia: re-add kvm fd source
Paper <paper@paper.us.eu.org>
parents: 201 198
diff changeset
44 #ifdef LIBKVM
71832ffe425a animia: re-add kvm fd source
Paper <paper@paper.us.eu.org>
parents: 201 198
diff changeset
45 success ^= kvm::EnumerateOpenFiles(pids, open_file_proc);
146
d8a61e7e2a36 dep/animia: move fd stuff to a new fd.cc, don't force the user
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
46 #endif
d8a61e7e2a36 dep/animia: move fd stuff to a new fd.cc, don't force the user
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
47
198
bc1ae1810855 dep/animia: switch from using classes to global functions
Paper <mrpapersonic@gmail.com>
parents: 166
diff changeset
48 return success;
bc1ae1810855 dep/animia: switch from using classes to global functions
Paper <mrpapersonic@gmail.com>
parents: 166
diff changeset
49 }
bc1ae1810855 dep/animia: switch from using classes to global functions
Paper <mrpapersonic@gmail.com>
parents: 166
diff changeset
50
bc1ae1810855 dep/animia: switch from using classes to global functions
Paper <mrpapersonic@gmail.com>
parents: 166
diff changeset
51 bool EnumerateOpenProcesses(process_proc_t process_proc) {
bc1ae1810855 dep/animia: switch from using classes to global functions
Paper <mrpapersonic@gmail.com>
parents: 166
diff changeset
52 bool success = false;
bc1ae1810855 dep/animia: switch from using classes to global functions
Paper <mrpapersonic@gmail.com>
parents: 166
diff changeset
53
bc1ae1810855 dep/animia: switch from using classes to global functions
Paper <mrpapersonic@gmail.com>
parents: 166
diff changeset
54 #ifdef WIN32
bc1ae1810855 dep/animia: switch from using classes to global functions
Paper <mrpapersonic@gmail.com>
parents: 166
diff changeset
55 success ^= win32::EnumerateOpenProcesses(process_proc);
bc1ae1810855 dep/animia: switch from using classes to global functions
Paper <mrpapersonic@gmail.com>
parents: 166
diff changeset
56 #endif
bc1ae1810855 dep/animia: switch from using classes to global functions
Paper <mrpapersonic@gmail.com>
parents: 166
diff changeset
57
bc1ae1810855 dep/animia: switch from using classes to global functions
Paper <mrpapersonic@gmail.com>
parents: 166
diff changeset
58 #ifdef LINUX
bc1ae1810855 dep/animia: switch from using classes to global functions
Paper <mrpapersonic@gmail.com>
parents: 166
diff changeset
59 success ^= proc::EnumerateOpenProcesses(process_proc);
bc1ae1810855 dep/animia: switch from using classes to global functions
Paper <mrpapersonic@gmail.com>
parents: 166
diff changeset
60 #endif
bc1ae1810855 dep/animia: switch from using classes to global functions
Paper <mrpapersonic@gmail.com>
parents: 166
diff changeset
61
bc1ae1810855 dep/animia: switch from using classes to global functions
Paper <mrpapersonic@gmail.com>
parents: 166
diff changeset
62 #ifdef MACOSX
bc1ae1810855 dep/animia: switch from using classes to global functions
Paper <mrpapersonic@gmail.com>
parents: 166
diff changeset
63 success ^= xnu::EnumerateOpenProcesses(process_proc);
bc1ae1810855 dep/animia: switch from using classes to global functions
Paper <mrpapersonic@gmail.com>
parents: 166
diff changeset
64 #endif
bc1ae1810855 dep/animia: switch from using classes to global functions
Paper <mrpapersonic@gmail.com>
parents: 166
diff changeset
65
bc1ae1810855 dep/animia: switch from using classes to global functions
Paper <mrpapersonic@gmail.com>
parents: 166
diff changeset
66 #ifdef LIBUTIL
bc1ae1810855 dep/animia: switch from using classes to global functions
Paper <mrpapersonic@gmail.com>
parents: 166
diff changeset
67 success ^= libutil::EnumerateOpenProcesses(process_proc);
bc1ae1810855 dep/animia: switch from using classes to global functions
Paper <mrpapersonic@gmail.com>
parents: 166
diff changeset
68 #endif
bc1ae1810855 dep/animia: switch from using classes to global functions
Paper <mrpapersonic@gmail.com>
parents: 166
diff changeset
69
202
71832ffe425a animia: re-add kvm fd source
Paper <paper@paper.us.eu.org>
parents: 201 198
diff changeset
70 #ifdef LIBKVM
71832ffe425a animia: re-add kvm fd source
Paper <paper@paper.us.eu.org>
parents: 201 198
diff changeset
71 success ^= kvm::EnumerateOpenProcesses(process_proc);
71832ffe425a animia: re-add kvm fd source
Paper <paper@paper.us.eu.org>
parents: 201 198
diff changeset
72 #endif
71832ffe425a animia: re-add kvm fd source
Paper <paper@paper.us.eu.org>
parents: 201 198
diff changeset
73
198
bc1ae1810855 dep/animia: switch from using classes to global functions
Paper <mrpapersonic@gmail.com>
parents: 166
diff changeset
74 return success;
bc1ae1810855 dep/animia: switch from using classes to global functions
Paper <mrpapersonic@gmail.com>
parents: 166
diff changeset
75 }
146
d8a61e7e2a36 dep/animia: move fd stuff to a new fd.cc, don't force the user
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
76
156
cdf79282d647 dep/animia: add VERY early x11 window stuff
Paper <mrpapersonic@gmail.com>
parents: 153
diff changeset
77 } // namespace animia::internal