[PATCH] D43998: Sanitiser common, using u64 type for GetTid on posix systems

David CARLIER via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 2 00:43:51 PST 2018


devnexen updated this revision to Diff 136688.

https://reviews.llvm.org/D43998

Files:
  lib/sanitizer_common/sanitizer_internal_defs.h
  lib/sanitizer_common/sanitizer_linux.cc


Index: lib/sanitizer_common/sanitizer_linux.cc
===================================================================
--- lib/sanitizer_common/sanitizer_linux.cc
+++ lib/sanitizer_common/sanitizer_linux.cc
@@ -84,6 +84,7 @@
 // FreeBSD 9.2 and 10.0.
 #include <sys/umtx.h>
 }
+#include <sys/thr.h>
 extern char **environ;  // provided by crt1
 #endif  // SANITIZER_FREEBSD
 
@@ -453,11 +454,13 @@
 
 tid_t GetTid() {
 #if SANITIZER_FREEBSD
-  return (uptr)pthread_self();
+  long Tid;
+  thr_self(&Tid);
+  return Tid;
 #elif SANITIZER_NETBSD
   return _lwp_self();
 #elif SANITIZER_SOLARIS
-  return (uptr)thr_self();
+  return thr_self();
 #else
   return internal_syscall(SYSCALL(gettid));
 #endif
Index: lib/sanitizer_common/sanitizer_internal_defs.h
===================================================================
--- lib/sanitizer_common/sanitizer_internal_defs.h
+++ lib/sanitizer_common/sanitizer_internal_defs.h
@@ -178,12 +178,7 @@
 # endif
 #endif
 
-#if SANITIZER_MAC
-// On Darwin, thread IDs are 64-bit even on 32-bit systems.
 typedef u64 tid_t;
-#else
-typedef uptr tid_t;
-#endif
 
 // ----------- ATTENTION -------------
 // This header should NOT include any other headers to avoid portability issues.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43998.136688.patch
Type: text/x-patch
Size: 1222 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180302/ebebfd1f/attachment.bin>


More information about the llvm-commits mailing list