summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--compiler-rt/lib/safestack/safestack.cc4
-rw-r--r--compiler-rt/lib/safestack/safestack_platform.h11
2 files changed, 11 insertions, 4 deletions
diff --git a/compiler-rt/lib/safestack/safestack.cc b/compiler-rt/lib/safestack/safestack.cc
index 1fd32c0ff2a..61e86a04dfa 100644
--- a/compiler-rt/lib/safestack/safestack.cc
+++ b/compiler-rt/lib/safestack/safestack.cc
@@ -151,7 +151,7 @@ struct thread_stack_ll {
void *stack_base;
size_t size;
pid_t pid;
- pid_t tid;
+ ThreadId tid;
};
/// Linked list of unsafe stacks for threads that are exiting. We delay
@@ -174,7 +174,7 @@ void thread_cleanup_handler(void *_iter) {
pthread_mutex_unlock(&thread_stacks_mutex);
pid_t pid = getpid();
- pid_t tid = GetTid();
+ ThreadId tid = GetTid();
// Free stacks for dead threads
thread_stack_ll **stackp = &temp_stacks;
diff --git a/compiler-rt/lib/safestack/safestack_platform.h b/compiler-rt/lib/safestack/safestack_platform.h
index 051e23beb34..7047de66139 100644
--- a/compiler-rt/lib/safestack/safestack_platform.h
+++ b/compiler-rt/lib/safestack/safestack_platform.h
@@ -16,13 +16,20 @@
#include "sanitizer_common/sanitizer_platform.h"
+#include <stdint.h>
#include <sys/syscall.h>
#include <sys/types.h>
#include <unistd.h>
+#if SANITIZER_NETBSD
+#include <lwp.h>
+#endif
+
namespace safestack {
-inline pid_t GetTid() {
+using ThreadId = uint64_t;
+
+inline ThreadId GetTid() {
#if SANITIZER_NETBSD
return _lwp_self();
#elif SANITIZER_FREEBSD
@@ -38,7 +45,7 @@ inline pid_t GetTid() {
#endif
}
-inline int TgKill(pid_t pid, pid_t tid, int sig) {
+inline int TgKill(pid_t pid, ThreadId tid, int sig) {
#if SANITIZER_NETBSD
(void)pid;
return _lwp_kill(tid, sig);
OpenPOWER on IntegriCloud