mirror of
https://github.com/Gericom/teak-llvm.git
synced 2025-06-18 19:15:51 -04:00
Change internal_start_thread arguments to match pthread_create.
This avoids a CFI-unfriendly function pointer type cast in internal_start_thread.
This commit is contained in:
parent
9d9b470e69
commit
966b5182ba
@ -855,7 +855,7 @@ INLINE uptr GetPthreadDestructorIterations() {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void *internal_start_thread(void(*func)(void*), void *arg);
|
void *internal_start_thread(void *(*func)(void*), void *arg);
|
||||||
void internal_join_thread(void *th);
|
void internal_join_thread(void *th);
|
||||||
void MaybeStartBackgroudThread();
|
void MaybeStartBackgroudThread();
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ SANITIZER_WEAK_ATTRIBUTE StackDepotStats *StackDepotGetStats() {
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BackgroundThread(void *arg) {
|
void *BackgroundThread(void *arg) {
|
||||||
const uptr hard_rss_limit_mb = common_flags()->hard_rss_limit_mb;
|
const uptr hard_rss_limit_mb = common_flags()->hard_rss_limit_mb;
|
||||||
const uptr soft_rss_limit_mb = common_flags()->soft_rss_limit_mb;
|
const uptr soft_rss_limit_mb = common_flags()->soft_rss_limit_mb;
|
||||||
const bool heap_profile = common_flags()->heap_profile;
|
const bool heap_profile = common_flags()->heap_profile;
|
||||||
|
@ -1701,7 +1701,7 @@ HandleSignalMode GetHandleSignalMode(int signum) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if !SANITIZER_GO
|
#if !SANITIZER_GO
|
||||||
void *internal_start_thread(void(*func)(void *arg), void *arg) {
|
void *internal_start_thread(void *(*func)(void *arg), void *arg) {
|
||||||
// Start the thread with signals blocked, otherwise it can steal user signals.
|
// Start the thread with signals blocked, otherwise it can steal user signals.
|
||||||
__sanitizer_sigset_t set, old;
|
__sanitizer_sigset_t set, old;
|
||||||
internal_sigfillset(&set);
|
internal_sigfillset(&set);
|
||||||
@ -1712,7 +1712,7 @@ void *internal_start_thread(void(*func)(void *arg), void *arg) {
|
|||||||
#endif
|
#endif
|
||||||
internal_sigprocmask(SIG_SETMASK, &set, &old);
|
internal_sigprocmask(SIG_SETMASK, &set, &old);
|
||||||
void *th;
|
void *th;
|
||||||
real_pthread_create(&th, nullptr, (void*(*)(void *arg))func, arg);
|
real_pthread_create(&th, nullptr, func, arg);
|
||||||
internal_sigprocmask(SIG_SETMASK, &old, nullptr);
|
internal_sigprocmask(SIG_SETMASK, &old, nullptr);
|
||||||
return th;
|
return th;
|
||||||
}
|
}
|
||||||
@ -1721,7 +1721,7 @@ void internal_join_thread(void *th) {
|
|||||||
real_pthread_join(th, nullptr);
|
real_pthread_join(th, nullptr);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
void *internal_start_thread(void (*func)(void *), void *arg) { return 0; }
|
void *internal_start_thread(void *(*func)(void *), void *arg) { return 0; }
|
||||||
|
|
||||||
void internal_join_thread(void *th) {}
|
void internal_join_thread(void *th) {}
|
||||||
#endif
|
#endif
|
||||||
|
@ -677,13 +677,13 @@ uptr GetRSS() {
|
|||||||
return info.resident_size;
|
return info.resident_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *internal_start_thread(void(*func)(void *arg), void *arg) {
|
void *internal_start_thread(void *(*func)(void *arg), void *arg) {
|
||||||
// Start the thread with signals blocked, otherwise it can steal user signals.
|
// Start the thread with signals blocked, otherwise it can steal user signals.
|
||||||
__sanitizer_sigset_t set, old;
|
__sanitizer_sigset_t set, old;
|
||||||
internal_sigfillset(&set);
|
internal_sigfillset(&set);
|
||||||
internal_sigprocmask(SIG_SETMASK, &set, &old);
|
internal_sigprocmask(SIG_SETMASK, &set, &old);
|
||||||
pthread_t th;
|
pthread_t th;
|
||||||
pthread_create(&th, 0, (void*(*)(void *arg))func, arg);
|
pthread_create(&th, 0, func, arg);
|
||||||
internal_sigprocmask(SIG_SETMASK, &old, 0);
|
internal_sigprocmask(SIG_SETMASK, &old, 0);
|
||||||
return th;
|
return th;
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ struct RunThreadArgs {
|
|||||||
void *argument;
|
void *argument;
|
||||||
};
|
};
|
||||||
|
|
||||||
void RunThread(void *arg) {
|
void *RunThread(void *arg) {
|
||||||
struct RunThreadArgs *run_args = (struct RunThreadArgs *)arg;
|
struct RunThreadArgs *run_args = (struct RunThreadArgs *)arg;
|
||||||
SuspendedThreadsListMac suspended_threads_list;
|
SuspendedThreadsListMac suspended_threads_list;
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ void RunThread(void *arg) {
|
|||||||
kern_return_t err = task_threads(mach_task_self(), &threads, &num_threads);
|
kern_return_t err = task_threads(mach_task_self(), &threads, &num_threads);
|
||||||
if (err != KERN_SUCCESS) {
|
if (err != KERN_SUCCESS) {
|
||||||
VReport(1, "Failed to get threads for task (errno %d).\n", err);
|
VReport(1, "Failed to get threads for task (errno %d).\n", err);
|
||||||
return;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
thread_t thread_self = mach_thread_self();
|
thread_t thread_self = mach_thread_self();
|
||||||
@ -76,6 +76,7 @@ void RunThread(void *arg) {
|
|||||||
for (unsigned int i = 0; i < num_suspended; ++i) {
|
for (unsigned int i = 0; i < num_suspended; ++i) {
|
||||||
thread_resume(suspended_threads_list.GetThread(i));
|
thread_resume(suspended_threads_list.GetThread(i));
|
||||||
}
|
}
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void StopTheWorld(StopTheWorldCallback callback, void *argument) {
|
void StopTheWorld(StopTheWorldCallback callback, void *argument) {
|
||||||
|
@ -787,7 +787,7 @@ uptr GetRSS() {
|
|||||||
return counters.WorkingSetSize;
|
return counters.WorkingSetSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *internal_start_thread(void (*func)(void *arg), void *arg) { return 0; }
|
void *internal_start_thread(void *(*func)(void *arg), void *arg) { return 0; }
|
||||||
void internal_join_thread(void *th) { }
|
void internal_join_thread(void *th) { }
|
||||||
|
|
||||||
// ---------------------- BlockingMutex ---------------- {{{1
|
// ---------------------- BlockingMutex ---------------- {{{1
|
||||||
|
@ -144,7 +144,7 @@ static void MemoryProfiler(Context *ctx, fd_t fd, int i) {
|
|||||||
WriteToFile(fd, buf.data(), internal_strlen(buf.data()));
|
WriteToFile(fd, buf.data(), internal_strlen(buf.data()));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void BackgroundThread(void *arg) {
|
static void *BackgroundThread(void *arg) {
|
||||||
// This is a non-initialized non-user thread, nothing to see here.
|
// This is a non-initialized non-user thread, nothing to see here.
|
||||||
// We don't use ScopedIgnoreInterceptors, because we want ignores to be
|
// We don't use ScopedIgnoreInterceptors, because we want ignores to be
|
||||||
// enabled even when the thread function exits (e.g. during pthread thread
|
// enabled even when the thread function exits (e.g. during pthread thread
|
||||||
@ -220,6 +220,7 @@ static void BackgroundThread(void *arg) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void StartBackgroundThread() {
|
static void StartBackgroundThread() {
|
||||||
|
Loading…
Reference in New Issue
Block a user