Mercurial > minori
annotate dep/animone/src/fd.cc @ 296:b2a4358da16c
scripts/win32: CRLF -> LF
this breaks win32 build scripts
author | Paper <paper@paper.us.eu.org> |
---|---|
date | Mon, 13 May 2024 02:48:39 -0400 |
parents | 1a6a5d3a94cd |
children | 246017a7907a |
rev | line source |
---|---|
258 | 1 #include "animone/fd.h" |
2 | |
3 #ifdef WIN32 | |
4 # include "animone/fd/win32.h" | |
5 #endif | |
6 | |
7 #ifdef LINUX | |
8 # include "animone/fd/proc.h" | |
9 #endif | |
10 | |
11 #ifdef MACOSX | |
12 # include "animone/fd/xnu.h" | |
13 # include "animone/util/osx.h" | |
14 #endif | |
15 | |
266
1a6a5d3a94cd
dep/animone: make bsd.cc and x11.cc actually work
Paper <paper@paper.us.eu.org>
parents:
258
diff
changeset
|
16 #ifdef BSD |
1a6a5d3a94cd
dep/animone: make bsd.cc and x11.cc actually work
Paper <paper@paper.us.eu.org>
parents:
258
diff
changeset
|
17 # include "animone/fd/bsd.h" |
258 | 18 #endif |
19 | |
20 namespace animone::internal { | |
21 | |
22 bool EnumerateOpenFiles(const std::set<pid_t>& pids, open_file_proc_t open_file_proc) { | |
23 bool success = false; | |
24 | |
25 #ifdef WIN32 | |
26 success ^= win32::EnumerateOpenFiles(pids, open_file_proc); | |
27 #endif | |
28 | |
29 #ifdef LINUX | |
30 success ^= proc::EnumerateOpenFiles(pids, open_file_proc); | |
31 #endif | |
32 | |
33 #ifdef MACOSX | |
34 success ^= xnu::EnumerateOpenFiles(pids, open_file_proc); | |
35 #endif | |
36 | |
266
1a6a5d3a94cd
dep/animone: make bsd.cc and x11.cc actually work
Paper <paper@paper.us.eu.org>
parents:
258
diff
changeset
|
37 #ifdef BSD |
1a6a5d3a94cd
dep/animone: make bsd.cc and x11.cc actually work
Paper <paper@paper.us.eu.org>
parents:
258
diff
changeset
|
38 success ^= bsd::EnumerateOpenFiles(pids, open_file_proc); |
258 | 39 #endif |
40 | |
41 return success; | |
42 } | |
43 | |
44 bool EnumerateOpenProcesses(process_proc_t process_proc) { | |
45 bool success = false; | |
46 | |
47 #ifdef WIN32 | |
48 success ^= win32::EnumerateOpenProcesses(process_proc); | |
49 #endif | |
50 | |
51 #ifdef LINUX | |
52 success ^= proc::EnumerateOpenProcesses(process_proc); | |
53 #endif | |
54 | |
55 #ifdef MACOSX | |
56 success ^= xnu::EnumerateOpenProcesses(process_proc); | |
57 #endif | |
58 | |
266
1a6a5d3a94cd
dep/animone: make bsd.cc and x11.cc actually work
Paper <paper@paper.us.eu.org>
parents:
258
diff
changeset
|
59 #ifdef BSD |
1a6a5d3a94cd
dep/animone: make bsd.cc and x11.cc actually work
Paper <paper@paper.us.eu.org>
parents:
258
diff
changeset
|
60 success ^= bsd::EnumerateOpenProcesses(process_proc); |
258 | 61 #endif |
62 | |
63 return success; | |
64 } | |
65 | |
66 bool GetProcessName(pid_t pid, std::string& name) { | |
67 bool success = false; | |
68 | |
69 #ifdef WIN32 | |
70 success ^= win32::GetProcessName(pid, name); | |
71 #endif | |
72 | |
73 #ifdef LINUX | |
74 success ^= proc::GetProcessName(pid, name); | |
75 #endif | |
76 | |
77 #ifdef MACOSX | |
78 success ^= osx::util::GetProcessName(pid, name); | |
79 #endif | |
80 | |
266
1a6a5d3a94cd
dep/animone: make bsd.cc and x11.cc actually work
Paper <paper@paper.us.eu.org>
parents:
258
diff
changeset
|
81 #ifdef BSD |
1a6a5d3a94cd
dep/animone: make bsd.cc and x11.cc actually work
Paper <paper@paper.us.eu.org>
parents:
258
diff
changeset
|
82 success ^= bsd::GetProcessName(pid, name); |
258 | 83 #endif |
84 | |
85 return success; | |
86 } | |
87 | |
88 } // namespace animone::internal |