if (!ReadThreadNameAndTgid(status_file, &comm, &tgid)) {
continue;
}
+ CHECK_EQ(pid, tgid);
ThreadComm thread;
thread.tid = tid;
- thread.tgid = tgid;
+ thread.pid = pid;
thread.comm = comm;
- thread.is_process = (tid == pid);
thread_comms->push_back(thread);
}
return true;
}
return true;
}
+
+bool GetExecPath(std::string* exec_path) {
+ char path[PATH_MAX];
+ ssize_t path_len = readlink("/proc/self/exe", path, sizeof(path));
+ if (path_len <= 0 || path_len >= static_cast<ssize_t>(sizeof(path))) {
+ PLOG(ERROR) << "readlink failed";
+ return false;
+ }
+ path[path_len] = '\0';
+ *exec_path = path;
+ return true;
+}