Skip to content

[NFC][sanitizer] Use tid_t instead of int in ThreadLister #111941

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1086,7 +1086,7 @@ ThreadLister::Result ThreadLister::ListThreads(
}
}

const char *ThreadLister::LoadStatus(int tid) {
const char *ThreadLister::LoadStatus(tid_t tid) {
auto cleanup = at_scope_exit([&] {
// Resize back to capacity if it is downsized by `ReadFileToVector`.
buffer_.resize(buffer_.capacity());
Expand All @@ -1097,7 +1097,7 @@ const char *ThreadLister::LoadStatus(int tid) {
return buffer_.data();
}

bool ThreadLister::IsAlive(int tid) {
bool ThreadLister::IsAlive(tid_t tid) {
// /proc/%d/task/%d/status uses same call to detect alive threads as
// proc_task_readdir. See task_state implementation in Linux.
static const char kPrefix[] = "\nPPid:";
Expand Down
4 changes: 2 additions & 2 deletions compiler-rt/lib/sanitizer_common/sanitizer_linux.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,10 @@ class ThreadLister {
Ok,
};
Result ListThreads(InternalMmapVector<tid_t> *threads);
const char *LoadStatus(int tid);
const char *LoadStatus(tid_t tid);

private:
bool IsAlive(int tid);
bool IsAlive(tid_t tid);

InternalScopedString task_path_;
InternalScopedString status_path_;
Expand Down
Loading