Mercurial > minori
diff dep/animia/src/fd/xnu.cc @ 154:d43d68408d3c
dep/animia: fix XnuFdTools
also we use anitomy directly now.
HG Enter commit message. Lines beginning with 'HG:' are removed.
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Wed, 15 Nov 2023 14:14:17 -0500 |
parents | bd439dd6ffc5 |
children | d2bbb5773616 |
line wrap: on
line diff
--- a/dep/animia/src/fd/xnu.cc Wed Nov 15 13:28:18 2023 -0500 +++ b/dep/animia/src/fd/xnu.cc Wed Nov 15 14:14:17 2023 -0500 @@ -8,6 +8,7 @@ #include <unordered_map> #include <vector> #include <string> +#include <cassert> #include <fcntl.h> #include <sys/sysctl.h> @@ -17,17 +18,16 @@ namespace animia::internal::xnu { -static bool GetProcessName(pid_t pid, std::string& result) { +static std::string GetProcessName(pid_t pid) { struct proc_bsdinfo proc; int st = proc_pidinfo(pid, PROC_PIDTBSDINFO, 0, &proc, PROC_PIDTBSDINFO_SIZE); if (st != PROC_PIDTBSDINFO_SIZE) - return false; + return ""; /* fixme: is this right? pbi_comm is an alternative, but it reduces the string size to 16 chars. does pbi_name do the same, or is it different? */ - result = proc.pbi_name; - return true; + return proc.pbi_name; } /* this is a cleaned up version of a function from... Apple? @@ -60,6 +60,8 @@ if (!process_proc({pid, GetProcessName(pid)})) return false; } + + return true; } bool XnuFdTools::EnumerateOpenFiles(const std::set<pid_t>& pids, open_file_proc_t open_file_proc) { @@ -95,6 +97,7 @@ } } } + return true; }