43 struct timespec run_time;
44 struct timespec idle_time;
49 char tcomm[kCOMMLengthMax + 1];
68 uint64_t it_real_value;
96 static int OpenFd(
const char *what,
int mode = O_RDONLY);
97 static int OpenFd(pid_t pid,
const char *what,
int mode = O_RDONLY);
98 static int OpenFd(pid_t pid, pid_t tid,
const char *what,
101 static FILE *OpenFILE(
char const *what,
char const *mode =
"r");
102 static FILE *OpenFILE(pid_t pid,
char const *what,
char const *mode =
"r");
103 static FILE *OpenFILE(pid_t pid, pid_t tid,
const char *what,
104 char const *mode =
"r");
106 static DIR *OpenDIR(
const char *what);
107 static DIR *OpenDIR(pid_t pid,
const char *what);
108 static DIR *OpenDIR(pid_t pid, pid_t tid,
const char *what);
110 static bool ReadLink(pid_t pid,
char const *what,
char *buf,
size_t bufsiz);
111 static bool ReadLink(pid_t pid, pid_t tid,
char const *what,
char *buf,
116 ParseKeyValue(FILE *fp,
size_t maxsize,
char sep,
117 std::function<
bool(
char const *,
char const *)>
const &cb);
118 static void ParseValues(FILE *fp,
size_t maxsize,
char sep,
bool includeSep,
119 std::function<
bool(
size_t,
char const *)>
const &cb);
122 static bool ReadUptime(
Uptime &uptime);
123 static bool ReadStat(pid_t pid,
Stat &stat);
124 static bool ReadStat(pid_t pid, pid_t tid,
Stat &stat);
125 static bool ReadProcessIds(pid_t pid, pid_t &ppid, uid_t &uid, uid_t &euid,
126 gid_t &gid, gid_t &egid);
135 static bool GetProcessELFInfo(pid_t pid,
ELFInfo &info);
136 static int32_t GetProcessELFMachineType(pid_t pid,
bool *is64Bit =
nullptr);
137 static CPUType GetProcessCPUType(pid_t pid);
140 static bool ReadProcessInfo(pid_t pid,
ProcessInfo &info);
143 static std::string GetProcessName(pid_t pid);
144 static pid_t GetProcessParentPid(pid_t pid);
145 static std::string GetThreadName(pid_t pid, pid_t tid);
146 static std::string GetProcessExecutableName(pid_t pid);
147 static std::string GetProcessExecutablePath(pid_t pid);
148 static bool GetProcessArguments(pid_t pid, ds2::StringCollection &args);
149 static std::string GetProcessArgumentsAsString(pid_t pid,
bool arg0 =
false);
152 static bool EnumerateProcesses(
bool allUsers, uid_t uid,
153 std::function<
void(pid_t, uid_t)>
const &cb);
154 static bool EnumerateThreads(pid_t pid, std::function<
void(pid_t)>
const &cb);