[compiler-rt] r326647 - Sanitiser common, using u64 type for GetTid on posix systems
Kamil Rytarowski via llvm-commits
llvm-commits at lists.llvm.org
Sat Mar 3 03:50:59 PST 2018
Author: kamil
Date: Sat Mar 3 03:50:58 2018
New Revision: 326647
URL: http://llvm.org/viewvc/llvm-project?rev=326647&view=rev
Log:
Sanitiser common, using u64 type for GetTid on posix systems
Summary: Moving from ptr to u64 for GetTid posix implementation.
[FreeBSD] Moving from pthread_self to thr_self more appropriate to get thread ID.
Patch by: David CARLIER
Reviewers: krytarowski, vitalybuka
Reviewed By: vitalybuka
Subscribers: kubamracek, llvm-commits, #sanitizers
Differential Revision: https://reviews.llvm.org/D43998
Modified:
compiler-rt/trunk/lib/sanitizer_common/sanitizer_internal_defs.h
compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_internal_defs.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_internal_defs.h?rev=326647&r1=326646&r2=326647&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_internal_defs.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_internal_defs.h Sat Mar 3 03:50:58 2018
@@ -178,12 +178,7 @@ typedef u32 operator_new_size_type;
# 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.
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc?rev=326647&r1=326646&r2=326647&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc Sat Mar 3 03:50:58 2018
@@ -84,6 +84,7 @@ extern "C" {
// 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 @@ bool FileExists(const char *filename) {
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
More information about the llvm-commits
mailing list