Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
12 changes: 6 additions & 6 deletions compiler-rt/lib/asan/asan_thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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);
Expand All @@ -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)
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion compiler-rt/lib/asan/asan_thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
8 changes: 4 additions & 4 deletions compiler-rt/lib/hwasan/hwasan_thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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; });
}
Expand All @@ -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);
Expand All @@ -210,15 +210,15 @@ 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) {}

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() {
Expand Down
6 changes: 3 additions & 3 deletions compiler-rt/lib/hwasan/hwasan_thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_; }

Expand All @@ -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.

Expand Down
20 changes: 10 additions & 10 deletions compiler-rt/lib/lsan/lsan_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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> &registers,
InternalMmapVector<Range> &extra_ranges,
Frontier *frontier, Accessor &accessor) {
Expand Down Expand Up @@ -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, &registers, &sp);
Expand All @@ -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();

Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions compiler-rt/lib/lsan/lsan_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();

//// --------------------------------------------------------------------------
Expand Down Expand Up @@ -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;
};
Expand Down
4 changes: 2 additions & 2 deletions compiler-rt/lib/lsan/lsan_interceptors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions compiler-rt/lib/lsan/lsan_posix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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 *>(
Expand Down
2 changes: 1 addition & 1 deletion compiler-rt/lib/lsan/lsan_posix.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions compiler-rt/lib/lsan/lsan_thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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) {}

Expand All @@ -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);
}
},
Expand Down
2 changes: 1 addition & 1 deletion compiler-rt/lib/lsan/lsan_thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion compiler-rt/lib/memprof/memprof_thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion compiler-rt/lib/memprof/memprof_thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions compiler-rt/lib/sanitizer_common/sanitizer_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion compiler-rt/lib/sanitizer_common/sanitizer_fuchsia.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(); }

Expand Down
4 changes: 2 additions & 2 deletions compiler-rt/lib/sanitizer_common/sanitizer_haiku.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Loading
Loading