[PATCH] D56937: [safestack] Add ThreadId type as uint64_t

Vitaly Buka via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 18 14:32:16 PST 2019


vitalybuka updated this revision to Diff 182612.
vitalybuka added a comment.

include lwp.h


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56937/new/

https://reviews.llvm.org/D56937

Files:
  compiler-rt/lib/safestack/safestack.cc
  compiler-rt/lib/safestack/safestack_platform.h


Index: compiler-rt/lib/safestack/safestack_platform.h
===================================================================
--- compiler-rt/lib/safestack/safestack_platform.h
+++ 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 @@
 #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);
Index: compiler-rt/lib/safestack/safestack.cc
===================================================================
--- compiler-rt/lib/safestack/safestack.cc
+++ compiler-rt/lib/safestack/safestack.cc
@@ -151,7 +151,7 @@
   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 @@
   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;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56937.182612.patch
Type: text/x-patch
Size: 1434 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190118/d5b7d28b/attachment.bin>


More information about the llvm-commits mailing list