[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:23:42 PST 2018
devnexen created this revision.
devnexen added reviewers: krytarowski, vitalybuka.
devnexen created this object with visibility "All Users".
Herald added subscribers: Sanitizers, llvm-commits, kubamracek.
Repository:
rCRT Compiler Runtime
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,13 +454,15 @@
tid_t GetTid() {
#if SANITIZER_FREEBSD
- return (uptr)pthread_self();
+ long Tid;
+ thr_self(&Tid);
+ return (u64)Tid;
#elif SANITIZER_NETBSD
return _lwp_self();
#elif SANITIZER_SOLARIS
- return (uptr)thr_self();
+ return (u64)thr_self();
#else
- return internal_syscall(SYSCALL(gettid));
+ return (u64)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.136686.patch
Type: text/x-patch
Size: 1287 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180302/0fb380bd/attachment.bin>
More information about the llvm-commits
mailing list