-
Notifications
You must be signed in to change notification settings - Fork 14.5k
[sanitizer_common][nfc] Rename tid_t
to avoid conflicting declarations
#149011
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
base: main
Are you sure you want to change the base?
Conversation
tid_t
to avoid conflicting duplicate declarations
✅ With the latest revision this PR passed the C/C++ code formatter. |
tid_t
to avoid conflicting duplicate declarationstid_t
to avoid conflicting declarations
@llvm/pr-subscribers-compiler-rt-sanitizer Author: Jake Egan (jakeegan) Changes
Patch is 46.29 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/149011.diff 39 Files Affected:
diff --git a/compiler-rt/lib/asan/asan_thread.cpp b/compiler-rt/lib/asan/asan_thread.cpp
index 37fb6f2b07f27..1c4474a6826b4 100644
--- a/compiler-rt/lib/asan/asan_thread.cpp
+++ b/compiler-rt/lib/asan/asan_thread.cpp
@@ -282,7 +282,7 @@ void AsanThread::Init(const InitOptions *options) {
// asan_fuchsia.c definies CreateMainThread and SetThreadStackAndTls.
#if !SANITIZER_FUCHSIA
-void AsanThread::ThreadStart(tid_t os_id) {
+void AsanThread::ThreadStart(thid_t os_id) {
Init();
asanThreadRegistry().StartThread(tid(), os_id, ThreadType::Regular, nullptr);
@@ -469,7 +469,7 @@ void EnsureMainThreadIDIsCorrect() {
context->os_id = GetTid();
}
-__asan::AsanThread *GetAsanThreadByOsIDLocked(tid_t os_id) {
+__asan::AsanThread *GetAsanThreadByOsIDLocked(thid_t os_id) {
__asan::AsanThreadContext *context = static_cast<__asan::AsanThreadContext *>(
__asan::asanThreadRegistry().FindThreadContextByOsIDLocked(os_id));
if (!context)
@@ -497,7 +497,7 @@ static ThreadRegistry *GetAsanThreadRegistryLocked() {
void EnsureMainThreadIDIsCorrect() { __asan::EnsureMainThreadIDIsCorrect(); }
-bool GetThreadRangesLocked(tid_t os_id, uptr *stack_begin, uptr *stack_end,
+bool GetThreadRangesLocked(thid_t os_id, uptr *stack_begin, uptr *stack_end,
uptr *tls_begin, uptr *tls_end, uptr *cache_begin,
uptr *cache_end, DTLS **dtls) {
__asan::AsanThread *t = __asan::GetAsanThreadByOsIDLocked(os_id);
@@ -516,7 +516,7 @@ bool GetThreadRangesLocked(tid_t os_id, uptr *stack_begin, uptr *stack_end,
void GetAllThreadAllocatorCachesLocked(InternalMmapVector<uptr> *caches) {}
-void GetThreadExtraStackRangesLocked(tid_t os_id,
+void GetThreadExtraStackRangesLocked(thid_t os_id,
InternalMmapVector<Range> *ranges) {
__asan::AsanThread *t = __asan::GetAsanThreadByOsIDLocked(os_id);
if (!t)
@@ -546,11 +546,11 @@ void GetAdditionalThreadContextPtrsLocked(InternalMmapVector<uptr> *ptrs) {
__asan::asanThreadArgRetval().GetAllPtrsLocked(ptrs);
}
-void GetRunningThreadsLocked(InternalMmapVector<tid_t> *threads) {
+void GetRunningThreadsLocked(InternalMmapVector<thid_t> *threads) {
GetAsanThreadRegistryLocked()->RunCallbackForEachThreadLocked(
[](ThreadContextBase *tctx, void *threads) {
if (tctx->status == ThreadStatusRunning)
- reinterpret_cast<InternalMmapVector<tid_t> *>(threads)->push_back(
+ reinterpret_cast<InternalMmapVector<thid_t> *>(threads)->push_back(
tctx->os_id);
},
threads);
diff --git a/compiler-rt/lib/asan/asan_thread.h b/compiler-rt/lib/asan/asan_thread.h
index ad9e03d68fe96..3e2ba0aded049 100644
--- a/compiler-rt/lib/asan/asan_thread.h
+++ b/compiler-rt/lib/asan/asan_thread.h
@@ -75,7 +75,7 @@ class AsanThread {
struct InitOptions;
void Init(const InitOptions *options = nullptr);
- void ThreadStart(tid_t os_id);
+ void ThreadStart(thid_t os_id);
thread_return_t RunThread();
uptr stack_top();
diff --git a/compiler-rt/lib/hwasan/hwasan_thread.cpp b/compiler-rt/lib/hwasan/hwasan_thread.cpp
index 8b32e4e760e2f..a19cbda56f7fb 100644
--- a/compiler-rt/lib/hwasan/hwasan_thread.cpp
+++ b/compiler-rt/lib/hwasan/hwasan_thread.cpp
@@ -174,7 +174,7 @@ static __hwasan::HwasanThreadList *GetHwasanThreadListLocked() {
return &tl;
}
-static __hwasan::Thread *GetThreadByOsIDLocked(tid_t os_id) {
+static __hwasan::Thread *GetThreadByOsIDLocked(thid_t os_id) {
return GetHwasanThreadListLocked()->FindThreadLocked(
[os_id](__hwasan::Thread *t) { return t->os_id() == os_id; });
}
@@ -191,7 +191,7 @@ void UnlockThreads() {
void EnsureMainThreadIDIsCorrect() { __hwasan::EnsureMainThreadIDIsCorrect(); }
-bool GetThreadRangesLocked(tid_t os_id, uptr *stack_begin, uptr *stack_end,
+bool GetThreadRangesLocked(thid_t os_id, uptr *stack_begin, uptr *stack_end,
uptr *tls_begin, uptr *tls_end, uptr *cache_begin,
uptr *cache_end, DTLS **dtls) {
auto *t = GetThreadByOsIDLocked(os_id);
@@ -210,7 +210,7 @@ bool GetThreadRangesLocked(tid_t os_id, uptr *stack_begin, uptr *stack_end,
void GetAllThreadAllocatorCachesLocked(InternalMmapVector<uptr> *caches) {}
-void GetThreadExtraStackRangesLocked(tid_t os_id,
+void GetThreadExtraStackRangesLocked(thid_t os_id,
InternalMmapVector<Range> *ranges) {}
void GetThreadExtraStackRangesLocked(InternalMmapVector<Range> *ranges) {}
@@ -218,7 +218,7 @@ void GetAdditionalThreadContextPtrsLocked(InternalMmapVector<uptr> *ptrs) {
__hwasan::hwasanThreadArgRetval().GetAllPtrsLocked(ptrs);
}
-void GetRunningThreadsLocked(InternalMmapVector<tid_t> *threads) {
+void GetRunningThreadsLocked(InternalMmapVector<thid_t> *threads) {
// TODO: implement.
}
void PrintThreads() {
diff --git a/compiler-rt/lib/hwasan/hwasan_thread.h b/compiler-rt/lib/hwasan/hwasan_thread.h
index 9e1b438e48f77..94773fdbcaa53 100644
--- a/compiler-rt/lib/hwasan/hwasan_thread.h
+++ b/compiler-rt/lib/hwasan/hwasan_thread.h
@@ -69,8 +69,8 @@ class Thread {
Print("Thread: ");
}
- tid_t os_id() const { return os_id_; }
- void set_os_id(tid_t os_id) { os_id_ = os_id; }
+ thid_t os_id() const { return os_id_; }
+ void set_os_id(thid_t os_id) { os_id_ = os_id; }
uptr &vfork_spill() { return vfork_spill_; }
@@ -96,7 +96,7 @@ class Thread {
u32 unique_id_; // counting from zero.
- tid_t os_id_;
+ thid_t os_id_;
u32 tagging_disabled_; // if non-zero, malloc uses zero tag in this thread.
diff --git a/compiler-rt/lib/lsan/lsan_common.cpp b/compiler-rt/lib/lsan/lsan_common.cpp
index b17a17e1193bc..4cbeb92328c5c 100644
--- a/compiler-rt/lib/lsan/lsan_common.cpp
+++ b/compiler-rt/lib/lsan/lsan_common.cpp
@@ -412,7 +412,7 @@ void ScanExtraStackRanges(const InternalMmapVector<Range> &ranges,
# if SANITIZER_FUCHSIA
// Fuchsia handles all threads together with its own callback.
-static void ProcessThreads(SuspendedThreadsList const &, Frontier *, tid_t,
+static void ProcessThreads(SuspendedThreadsList const &, Frontier *, thid_t,
uptr) {}
# else
@@ -445,7 +445,7 @@ static void ProcessThreadRegistry(Frontier *frontier) {
// Scans thread data (stacks and TLS) for heap pointers.
template <class Accessor>
-static void ProcessThread(tid_t os_id, uptr sp,
+static void ProcessThread(thid_t os_id, uptr sp,
const InternalMmapVector<uptr> ®isters,
InternalMmapVector<Range> &extra_ranges,
Frontier *frontier, Accessor &accessor) {
@@ -556,16 +556,16 @@ static void ProcessThread(tid_t os_id, uptr sp,
}
static void ProcessThreads(SuspendedThreadsList const &suspended_threads,
- Frontier *frontier, tid_t caller_tid,
+ Frontier *frontier, thid_t caller_tid,
uptr caller_sp) {
- InternalMmapVector<tid_t> done_threads;
+ InternalMmapVector<thid_t> done_threads;
InternalMmapVector<uptr> registers;
InternalMmapVector<Range> extra_ranges;
for (uptr i = 0; i < suspended_threads.ThreadCount(); i++) {
registers.clear();
extra_ranges.clear();
- const tid_t os_id = suspended_threads.GetThreadID(i);
+ const thid_t os_id = suspended_threads.GetThreadID(i);
uptr sp = 0;
PtraceRegistersStatus have_registers =
suspended_threads.GetRegistersAndSP(i, ®isters, &sp);
@@ -589,10 +589,10 @@ static void ProcessThreads(SuspendedThreadsList const &suspended_threads,
if (flags()->use_detached) {
CopyMemoryAccessor accessor;
- InternalMmapVector<tid_t> known_threads;
+ InternalMmapVector<thid_t> known_threads;
GetRunningThreadsLocked(&known_threads);
Sort(done_threads.data(), done_threads.size());
- for (tid_t os_id : known_threads) {
+ for (thid_t os_id : known_threads) {
registers.clear();
extra_ranges.clear();
@@ -712,7 +712,7 @@ static void CollectIgnoredCb(uptr chunk, void *arg) {
// Sets the appropriate tag on each chunk.
static void ClassifyAllChunks(SuspendedThreadsList const &suspended_threads,
- Frontier *frontier, tid_t caller_tid,
+ Frontier *frontier, thid_t caller_tid,
uptr caller_sp) {
const InternalMmapVector<u32> &suppressed_stacks =
GetSuppressionContext()->GetSortedSuppressedStacks();
@@ -790,13 +790,13 @@ static bool ReportUnsuspendedThreads(const SuspendedThreadsList &) {
static bool ReportUnsuspendedThreads(
const SuspendedThreadsList &suspended_threads) {
- InternalMmapVector<tid_t> threads(suspended_threads.ThreadCount());
+ InternalMmapVector<thid_t> threads(suspended_threads.ThreadCount());
for (uptr i = 0; i < suspended_threads.ThreadCount(); ++i)
threads[i] = suspended_threads.GetThreadID(i);
Sort(threads.data(), threads.size());
- InternalMmapVector<tid_t> known_threads;
+ InternalMmapVector<thid_t> known_threads;
GetRunningThreadsLocked(&known_threads);
bool succeded = true;
diff --git a/compiler-rt/lib/lsan/lsan_common.h b/compiler-rt/lib/lsan/lsan_common.h
index f990c7850497a..2423489b2c846 100644
--- a/compiler-rt/lib/lsan/lsan_common.h
+++ b/compiler-rt/lib/lsan/lsan_common.h
@@ -102,15 +102,15 @@ void UnlockThreads() SANITIZER_NO_THREAD_SAFETY_ANALYSIS;
// where leak checking is initiated from a non-main thread).
void EnsureMainThreadIDIsCorrect();
-bool GetThreadRangesLocked(tid_t os_id, uptr *stack_begin, uptr *stack_end,
+bool GetThreadRangesLocked(thid_t os_id, uptr *stack_begin, uptr *stack_end,
uptr *tls_begin, uptr *tls_end, uptr *cache_begin,
uptr *cache_end, DTLS **dtls);
void GetAllThreadAllocatorCachesLocked(InternalMmapVector<uptr> *caches);
void GetThreadExtraStackRangesLocked(InternalMmapVector<Range> *ranges);
-void GetThreadExtraStackRangesLocked(tid_t os_id,
+void GetThreadExtraStackRangesLocked(thid_t os_id,
InternalMmapVector<Range> *ranges);
void GetAdditionalThreadContextPtrsLocked(InternalMmapVector<uptr> *ptrs);
-void GetRunningThreadsLocked(InternalMmapVector<tid_t> *threads);
+void GetRunningThreadsLocked(InternalMmapVector<thid_t> *threads);
void PrintThreads();
//// --------------------------------------------------------------------------
@@ -247,7 +247,7 @@ void ProcessPlatformSpecificAllocations(Frontier *frontier);
struct CheckForLeaksParam {
Frontier frontier;
LeakedChunks leaks;
- tid_t caller_tid;
+ thid_t caller_tid;
uptr caller_sp;
bool success = false;
};
diff --git a/compiler-rt/lib/lsan/lsan_interceptors.cpp b/compiler-rt/lib/lsan/lsan_interceptors.cpp
index f9f83f6c0cc45..d97f64edda0b4 100644
--- a/compiler-rt/lib/lsan/lsan_interceptors.cpp
+++ b/compiler-rt/lib/lsan/lsan_interceptors.cpp
@@ -385,12 +385,12 @@ INTERCEPTOR(void, _lwp_exit) {
#endif
#if SANITIZER_INTERCEPT_THR_EXIT
-INTERCEPTOR(void, thr_exit, tid_t *state) {
+INTERCEPTOR(void, thr_exit, thid_t *state) {
ENSURE_LSAN_INITED;
ThreadFinish();
REAL(thr_exit)(state);
}
-#define LSAN_MAYBE_INTERCEPT_THR_EXIT INTERCEPT_FUNCTION(thr_exit)
+# define LSAN_MAYBE_INTERCEPT_THR_EXIT INTERCEPT_FUNCTION(thr_exit)
#else
#define LSAN_MAYBE_INTERCEPT_THR_EXIT
#endif
diff --git a/compiler-rt/lib/lsan/lsan_posix.cpp b/compiler-rt/lib/lsan/lsan_posix.cpp
index 593000b9eef99..0a6a8e7bfe2d1 100644
--- a/compiler-rt/lib/lsan/lsan_posix.cpp
+++ b/compiler-rt/lib/lsan/lsan_posix.cpp
@@ -48,7 +48,7 @@ void ThreadContext::OnStarted(void *arg) {
dtls_ = args->dtls;
}
-void ThreadStart(u32 tid, tid_t os_id, ThreadType thread_type) {
+void ThreadStart(u32 tid, thid_t os_id, ThreadType thread_type) {
OnStartedArgs args;
GetThreadStackAndTls(tid == kMainTid, &args.stack_begin, &args.stack_end,
&args.tls_begin, &args.tls_end);
@@ -57,7 +57,7 @@ void ThreadStart(u32 tid, tid_t os_id, ThreadType thread_type) {
ThreadContextLsanBase::ThreadStart(tid, os_id, thread_type, &args);
}
-bool GetThreadRangesLocked(tid_t os_id, uptr *stack_begin, uptr *stack_end,
+bool GetThreadRangesLocked(thid_t os_id, uptr *stack_begin, uptr *stack_end,
uptr *tls_begin, uptr *tls_end, uptr *cache_begin,
uptr *cache_end, DTLS **dtls) {
ThreadContext *context = static_cast<ThreadContext *>(
diff --git a/compiler-rt/lib/lsan/lsan_posix.h b/compiler-rt/lib/lsan/lsan_posix.h
index b1265f233f363..990ea18c25168 100644
--- a/compiler-rt/lib/lsan/lsan_posix.h
+++ b/compiler-rt/lib/lsan/lsan_posix.h
@@ -41,7 +41,7 @@ class ThreadContext final : public ThreadContextLsanBase {
DTLS *dtls_ = nullptr;
};
-void ThreadStart(u32 tid, tid_t os_id,
+void ThreadStart(u32 tid, thid_t os_id,
ThreadType thread_type = ThreadType::Regular);
} // namespace __lsan
diff --git a/compiler-rt/lib/lsan/lsan_thread.cpp b/compiler-rt/lib/lsan/lsan_thread.cpp
index b66ea61a2de4e..8ac16142bc259 100644
--- a/compiler-rt/lib/lsan/lsan_thread.cpp
+++ b/compiler-rt/lib/lsan/lsan_thread.cpp
@@ -66,7 +66,7 @@ u32 ThreadCreate(u32 parent_tid, bool detached, void *arg) {
return thread_registry->CreateThread(0, detached, parent_tid, arg);
}
-void ThreadContextLsanBase::ThreadStart(u32 tid, tid_t os_id,
+void ThreadContextLsanBase::ThreadStart(u32 tid, thid_t os_id,
ThreadType thread_type, void *arg) {
thread_registry->StartThread(tid, os_id, thread_type, arg);
}
@@ -80,7 +80,7 @@ void EnsureMainThreadIDIsCorrect() {
///// Interface to the common LSan module. /////
-void GetThreadExtraStackRangesLocked(tid_t os_id,
+void GetThreadExtraStackRangesLocked(thid_t os_id,
InternalMmapVector<Range> *ranges) {}
void GetThreadExtraStackRangesLocked(InternalMmapVector<Range> *ranges) {}
@@ -99,11 +99,11 @@ ThreadRegistry *GetLsanThreadRegistryLocked() {
return thread_registry;
}
-void GetRunningThreadsLocked(InternalMmapVector<tid_t> *threads) {
+void GetRunningThreadsLocked(InternalMmapVector<thid_t> *threads) {
GetLsanThreadRegistryLocked()->RunCallbackForEachThreadLocked(
[](ThreadContextBase *tctx, void *threads) {
if (tctx->status == ThreadStatusRunning) {
- reinterpret_cast<InternalMmapVector<tid_t> *>(threads)->push_back(
+ reinterpret_cast<InternalMmapVector<thid_t> *>(threads)->push_back(
tctx->os_id);
}
},
diff --git a/compiler-rt/lib/lsan/lsan_thread.h b/compiler-rt/lib/lsan/lsan_thread.h
index 222066ee93cd9..ba0002f78ae6e 100644
--- a/compiler-rt/lib/lsan/lsan_thread.h
+++ b/compiler-rt/lib/lsan/lsan_thread.h
@@ -30,7 +30,7 @@ class ThreadContextLsanBase : public ThreadContextBase {
uptr cache_end() { return cache_end_; }
// The argument is passed on to the subclass's OnStarted member function.
- static void ThreadStart(u32 tid, tid_t os_id, ThreadType thread_type,
+ static void ThreadStart(u32 tid, thid_t os_id, ThreadType thread_type,
void *onstarted_arg);
protected:
diff --git a/compiler-rt/lib/memprof/memprof_thread.cpp b/compiler-rt/lib/memprof/memprof_thread.cpp
index 4b9665ffc3fce..66150ed992dc0 100644
--- a/compiler-rt/lib/memprof/memprof_thread.cpp
+++ b/compiler-rt/lib/memprof/memprof_thread.cpp
@@ -131,7 +131,7 @@ void MemprofThread::Init(const InitOptions *options) {
}
thread_return_t
-MemprofThread::ThreadStart(tid_t os_id,
+MemprofThread::ThreadStart(thid_t os_id,
atomic_uintptr_t *signal_thread_is_registered) {
Init();
memprofThreadRegistry().StartThread(tid(), os_id, ThreadType::Regular,
diff --git a/compiler-rt/lib/memprof/memprof_thread.h b/compiler-rt/lib/memprof/memprof_thread.h
index fb90dbf328a43..0e97fc87ca338 100644
--- a/compiler-rt/lib/memprof/memprof_thread.h
+++ b/compiler-rt/lib/memprof/memprof_thread.h
@@ -59,7 +59,7 @@ class MemprofThread {
struct InitOptions;
void Init(const InitOptions *options = nullptr);
- thread_return_t ThreadStart(tid_t os_id,
+ thread_return_t ThreadStart(thid_t os_id,
atomic_uintptr_t *signal_thread_is_registered);
uptr stack_top();
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common.h b/compiler-rt/lib/sanitizer_common/sanitizer_common.h
index 120c2861c1ac0..55067eece5f29 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_common.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_common.h
@@ -78,8 +78,8 @@ uptr GetMmapGranularity();
uptr GetMaxVirtualAddress();
uptr GetMaxUserVirtualAddress();
// Threads
-tid_t GetTid();
-int TgKill(pid_t pid, tid_t tid, int sig);
+thid_t GetTid();
+int TgKill(pid_t pid, thid_t tid, int sig);
uptr GetThreadSelf();
void GetThreadStackTopAndBottom(bool at_initialization, uptr *stack_top,
uptr *stack_bottom);
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_fuchsia.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_fuchsia.cpp
index 1ca50eb186a34..4714bea3fd383 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_fuchsia.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_fuchsia.cpp
@@ -68,7 +68,7 @@ int internal_dlinfo(void *handle, int request, void *p) { UNIMPLEMENTED(); }
uptr GetThreadSelf() { return reinterpret_cast<uptr>(thrd_current()); }
-tid_t GetTid() { return GetThreadSelf(); }
+thid_t GetTid() { return GetThreadSelf(); }
void Abort() { abort(); }
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_haiku.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_haiku.cpp
index 7cf2437d5b755..f7c6c0475c40c 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_haiku.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_haiku.cpp
@@ -231,12 +231,12 @@ uptr internal_execve(const char *filename, char *const argv[],
}
# if 0
-tid_t GetTid() {
+thid_t GetTid() {
DEFINE__REAL(int, _lwp_self);
return _REAL(_lwp_self);
}
-int TgKill(pid_t pid, tid_t tid, int sig) {
+int TgKill(pid_t pid, thid_t tid, int sig) {
DEFINE__REAL(int, _lwp_kill, int a, int b);
(void)pid;
return _REAL(_lwp_kill, tid, sig);
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h b/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h
index fff60c96f632f..8ef2fab573454 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h
@@ -209,7 +209,7 @@ typedef long ssize;
typedef sptr ssize;
#endif
-typedef u64 tid_t;
+typedef u64 thid_t;
// ----------- ATTENTION -------------
// This header should NOT include any other headers to avoid portability issues.
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
index 16caf699a4c24..67253ed168cef 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
@@ -638,7 +638,7 @@ bool DirExists(const char *path) {
}
# if !SANITIZER_NETBSD
-tid_t GetTid() {
+thid_t GetTid() {
# if SANITIZER_FREEBSD
long Tid;
thr_self(&Tid);
@@ -652,7 +652,7 @@ tid_t GetTid() {
# endif
}
-int TgKill(pid_t pid, tid_t tid, int sig) {
+int TgKill(pid_t pid, thid_t tid, int sig) {
# if SANITIZER_LINUX
return internal_syscall(SYSCALL(tgkill), pid, tid, sig);
# elif SANITIZER_FREEBSD
@@ -1089,7 +1089,7 @@ ThreadLister::ThreadLister(pid_t pid) : buffer_(4096) {
}
ThreadLister::Result ThreadLister::ListThreads(
- InternalMmapVector<tid_t> *threads) {
+ InternalMmapVector<thid_t> *threads) {
int descriptor = internal_open(task_path_.data(), O_RDONLY | O_DIRECTORY);
if (internal_iserror(descriptor)) {
Report("Can't open %s for reading.\n", task_path_.data());
@@ -1144,7 +1144,7 @@ ThreadLister::Result ThreadLister::ListThreads(
}
}
-const char *ThreadLister::LoadStatus(tid_t tid) {
+const char *ThreadLister::LoadStatus(thid_t tid) {
status_path_.clear();
status_path_.AppendF("%s/%llu/status", task_path_.data(), tid);
auto cleanup = at_scope_exit([&] {
@@ -1157,7 +1157,7 @@ const char *ThreadLister::LoadStatus(tid_t tid) {
return buffer_.data();
}
-bool ThreadLister::IsAlive(tid_t tid) {
+bool ThreadLister::IsAlive(t...
[truncated]
|
@llvm/pr-subscribers-xray Author: Jake Egan (jakeegan) Changes
Patch is 46.29 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/149011.diff 39 Files Affected:
diff --git a/compiler-rt/lib/asan/asan_thread.cpp b/compiler-rt/lib/asan/asan_thread.cpp
index 37fb6f2b07f27..1c4474a6826b4 100644
--- a/compiler-rt/lib/asan/asan_thread.cpp
+++ b/compiler-rt/lib/asan/asan_thread.cpp
@@ -282,7 +282,7 @@ void AsanThread::Init(const InitOptions *options) {
// asan_fuchsia.c definies CreateMainThread and SetThreadStackAndTls.
#if !SANITIZER_FUCHSIA
-void AsanThread::ThreadStart(tid_t os_id) {
+void AsanThread::ThreadStart(thid_t os_id) {
Init();
asanThreadRegistry().StartThread(tid(), os_id, ThreadType::Regular, nullptr);
@@ -469,7 +469,7 @@ void EnsureMainThreadIDIsCorrect() {
context->os_id = GetTid();
}
-__asan::AsanThread *GetAsanThreadByOsIDLocked(tid_t os_id) {
+__asan::AsanThread *GetAsanThreadByOsIDLocked(thid_t os_id) {
__asan::AsanThreadContext *context = static_cast<__asan::AsanThreadContext *>(
__asan::asanThreadRegistry().FindThreadContextByOsIDLocked(os_id));
if (!context)
@@ -497,7 +497,7 @@ static ThreadRegistry *GetAsanThreadRegistryLocked() {
void EnsureMainThreadIDIsCorrect() { __asan::EnsureMainThreadIDIsCorrect(); }
-bool GetThreadRangesLocked(tid_t os_id, uptr *stack_begin, uptr *stack_end,
+bool GetThreadRangesLocked(thid_t os_id, uptr *stack_begin, uptr *stack_end,
uptr *tls_begin, uptr *tls_end, uptr *cache_begin,
uptr *cache_end, DTLS **dtls) {
__asan::AsanThread *t = __asan::GetAsanThreadByOsIDLocked(os_id);
@@ -516,7 +516,7 @@ bool GetThreadRangesLocked(tid_t os_id, uptr *stack_begin, uptr *stack_end,
void GetAllThreadAllocatorCachesLocked(InternalMmapVector<uptr> *caches) {}
-void GetThreadExtraStackRangesLocked(tid_t os_id,
+void GetThreadExtraStackRangesLocked(thid_t os_id,
InternalMmapVector<Range> *ranges) {
__asan::AsanThread *t = __asan::GetAsanThreadByOsIDLocked(os_id);
if (!t)
@@ -546,11 +546,11 @@ void GetAdditionalThreadContextPtrsLocked(InternalMmapVector<uptr> *ptrs) {
__asan::asanThreadArgRetval().GetAllPtrsLocked(ptrs);
}
-void GetRunningThreadsLocked(InternalMmapVector<tid_t> *threads) {
+void GetRunningThreadsLocked(InternalMmapVector<thid_t> *threads) {
GetAsanThreadRegistryLocked()->RunCallbackForEachThreadLocked(
[](ThreadContextBase *tctx, void *threads) {
if (tctx->status == ThreadStatusRunning)
- reinterpret_cast<InternalMmapVector<tid_t> *>(threads)->push_back(
+ reinterpret_cast<InternalMmapVector<thid_t> *>(threads)->push_back(
tctx->os_id);
},
threads);
diff --git a/compiler-rt/lib/asan/asan_thread.h b/compiler-rt/lib/asan/asan_thread.h
index ad9e03d68fe96..3e2ba0aded049 100644
--- a/compiler-rt/lib/asan/asan_thread.h
+++ b/compiler-rt/lib/asan/asan_thread.h
@@ -75,7 +75,7 @@ class AsanThread {
struct InitOptions;
void Init(const InitOptions *options = nullptr);
- void ThreadStart(tid_t os_id);
+ void ThreadStart(thid_t os_id);
thread_return_t RunThread();
uptr stack_top();
diff --git a/compiler-rt/lib/hwasan/hwasan_thread.cpp b/compiler-rt/lib/hwasan/hwasan_thread.cpp
index 8b32e4e760e2f..a19cbda56f7fb 100644
--- a/compiler-rt/lib/hwasan/hwasan_thread.cpp
+++ b/compiler-rt/lib/hwasan/hwasan_thread.cpp
@@ -174,7 +174,7 @@ static __hwasan::HwasanThreadList *GetHwasanThreadListLocked() {
return &tl;
}
-static __hwasan::Thread *GetThreadByOsIDLocked(tid_t os_id) {
+static __hwasan::Thread *GetThreadByOsIDLocked(thid_t os_id) {
return GetHwasanThreadListLocked()->FindThreadLocked(
[os_id](__hwasan::Thread *t) { return t->os_id() == os_id; });
}
@@ -191,7 +191,7 @@ void UnlockThreads() {
void EnsureMainThreadIDIsCorrect() { __hwasan::EnsureMainThreadIDIsCorrect(); }
-bool GetThreadRangesLocked(tid_t os_id, uptr *stack_begin, uptr *stack_end,
+bool GetThreadRangesLocked(thid_t os_id, uptr *stack_begin, uptr *stack_end,
uptr *tls_begin, uptr *tls_end, uptr *cache_begin,
uptr *cache_end, DTLS **dtls) {
auto *t = GetThreadByOsIDLocked(os_id);
@@ -210,7 +210,7 @@ bool GetThreadRangesLocked(tid_t os_id, uptr *stack_begin, uptr *stack_end,
void GetAllThreadAllocatorCachesLocked(InternalMmapVector<uptr> *caches) {}
-void GetThreadExtraStackRangesLocked(tid_t os_id,
+void GetThreadExtraStackRangesLocked(thid_t os_id,
InternalMmapVector<Range> *ranges) {}
void GetThreadExtraStackRangesLocked(InternalMmapVector<Range> *ranges) {}
@@ -218,7 +218,7 @@ void GetAdditionalThreadContextPtrsLocked(InternalMmapVector<uptr> *ptrs) {
__hwasan::hwasanThreadArgRetval().GetAllPtrsLocked(ptrs);
}
-void GetRunningThreadsLocked(InternalMmapVector<tid_t> *threads) {
+void GetRunningThreadsLocked(InternalMmapVector<thid_t> *threads) {
// TODO: implement.
}
void PrintThreads() {
diff --git a/compiler-rt/lib/hwasan/hwasan_thread.h b/compiler-rt/lib/hwasan/hwasan_thread.h
index 9e1b438e48f77..94773fdbcaa53 100644
--- a/compiler-rt/lib/hwasan/hwasan_thread.h
+++ b/compiler-rt/lib/hwasan/hwasan_thread.h
@@ -69,8 +69,8 @@ class Thread {
Print("Thread: ");
}
- tid_t os_id() const { return os_id_; }
- void set_os_id(tid_t os_id) { os_id_ = os_id; }
+ thid_t os_id() const { return os_id_; }
+ void set_os_id(thid_t os_id) { os_id_ = os_id; }
uptr &vfork_spill() { return vfork_spill_; }
@@ -96,7 +96,7 @@ class Thread {
u32 unique_id_; // counting from zero.
- tid_t os_id_;
+ thid_t os_id_;
u32 tagging_disabled_; // if non-zero, malloc uses zero tag in this thread.
diff --git a/compiler-rt/lib/lsan/lsan_common.cpp b/compiler-rt/lib/lsan/lsan_common.cpp
index b17a17e1193bc..4cbeb92328c5c 100644
--- a/compiler-rt/lib/lsan/lsan_common.cpp
+++ b/compiler-rt/lib/lsan/lsan_common.cpp
@@ -412,7 +412,7 @@ void ScanExtraStackRanges(const InternalMmapVector<Range> &ranges,
# if SANITIZER_FUCHSIA
// Fuchsia handles all threads together with its own callback.
-static void ProcessThreads(SuspendedThreadsList const &, Frontier *, tid_t,
+static void ProcessThreads(SuspendedThreadsList const &, Frontier *, thid_t,
uptr) {}
# else
@@ -445,7 +445,7 @@ static void ProcessThreadRegistry(Frontier *frontier) {
// Scans thread data (stacks and TLS) for heap pointers.
template <class Accessor>
-static void ProcessThread(tid_t os_id, uptr sp,
+static void ProcessThread(thid_t os_id, uptr sp,
const InternalMmapVector<uptr> ®isters,
InternalMmapVector<Range> &extra_ranges,
Frontier *frontier, Accessor &accessor) {
@@ -556,16 +556,16 @@ static void ProcessThread(tid_t os_id, uptr sp,
}
static void ProcessThreads(SuspendedThreadsList const &suspended_threads,
- Frontier *frontier, tid_t caller_tid,
+ Frontier *frontier, thid_t caller_tid,
uptr caller_sp) {
- InternalMmapVector<tid_t> done_threads;
+ InternalMmapVector<thid_t> done_threads;
InternalMmapVector<uptr> registers;
InternalMmapVector<Range> extra_ranges;
for (uptr i = 0; i < suspended_threads.ThreadCount(); i++) {
registers.clear();
extra_ranges.clear();
- const tid_t os_id = suspended_threads.GetThreadID(i);
+ const thid_t os_id = suspended_threads.GetThreadID(i);
uptr sp = 0;
PtraceRegistersStatus have_registers =
suspended_threads.GetRegistersAndSP(i, ®isters, &sp);
@@ -589,10 +589,10 @@ static void ProcessThreads(SuspendedThreadsList const &suspended_threads,
if (flags()->use_detached) {
CopyMemoryAccessor accessor;
- InternalMmapVector<tid_t> known_threads;
+ InternalMmapVector<thid_t> known_threads;
GetRunningThreadsLocked(&known_threads);
Sort(done_threads.data(), done_threads.size());
- for (tid_t os_id : known_threads) {
+ for (thid_t os_id : known_threads) {
registers.clear();
extra_ranges.clear();
@@ -712,7 +712,7 @@ static void CollectIgnoredCb(uptr chunk, void *arg) {
// Sets the appropriate tag on each chunk.
static void ClassifyAllChunks(SuspendedThreadsList const &suspended_threads,
- Frontier *frontier, tid_t caller_tid,
+ Frontier *frontier, thid_t caller_tid,
uptr caller_sp) {
const InternalMmapVector<u32> &suppressed_stacks =
GetSuppressionContext()->GetSortedSuppressedStacks();
@@ -790,13 +790,13 @@ static bool ReportUnsuspendedThreads(const SuspendedThreadsList &) {
static bool ReportUnsuspendedThreads(
const SuspendedThreadsList &suspended_threads) {
- InternalMmapVector<tid_t> threads(suspended_threads.ThreadCount());
+ InternalMmapVector<thid_t> threads(suspended_threads.ThreadCount());
for (uptr i = 0; i < suspended_threads.ThreadCount(); ++i)
threads[i] = suspended_threads.GetThreadID(i);
Sort(threads.data(), threads.size());
- InternalMmapVector<tid_t> known_threads;
+ InternalMmapVector<thid_t> known_threads;
GetRunningThreadsLocked(&known_threads);
bool succeded = true;
diff --git a/compiler-rt/lib/lsan/lsan_common.h b/compiler-rt/lib/lsan/lsan_common.h
index f990c7850497a..2423489b2c846 100644
--- a/compiler-rt/lib/lsan/lsan_common.h
+++ b/compiler-rt/lib/lsan/lsan_common.h
@@ -102,15 +102,15 @@ void UnlockThreads() SANITIZER_NO_THREAD_SAFETY_ANALYSIS;
// where leak checking is initiated from a non-main thread).
void EnsureMainThreadIDIsCorrect();
-bool GetThreadRangesLocked(tid_t os_id, uptr *stack_begin, uptr *stack_end,
+bool GetThreadRangesLocked(thid_t os_id, uptr *stack_begin, uptr *stack_end,
uptr *tls_begin, uptr *tls_end, uptr *cache_begin,
uptr *cache_end, DTLS **dtls);
void GetAllThreadAllocatorCachesLocked(InternalMmapVector<uptr> *caches);
void GetThreadExtraStackRangesLocked(InternalMmapVector<Range> *ranges);
-void GetThreadExtraStackRangesLocked(tid_t os_id,
+void GetThreadExtraStackRangesLocked(thid_t os_id,
InternalMmapVector<Range> *ranges);
void GetAdditionalThreadContextPtrsLocked(InternalMmapVector<uptr> *ptrs);
-void GetRunningThreadsLocked(InternalMmapVector<tid_t> *threads);
+void GetRunningThreadsLocked(InternalMmapVector<thid_t> *threads);
void PrintThreads();
//// --------------------------------------------------------------------------
@@ -247,7 +247,7 @@ void ProcessPlatformSpecificAllocations(Frontier *frontier);
struct CheckForLeaksParam {
Frontier frontier;
LeakedChunks leaks;
- tid_t caller_tid;
+ thid_t caller_tid;
uptr caller_sp;
bool success = false;
};
diff --git a/compiler-rt/lib/lsan/lsan_interceptors.cpp b/compiler-rt/lib/lsan/lsan_interceptors.cpp
index f9f83f6c0cc45..d97f64edda0b4 100644
--- a/compiler-rt/lib/lsan/lsan_interceptors.cpp
+++ b/compiler-rt/lib/lsan/lsan_interceptors.cpp
@@ -385,12 +385,12 @@ INTERCEPTOR(void, _lwp_exit) {
#endif
#if SANITIZER_INTERCEPT_THR_EXIT
-INTERCEPTOR(void, thr_exit, tid_t *state) {
+INTERCEPTOR(void, thr_exit, thid_t *state) {
ENSURE_LSAN_INITED;
ThreadFinish();
REAL(thr_exit)(state);
}
-#define LSAN_MAYBE_INTERCEPT_THR_EXIT INTERCEPT_FUNCTION(thr_exit)
+# define LSAN_MAYBE_INTERCEPT_THR_EXIT INTERCEPT_FUNCTION(thr_exit)
#else
#define LSAN_MAYBE_INTERCEPT_THR_EXIT
#endif
diff --git a/compiler-rt/lib/lsan/lsan_posix.cpp b/compiler-rt/lib/lsan/lsan_posix.cpp
index 593000b9eef99..0a6a8e7bfe2d1 100644
--- a/compiler-rt/lib/lsan/lsan_posix.cpp
+++ b/compiler-rt/lib/lsan/lsan_posix.cpp
@@ -48,7 +48,7 @@ void ThreadContext::OnStarted(void *arg) {
dtls_ = args->dtls;
}
-void ThreadStart(u32 tid, tid_t os_id, ThreadType thread_type) {
+void ThreadStart(u32 tid, thid_t os_id, ThreadType thread_type) {
OnStartedArgs args;
GetThreadStackAndTls(tid == kMainTid, &args.stack_begin, &args.stack_end,
&args.tls_begin, &args.tls_end);
@@ -57,7 +57,7 @@ void ThreadStart(u32 tid, tid_t os_id, ThreadType thread_type) {
ThreadContextLsanBase::ThreadStart(tid, os_id, thread_type, &args);
}
-bool GetThreadRangesLocked(tid_t os_id, uptr *stack_begin, uptr *stack_end,
+bool GetThreadRangesLocked(thid_t os_id, uptr *stack_begin, uptr *stack_end,
uptr *tls_begin, uptr *tls_end, uptr *cache_begin,
uptr *cache_end, DTLS **dtls) {
ThreadContext *context = static_cast<ThreadContext *>(
diff --git a/compiler-rt/lib/lsan/lsan_posix.h b/compiler-rt/lib/lsan/lsan_posix.h
index b1265f233f363..990ea18c25168 100644
--- a/compiler-rt/lib/lsan/lsan_posix.h
+++ b/compiler-rt/lib/lsan/lsan_posix.h
@@ -41,7 +41,7 @@ class ThreadContext final : public ThreadContextLsanBase {
DTLS *dtls_ = nullptr;
};
-void ThreadStart(u32 tid, tid_t os_id,
+void ThreadStart(u32 tid, thid_t os_id,
ThreadType thread_type = ThreadType::Regular);
} // namespace __lsan
diff --git a/compiler-rt/lib/lsan/lsan_thread.cpp b/compiler-rt/lib/lsan/lsan_thread.cpp
index b66ea61a2de4e..8ac16142bc259 100644
--- a/compiler-rt/lib/lsan/lsan_thread.cpp
+++ b/compiler-rt/lib/lsan/lsan_thread.cpp
@@ -66,7 +66,7 @@ u32 ThreadCreate(u32 parent_tid, bool detached, void *arg) {
return thread_registry->CreateThread(0, detached, parent_tid, arg);
}
-void ThreadContextLsanBase::ThreadStart(u32 tid, tid_t os_id,
+void ThreadContextLsanBase::ThreadStart(u32 tid, thid_t os_id,
ThreadType thread_type, void *arg) {
thread_registry->StartThread(tid, os_id, thread_type, arg);
}
@@ -80,7 +80,7 @@ void EnsureMainThreadIDIsCorrect() {
///// Interface to the common LSan module. /////
-void GetThreadExtraStackRangesLocked(tid_t os_id,
+void GetThreadExtraStackRangesLocked(thid_t os_id,
InternalMmapVector<Range> *ranges) {}
void GetThreadExtraStackRangesLocked(InternalMmapVector<Range> *ranges) {}
@@ -99,11 +99,11 @@ ThreadRegistry *GetLsanThreadRegistryLocked() {
return thread_registry;
}
-void GetRunningThreadsLocked(InternalMmapVector<tid_t> *threads) {
+void GetRunningThreadsLocked(InternalMmapVector<thid_t> *threads) {
GetLsanThreadRegistryLocked()->RunCallbackForEachThreadLocked(
[](ThreadContextBase *tctx, void *threads) {
if (tctx->status == ThreadStatusRunning) {
- reinterpret_cast<InternalMmapVector<tid_t> *>(threads)->push_back(
+ reinterpret_cast<InternalMmapVector<thid_t> *>(threads)->push_back(
tctx->os_id);
}
},
diff --git a/compiler-rt/lib/lsan/lsan_thread.h b/compiler-rt/lib/lsan/lsan_thread.h
index 222066ee93cd9..ba0002f78ae6e 100644
--- a/compiler-rt/lib/lsan/lsan_thread.h
+++ b/compiler-rt/lib/lsan/lsan_thread.h
@@ -30,7 +30,7 @@ class ThreadContextLsanBase : public ThreadContextBase {
uptr cache_end() { return cache_end_; }
// The argument is passed on to the subclass's OnStarted member function.
- static void ThreadStart(u32 tid, tid_t os_id, ThreadType thread_type,
+ static void ThreadStart(u32 tid, thid_t os_id, ThreadType thread_type,
void *onstarted_arg);
protected:
diff --git a/compiler-rt/lib/memprof/memprof_thread.cpp b/compiler-rt/lib/memprof/memprof_thread.cpp
index 4b9665ffc3fce..66150ed992dc0 100644
--- a/compiler-rt/lib/memprof/memprof_thread.cpp
+++ b/compiler-rt/lib/memprof/memprof_thread.cpp
@@ -131,7 +131,7 @@ void MemprofThread::Init(const InitOptions *options) {
}
thread_return_t
-MemprofThread::ThreadStart(tid_t os_id,
+MemprofThread::ThreadStart(thid_t os_id,
atomic_uintptr_t *signal_thread_is_registered) {
Init();
memprofThreadRegistry().StartThread(tid(), os_id, ThreadType::Regular,
diff --git a/compiler-rt/lib/memprof/memprof_thread.h b/compiler-rt/lib/memprof/memprof_thread.h
index fb90dbf328a43..0e97fc87ca338 100644
--- a/compiler-rt/lib/memprof/memprof_thread.h
+++ b/compiler-rt/lib/memprof/memprof_thread.h
@@ -59,7 +59,7 @@ class MemprofThread {
struct InitOptions;
void Init(const InitOptions *options = nullptr);
- thread_return_t ThreadStart(tid_t os_id,
+ thread_return_t ThreadStart(thid_t os_id,
atomic_uintptr_t *signal_thread_is_registered);
uptr stack_top();
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common.h b/compiler-rt/lib/sanitizer_common/sanitizer_common.h
index 120c2861c1ac0..55067eece5f29 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_common.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_common.h
@@ -78,8 +78,8 @@ uptr GetMmapGranularity();
uptr GetMaxVirtualAddress();
uptr GetMaxUserVirtualAddress();
// Threads
-tid_t GetTid();
-int TgKill(pid_t pid, tid_t tid, int sig);
+thid_t GetTid();
+int TgKill(pid_t pid, thid_t tid, int sig);
uptr GetThreadSelf();
void GetThreadStackTopAndBottom(bool at_initialization, uptr *stack_top,
uptr *stack_bottom);
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_fuchsia.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_fuchsia.cpp
index 1ca50eb186a34..4714bea3fd383 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_fuchsia.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_fuchsia.cpp
@@ -68,7 +68,7 @@ int internal_dlinfo(void *handle, int request, void *p) { UNIMPLEMENTED(); }
uptr GetThreadSelf() { return reinterpret_cast<uptr>(thrd_current()); }
-tid_t GetTid() { return GetThreadSelf(); }
+thid_t GetTid() { return GetThreadSelf(); }
void Abort() { abort(); }
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_haiku.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_haiku.cpp
index 7cf2437d5b755..f7c6c0475c40c 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_haiku.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_haiku.cpp
@@ -231,12 +231,12 @@ uptr internal_execve(const char *filename, char *const argv[],
}
# if 0
-tid_t GetTid() {
+thid_t GetTid() {
DEFINE__REAL(int, _lwp_self);
return _REAL(_lwp_self);
}
-int TgKill(pid_t pid, tid_t tid, int sig) {
+int TgKill(pid_t pid, thid_t tid, int sig) {
DEFINE__REAL(int, _lwp_kill, int a, int b);
(void)pid;
return _REAL(_lwp_kill, tid, sig);
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h b/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h
index fff60c96f632f..8ef2fab573454 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h
@@ -209,7 +209,7 @@ typedef long ssize;
typedef sptr ssize;
#endif
-typedef u64 tid_t;
+typedef u64 thid_t;
// ----------- ATTENTION -------------
// This header should NOT include any other headers to avoid portability issues.
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
index 16caf699a4c24..67253ed168cef 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
@@ -638,7 +638,7 @@ bool DirExists(const char *path) {
}
# if !SANITIZER_NETBSD
-tid_t GetTid() {
+thid_t GetTid() {
# if SANITIZER_FREEBSD
long Tid;
thr_self(&Tid);
@@ -652,7 +652,7 @@ tid_t GetTid() {
# endif
}
-int TgKill(pid_t pid, tid_t tid, int sig) {
+int TgKill(pid_t pid, thid_t tid, int sig) {
# if SANITIZER_LINUX
return internal_syscall(SYSCALL(tgkill), pid, tid, sig);
# elif SANITIZER_FREEBSD
@@ -1089,7 +1089,7 @@ ThreadLister::ThreadLister(pid_t pid) : buffer_(4096) {
}
ThreadLister::Result ThreadLister::ListThreads(
- InternalMmapVector<tid_t> *threads) {
+ InternalMmapVector<thid_t> *threads) {
int descriptor = internal_open(task_path_.data(), O_RDONLY | O_DIRECTORY);
if (internal_iserror(descriptor)) {
Report("Can't open %s for reading.\n", task_path_.data());
@@ -1144,7 +1144,7 @@ ThreadLister::Result ThreadLister::ListThreads(
}
}
-const char *ThreadLister::LoadStatus(tid_t tid) {
+const char *ThreadLister::LoadStatus(thid_t tid) {
status_path_.clear();
status_path_.AppendF("%s/%llu/status", task_path_.data(), tid);
auto cleanup = at_scope_exit([&] {
@@ -1157,7 +1157,7 @@ const char *ThreadLister::LoadStatus(tid_t tid) {
return buffer_.data();
}
-bool ThreadLister::IsAlive(tid_t tid) {
+bool ThreadLister::IsAlive(t...
[truncated]
|
@llvm/pr-subscribers-pgo Author: Jake Egan (jakeegan) Changes
Patch is 46.29 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/149011.diff 39 Files Affected:
diff --git a/compiler-rt/lib/asan/asan_thread.cpp b/compiler-rt/lib/asan/asan_thread.cpp
index 37fb6f2b07f27..1c4474a6826b4 100644
--- a/compiler-rt/lib/asan/asan_thread.cpp
+++ b/compiler-rt/lib/asan/asan_thread.cpp
@@ -282,7 +282,7 @@ void AsanThread::Init(const InitOptions *options) {
// asan_fuchsia.c definies CreateMainThread and SetThreadStackAndTls.
#if !SANITIZER_FUCHSIA
-void AsanThread::ThreadStart(tid_t os_id) {
+void AsanThread::ThreadStart(thid_t os_id) {
Init();
asanThreadRegistry().StartThread(tid(), os_id, ThreadType::Regular, nullptr);
@@ -469,7 +469,7 @@ void EnsureMainThreadIDIsCorrect() {
context->os_id = GetTid();
}
-__asan::AsanThread *GetAsanThreadByOsIDLocked(tid_t os_id) {
+__asan::AsanThread *GetAsanThreadByOsIDLocked(thid_t os_id) {
__asan::AsanThreadContext *context = static_cast<__asan::AsanThreadContext *>(
__asan::asanThreadRegistry().FindThreadContextByOsIDLocked(os_id));
if (!context)
@@ -497,7 +497,7 @@ static ThreadRegistry *GetAsanThreadRegistryLocked() {
void EnsureMainThreadIDIsCorrect() { __asan::EnsureMainThreadIDIsCorrect(); }
-bool GetThreadRangesLocked(tid_t os_id, uptr *stack_begin, uptr *stack_end,
+bool GetThreadRangesLocked(thid_t os_id, uptr *stack_begin, uptr *stack_end,
uptr *tls_begin, uptr *tls_end, uptr *cache_begin,
uptr *cache_end, DTLS **dtls) {
__asan::AsanThread *t = __asan::GetAsanThreadByOsIDLocked(os_id);
@@ -516,7 +516,7 @@ bool GetThreadRangesLocked(tid_t os_id, uptr *stack_begin, uptr *stack_end,
void GetAllThreadAllocatorCachesLocked(InternalMmapVector<uptr> *caches) {}
-void GetThreadExtraStackRangesLocked(tid_t os_id,
+void GetThreadExtraStackRangesLocked(thid_t os_id,
InternalMmapVector<Range> *ranges) {
__asan::AsanThread *t = __asan::GetAsanThreadByOsIDLocked(os_id);
if (!t)
@@ -546,11 +546,11 @@ void GetAdditionalThreadContextPtrsLocked(InternalMmapVector<uptr> *ptrs) {
__asan::asanThreadArgRetval().GetAllPtrsLocked(ptrs);
}
-void GetRunningThreadsLocked(InternalMmapVector<tid_t> *threads) {
+void GetRunningThreadsLocked(InternalMmapVector<thid_t> *threads) {
GetAsanThreadRegistryLocked()->RunCallbackForEachThreadLocked(
[](ThreadContextBase *tctx, void *threads) {
if (tctx->status == ThreadStatusRunning)
- reinterpret_cast<InternalMmapVector<tid_t> *>(threads)->push_back(
+ reinterpret_cast<InternalMmapVector<thid_t> *>(threads)->push_back(
tctx->os_id);
},
threads);
diff --git a/compiler-rt/lib/asan/asan_thread.h b/compiler-rt/lib/asan/asan_thread.h
index ad9e03d68fe96..3e2ba0aded049 100644
--- a/compiler-rt/lib/asan/asan_thread.h
+++ b/compiler-rt/lib/asan/asan_thread.h
@@ -75,7 +75,7 @@ class AsanThread {
struct InitOptions;
void Init(const InitOptions *options = nullptr);
- void ThreadStart(tid_t os_id);
+ void ThreadStart(thid_t os_id);
thread_return_t RunThread();
uptr stack_top();
diff --git a/compiler-rt/lib/hwasan/hwasan_thread.cpp b/compiler-rt/lib/hwasan/hwasan_thread.cpp
index 8b32e4e760e2f..a19cbda56f7fb 100644
--- a/compiler-rt/lib/hwasan/hwasan_thread.cpp
+++ b/compiler-rt/lib/hwasan/hwasan_thread.cpp
@@ -174,7 +174,7 @@ static __hwasan::HwasanThreadList *GetHwasanThreadListLocked() {
return &tl;
}
-static __hwasan::Thread *GetThreadByOsIDLocked(tid_t os_id) {
+static __hwasan::Thread *GetThreadByOsIDLocked(thid_t os_id) {
return GetHwasanThreadListLocked()->FindThreadLocked(
[os_id](__hwasan::Thread *t) { return t->os_id() == os_id; });
}
@@ -191,7 +191,7 @@ void UnlockThreads() {
void EnsureMainThreadIDIsCorrect() { __hwasan::EnsureMainThreadIDIsCorrect(); }
-bool GetThreadRangesLocked(tid_t os_id, uptr *stack_begin, uptr *stack_end,
+bool GetThreadRangesLocked(thid_t os_id, uptr *stack_begin, uptr *stack_end,
uptr *tls_begin, uptr *tls_end, uptr *cache_begin,
uptr *cache_end, DTLS **dtls) {
auto *t = GetThreadByOsIDLocked(os_id);
@@ -210,7 +210,7 @@ bool GetThreadRangesLocked(tid_t os_id, uptr *stack_begin, uptr *stack_end,
void GetAllThreadAllocatorCachesLocked(InternalMmapVector<uptr> *caches) {}
-void GetThreadExtraStackRangesLocked(tid_t os_id,
+void GetThreadExtraStackRangesLocked(thid_t os_id,
InternalMmapVector<Range> *ranges) {}
void GetThreadExtraStackRangesLocked(InternalMmapVector<Range> *ranges) {}
@@ -218,7 +218,7 @@ void GetAdditionalThreadContextPtrsLocked(InternalMmapVector<uptr> *ptrs) {
__hwasan::hwasanThreadArgRetval().GetAllPtrsLocked(ptrs);
}
-void GetRunningThreadsLocked(InternalMmapVector<tid_t> *threads) {
+void GetRunningThreadsLocked(InternalMmapVector<thid_t> *threads) {
// TODO: implement.
}
void PrintThreads() {
diff --git a/compiler-rt/lib/hwasan/hwasan_thread.h b/compiler-rt/lib/hwasan/hwasan_thread.h
index 9e1b438e48f77..94773fdbcaa53 100644
--- a/compiler-rt/lib/hwasan/hwasan_thread.h
+++ b/compiler-rt/lib/hwasan/hwasan_thread.h
@@ -69,8 +69,8 @@ class Thread {
Print("Thread: ");
}
- tid_t os_id() const { return os_id_; }
- void set_os_id(tid_t os_id) { os_id_ = os_id; }
+ thid_t os_id() const { return os_id_; }
+ void set_os_id(thid_t os_id) { os_id_ = os_id; }
uptr &vfork_spill() { return vfork_spill_; }
@@ -96,7 +96,7 @@ class Thread {
u32 unique_id_; // counting from zero.
- tid_t os_id_;
+ thid_t os_id_;
u32 tagging_disabled_; // if non-zero, malloc uses zero tag in this thread.
diff --git a/compiler-rt/lib/lsan/lsan_common.cpp b/compiler-rt/lib/lsan/lsan_common.cpp
index b17a17e1193bc..4cbeb92328c5c 100644
--- a/compiler-rt/lib/lsan/lsan_common.cpp
+++ b/compiler-rt/lib/lsan/lsan_common.cpp
@@ -412,7 +412,7 @@ void ScanExtraStackRanges(const InternalMmapVector<Range> &ranges,
# if SANITIZER_FUCHSIA
// Fuchsia handles all threads together with its own callback.
-static void ProcessThreads(SuspendedThreadsList const &, Frontier *, tid_t,
+static void ProcessThreads(SuspendedThreadsList const &, Frontier *, thid_t,
uptr) {}
# else
@@ -445,7 +445,7 @@ static void ProcessThreadRegistry(Frontier *frontier) {
// Scans thread data (stacks and TLS) for heap pointers.
template <class Accessor>
-static void ProcessThread(tid_t os_id, uptr sp,
+static void ProcessThread(thid_t os_id, uptr sp,
const InternalMmapVector<uptr> ®isters,
InternalMmapVector<Range> &extra_ranges,
Frontier *frontier, Accessor &accessor) {
@@ -556,16 +556,16 @@ static void ProcessThread(tid_t os_id, uptr sp,
}
static void ProcessThreads(SuspendedThreadsList const &suspended_threads,
- Frontier *frontier, tid_t caller_tid,
+ Frontier *frontier, thid_t caller_tid,
uptr caller_sp) {
- InternalMmapVector<tid_t> done_threads;
+ InternalMmapVector<thid_t> done_threads;
InternalMmapVector<uptr> registers;
InternalMmapVector<Range> extra_ranges;
for (uptr i = 0; i < suspended_threads.ThreadCount(); i++) {
registers.clear();
extra_ranges.clear();
- const tid_t os_id = suspended_threads.GetThreadID(i);
+ const thid_t os_id = suspended_threads.GetThreadID(i);
uptr sp = 0;
PtraceRegistersStatus have_registers =
suspended_threads.GetRegistersAndSP(i, ®isters, &sp);
@@ -589,10 +589,10 @@ static void ProcessThreads(SuspendedThreadsList const &suspended_threads,
if (flags()->use_detached) {
CopyMemoryAccessor accessor;
- InternalMmapVector<tid_t> known_threads;
+ InternalMmapVector<thid_t> known_threads;
GetRunningThreadsLocked(&known_threads);
Sort(done_threads.data(), done_threads.size());
- for (tid_t os_id : known_threads) {
+ for (thid_t os_id : known_threads) {
registers.clear();
extra_ranges.clear();
@@ -712,7 +712,7 @@ static void CollectIgnoredCb(uptr chunk, void *arg) {
// Sets the appropriate tag on each chunk.
static void ClassifyAllChunks(SuspendedThreadsList const &suspended_threads,
- Frontier *frontier, tid_t caller_tid,
+ Frontier *frontier, thid_t caller_tid,
uptr caller_sp) {
const InternalMmapVector<u32> &suppressed_stacks =
GetSuppressionContext()->GetSortedSuppressedStacks();
@@ -790,13 +790,13 @@ static bool ReportUnsuspendedThreads(const SuspendedThreadsList &) {
static bool ReportUnsuspendedThreads(
const SuspendedThreadsList &suspended_threads) {
- InternalMmapVector<tid_t> threads(suspended_threads.ThreadCount());
+ InternalMmapVector<thid_t> threads(suspended_threads.ThreadCount());
for (uptr i = 0; i < suspended_threads.ThreadCount(); ++i)
threads[i] = suspended_threads.GetThreadID(i);
Sort(threads.data(), threads.size());
- InternalMmapVector<tid_t> known_threads;
+ InternalMmapVector<thid_t> known_threads;
GetRunningThreadsLocked(&known_threads);
bool succeded = true;
diff --git a/compiler-rt/lib/lsan/lsan_common.h b/compiler-rt/lib/lsan/lsan_common.h
index f990c7850497a..2423489b2c846 100644
--- a/compiler-rt/lib/lsan/lsan_common.h
+++ b/compiler-rt/lib/lsan/lsan_common.h
@@ -102,15 +102,15 @@ void UnlockThreads() SANITIZER_NO_THREAD_SAFETY_ANALYSIS;
// where leak checking is initiated from a non-main thread).
void EnsureMainThreadIDIsCorrect();
-bool GetThreadRangesLocked(tid_t os_id, uptr *stack_begin, uptr *stack_end,
+bool GetThreadRangesLocked(thid_t os_id, uptr *stack_begin, uptr *stack_end,
uptr *tls_begin, uptr *tls_end, uptr *cache_begin,
uptr *cache_end, DTLS **dtls);
void GetAllThreadAllocatorCachesLocked(InternalMmapVector<uptr> *caches);
void GetThreadExtraStackRangesLocked(InternalMmapVector<Range> *ranges);
-void GetThreadExtraStackRangesLocked(tid_t os_id,
+void GetThreadExtraStackRangesLocked(thid_t os_id,
InternalMmapVector<Range> *ranges);
void GetAdditionalThreadContextPtrsLocked(InternalMmapVector<uptr> *ptrs);
-void GetRunningThreadsLocked(InternalMmapVector<tid_t> *threads);
+void GetRunningThreadsLocked(InternalMmapVector<thid_t> *threads);
void PrintThreads();
//// --------------------------------------------------------------------------
@@ -247,7 +247,7 @@ void ProcessPlatformSpecificAllocations(Frontier *frontier);
struct CheckForLeaksParam {
Frontier frontier;
LeakedChunks leaks;
- tid_t caller_tid;
+ thid_t caller_tid;
uptr caller_sp;
bool success = false;
};
diff --git a/compiler-rt/lib/lsan/lsan_interceptors.cpp b/compiler-rt/lib/lsan/lsan_interceptors.cpp
index f9f83f6c0cc45..d97f64edda0b4 100644
--- a/compiler-rt/lib/lsan/lsan_interceptors.cpp
+++ b/compiler-rt/lib/lsan/lsan_interceptors.cpp
@@ -385,12 +385,12 @@ INTERCEPTOR(void, _lwp_exit) {
#endif
#if SANITIZER_INTERCEPT_THR_EXIT
-INTERCEPTOR(void, thr_exit, tid_t *state) {
+INTERCEPTOR(void, thr_exit, thid_t *state) {
ENSURE_LSAN_INITED;
ThreadFinish();
REAL(thr_exit)(state);
}
-#define LSAN_MAYBE_INTERCEPT_THR_EXIT INTERCEPT_FUNCTION(thr_exit)
+# define LSAN_MAYBE_INTERCEPT_THR_EXIT INTERCEPT_FUNCTION(thr_exit)
#else
#define LSAN_MAYBE_INTERCEPT_THR_EXIT
#endif
diff --git a/compiler-rt/lib/lsan/lsan_posix.cpp b/compiler-rt/lib/lsan/lsan_posix.cpp
index 593000b9eef99..0a6a8e7bfe2d1 100644
--- a/compiler-rt/lib/lsan/lsan_posix.cpp
+++ b/compiler-rt/lib/lsan/lsan_posix.cpp
@@ -48,7 +48,7 @@ void ThreadContext::OnStarted(void *arg) {
dtls_ = args->dtls;
}
-void ThreadStart(u32 tid, tid_t os_id, ThreadType thread_type) {
+void ThreadStart(u32 tid, thid_t os_id, ThreadType thread_type) {
OnStartedArgs args;
GetThreadStackAndTls(tid == kMainTid, &args.stack_begin, &args.stack_end,
&args.tls_begin, &args.tls_end);
@@ -57,7 +57,7 @@ void ThreadStart(u32 tid, tid_t os_id, ThreadType thread_type) {
ThreadContextLsanBase::ThreadStart(tid, os_id, thread_type, &args);
}
-bool GetThreadRangesLocked(tid_t os_id, uptr *stack_begin, uptr *stack_end,
+bool GetThreadRangesLocked(thid_t os_id, uptr *stack_begin, uptr *stack_end,
uptr *tls_begin, uptr *tls_end, uptr *cache_begin,
uptr *cache_end, DTLS **dtls) {
ThreadContext *context = static_cast<ThreadContext *>(
diff --git a/compiler-rt/lib/lsan/lsan_posix.h b/compiler-rt/lib/lsan/lsan_posix.h
index b1265f233f363..990ea18c25168 100644
--- a/compiler-rt/lib/lsan/lsan_posix.h
+++ b/compiler-rt/lib/lsan/lsan_posix.h
@@ -41,7 +41,7 @@ class ThreadContext final : public ThreadContextLsanBase {
DTLS *dtls_ = nullptr;
};
-void ThreadStart(u32 tid, tid_t os_id,
+void ThreadStart(u32 tid, thid_t os_id,
ThreadType thread_type = ThreadType::Regular);
} // namespace __lsan
diff --git a/compiler-rt/lib/lsan/lsan_thread.cpp b/compiler-rt/lib/lsan/lsan_thread.cpp
index b66ea61a2de4e..8ac16142bc259 100644
--- a/compiler-rt/lib/lsan/lsan_thread.cpp
+++ b/compiler-rt/lib/lsan/lsan_thread.cpp
@@ -66,7 +66,7 @@ u32 ThreadCreate(u32 parent_tid, bool detached, void *arg) {
return thread_registry->CreateThread(0, detached, parent_tid, arg);
}
-void ThreadContextLsanBase::ThreadStart(u32 tid, tid_t os_id,
+void ThreadContextLsanBase::ThreadStart(u32 tid, thid_t os_id,
ThreadType thread_type, void *arg) {
thread_registry->StartThread(tid, os_id, thread_type, arg);
}
@@ -80,7 +80,7 @@ void EnsureMainThreadIDIsCorrect() {
///// Interface to the common LSan module. /////
-void GetThreadExtraStackRangesLocked(tid_t os_id,
+void GetThreadExtraStackRangesLocked(thid_t os_id,
InternalMmapVector<Range> *ranges) {}
void GetThreadExtraStackRangesLocked(InternalMmapVector<Range> *ranges) {}
@@ -99,11 +99,11 @@ ThreadRegistry *GetLsanThreadRegistryLocked() {
return thread_registry;
}
-void GetRunningThreadsLocked(InternalMmapVector<tid_t> *threads) {
+void GetRunningThreadsLocked(InternalMmapVector<thid_t> *threads) {
GetLsanThreadRegistryLocked()->RunCallbackForEachThreadLocked(
[](ThreadContextBase *tctx, void *threads) {
if (tctx->status == ThreadStatusRunning) {
- reinterpret_cast<InternalMmapVector<tid_t> *>(threads)->push_back(
+ reinterpret_cast<InternalMmapVector<thid_t> *>(threads)->push_back(
tctx->os_id);
}
},
diff --git a/compiler-rt/lib/lsan/lsan_thread.h b/compiler-rt/lib/lsan/lsan_thread.h
index 222066ee93cd9..ba0002f78ae6e 100644
--- a/compiler-rt/lib/lsan/lsan_thread.h
+++ b/compiler-rt/lib/lsan/lsan_thread.h
@@ -30,7 +30,7 @@ class ThreadContextLsanBase : public ThreadContextBase {
uptr cache_end() { return cache_end_; }
// The argument is passed on to the subclass's OnStarted member function.
- static void ThreadStart(u32 tid, tid_t os_id, ThreadType thread_type,
+ static void ThreadStart(u32 tid, thid_t os_id, ThreadType thread_type,
void *onstarted_arg);
protected:
diff --git a/compiler-rt/lib/memprof/memprof_thread.cpp b/compiler-rt/lib/memprof/memprof_thread.cpp
index 4b9665ffc3fce..66150ed992dc0 100644
--- a/compiler-rt/lib/memprof/memprof_thread.cpp
+++ b/compiler-rt/lib/memprof/memprof_thread.cpp
@@ -131,7 +131,7 @@ void MemprofThread::Init(const InitOptions *options) {
}
thread_return_t
-MemprofThread::ThreadStart(tid_t os_id,
+MemprofThread::ThreadStart(thid_t os_id,
atomic_uintptr_t *signal_thread_is_registered) {
Init();
memprofThreadRegistry().StartThread(tid(), os_id, ThreadType::Regular,
diff --git a/compiler-rt/lib/memprof/memprof_thread.h b/compiler-rt/lib/memprof/memprof_thread.h
index fb90dbf328a43..0e97fc87ca338 100644
--- a/compiler-rt/lib/memprof/memprof_thread.h
+++ b/compiler-rt/lib/memprof/memprof_thread.h
@@ -59,7 +59,7 @@ class MemprofThread {
struct InitOptions;
void Init(const InitOptions *options = nullptr);
- thread_return_t ThreadStart(tid_t os_id,
+ thread_return_t ThreadStart(thid_t os_id,
atomic_uintptr_t *signal_thread_is_registered);
uptr stack_top();
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common.h b/compiler-rt/lib/sanitizer_common/sanitizer_common.h
index 120c2861c1ac0..55067eece5f29 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_common.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_common.h
@@ -78,8 +78,8 @@ uptr GetMmapGranularity();
uptr GetMaxVirtualAddress();
uptr GetMaxUserVirtualAddress();
// Threads
-tid_t GetTid();
-int TgKill(pid_t pid, tid_t tid, int sig);
+thid_t GetTid();
+int TgKill(pid_t pid, thid_t tid, int sig);
uptr GetThreadSelf();
void GetThreadStackTopAndBottom(bool at_initialization, uptr *stack_top,
uptr *stack_bottom);
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_fuchsia.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_fuchsia.cpp
index 1ca50eb186a34..4714bea3fd383 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_fuchsia.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_fuchsia.cpp
@@ -68,7 +68,7 @@ int internal_dlinfo(void *handle, int request, void *p) { UNIMPLEMENTED(); }
uptr GetThreadSelf() { return reinterpret_cast<uptr>(thrd_current()); }
-tid_t GetTid() { return GetThreadSelf(); }
+thid_t GetTid() { return GetThreadSelf(); }
void Abort() { abort(); }
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_haiku.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_haiku.cpp
index 7cf2437d5b755..f7c6c0475c40c 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_haiku.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_haiku.cpp
@@ -231,12 +231,12 @@ uptr internal_execve(const char *filename, char *const argv[],
}
# if 0
-tid_t GetTid() {
+thid_t GetTid() {
DEFINE__REAL(int, _lwp_self);
return _REAL(_lwp_self);
}
-int TgKill(pid_t pid, tid_t tid, int sig) {
+int TgKill(pid_t pid, thid_t tid, int sig) {
DEFINE__REAL(int, _lwp_kill, int a, int b);
(void)pid;
return _REAL(_lwp_kill, tid, sig);
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h b/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h
index fff60c96f632f..8ef2fab573454 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h
@@ -209,7 +209,7 @@ typedef long ssize;
typedef sptr ssize;
#endif
-typedef u64 tid_t;
+typedef u64 thid_t;
// ----------- ATTENTION -------------
// This header should NOT include any other headers to avoid portability issues.
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
index 16caf699a4c24..67253ed168cef 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
@@ -638,7 +638,7 @@ bool DirExists(const char *path) {
}
# if !SANITIZER_NETBSD
-tid_t GetTid() {
+thid_t GetTid() {
# if SANITIZER_FREEBSD
long Tid;
thr_self(&Tid);
@@ -652,7 +652,7 @@ tid_t GetTid() {
# endif
}
-int TgKill(pid_t pid, tid_t tid, int sig) {
+int TgKill(pid_t pid, thid_t tid, int sig) {
# if SANITIZER_LINUX
return internal_syscall(SYSCALL(tgkill), pid, tid, sig);
# elif SANITIZER_FREEBSD
@@ -1089,7 +1089,7 @@ ThreadLister::ThreadLister(pid_t pid) : buffer_(4096) {
}
ThreadLister::Result ThreadLister::ListThreads(
- InternalMmapVector<tid_t> *threads) {
+ InternalMmapVector<thid_t> *threads) {
int descriptor = internal_open(task_path_.data(), O_RDONLY | O_DIRECTORY);
if (internal_iserror(descriptor)) {
Report("Can't open %s for reading.\n", task_path_.data());
@@ -1144,7 +1144,7 @@ ThreadLister::Result ThreadLister::ListThreads(
}
}
-const char *ThreadLister::LoadStatus(tid_t tid) {
+const char *ThreadLister::LoadStatus(thid_t tid) {
status_path_.clear();
status_path_.AppendF("%s/%llu/status", task_path_.data(), tid);
auto cleanup = at_scope_exit([&] {
@@ -1157,7 +1157,7 @@ const char *ThreadLister::LoadStatus(tid_t tid) {
return buffer_.data();
}
-bool ThreadLister::IsAlive(tid_t tid) {
+bool ThreadLister::IsAlive(t...
[truncated]
|
@@ -209,7 +209,7 @@ typedef long ssize; | |||
typedef sptr ssize; | |||
#endif | |||
|
|||
typedef u64 tid_t; | |||
typedef u64 thid_t; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why thid_t?
This type internal sanitizer typedef, so, like u32 should not have _t suffix.
tid? but could be too short and conflict with something else.
ThreadID?
tid_t
is also defined in the AIX header/usr/include/sys/types.h
which is included by systempthread.h
. The use oftid_t
by AIX is conforming according to POSIX: