MCPcopy Create free account
hub / github.com/chromium/crashpad / ReadThreadIDs

Function ReadThreadIDs

util/linux/proc_task_reader.cc:30–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28namespace crashpad {
29
30bool ReadThreadIDs(pid_t pid, std::vector<pid_t>* tids) {
31 DCHECK(tids->empty());
32
33 char path[32];
34 snprintf(path, std::size(path), "/proc/%d/task", pid);
35 DirectoryReader reader;
36 if (!reader.Open(base::FilePath(path))) {
37 return false;
38 }
39
40 std::vector<pid_t> local_tids;
41 base::FilePath tid_str;
42 DirectoryReader::Result result;
43 while ((result = reader.NextFile(&tid_str)) ==
44 DirectoryReader::Result::kSuccess) {
45 pid_t tid;
46 if (!base::StringToInt(tid_str.value(), &tid)) {
47 LOG(ERROR) << "format error";
48 continue;
49 }
50
51 local_tids.push_back(tid);
52 }
53 DCHECK_EQ(AsUnderlyingType(result),
54 AsUnderlyingType(DirectoryReader::Result::kNoMoreFiles));
55 DCHECK(!local_tids.empty());
56
57 tids->swap(local_tids);
58 return true;
59}
60
61} // namespace crashpad

Callers 4

TESTFunction · 0.85
MultiprocessParentMethod · 0.85
ThreadsMethod · 0.85
SendSIGCONTFunction · 0.85

Calls 7

FilePathClass · 0.85
AsUnderlyingTypeFunction · 0.85
emptyMethod · 0.45
OpenMethod · 0.45
NextFileMethod · 0.45
valueMethod · 0.45
push_backMethod · 0.45

Tested by 2

TESTFunction · 0.68
MultiprocessParentMethod · 0.68