[compiler-rt] [NFC][sanitizer] Use tid_t instead of int in ThreadLister (PR #111941)

via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 10 20:56:35 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: Vitaly Buka (vitalybuka)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/111941.diff


2 Files Affected:

- (modified) compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp (+2-2) 
- (modified) compiler-rt/lib/sanitizer_common/sanitizer_linux.h (+2-2) 


``````````diff
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
index a4e58133c79f08..31750cf65ab6eb 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
@@ -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());
@@ -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:";
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_linux.h b/compiler-rt/lib/sanitizer_common/sanitizer_linux.h
index 07d9528813b3fe..8b7874bb5a3494 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_linux.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_linux.h
@@ -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_;

``````````

</details>


https://github.com/llvm/llvm-project/pull/111941


More information about the llvm-commits mailing list