forked from OSchip/llvm-project
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 llvm-svn: 326647
This commit is contained in:
parent
0d58e0f613
commit
d14a955c24
|
|
@ -178,12 +178,7 @@ typedef u32 operator_new_size_type;
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if SANITIZER_MAC
|
|
||||||
// On Darwin, thread IDs are 64-bit even on 32-bit systems.
|
|
||||||
typedef u64 tid_t;
|
typedef u64 tid_t;
|
||||||
#else
|
|
||||||
typedef uptr tid_t;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ----------- ATTENTION -------------
|
// ----------- ATTENTION -------------
|
||||||
// This header should NOT include any other headers to avoid portability issues.
|
// This header should NOT include any other headers to avoid portability issues.
|
||||||
|
|
|
||||||
|
|
@ -84,6 +84,7 @@ extern "C" {
|
||||||
// FreeBSD 9.2 and 10.0.
|
// FreeBSD 9.2 and 10.0.
|
||||||
#include <sys/umtx.h>
|
#include <sys/umtx.h>
|
||||||
}
|
}
|
||||||
|
#include <sys/thr.h>
|
||||||
extern char **environ; // provided by crt1
|
extern char **environ; // provided by crt1
|
||||||
#endif // SANITIZER_FREEBSD
|
#endif // SANITIZER_FREEBSD
|
||||||
|
|
||||||
|
|
@ -453,11 +454,13 @@ bool FileExists(const char *filename) {
|
||||||
|
|
||||||
tid_t GetTid() {
|
tid_t GetTid() {
|
||||||
#if SANITIZER_FREEBSD
|
#if SANITIZER_FREEBSD
|
||||||
return (uptr)pthread_self();
|
long Tid;
|
||||||
|
thr_self(&Tid);
|
||||||
|
return Tid;
|
||||||
#elif SANITIZER_NETBSD
|
#elif SANITIZER_NETBSD
|
||||||
return _lwp_self();
|
return _lwp_self();
|
||||||
#elif SANITIZER_SOLARIS
|
#elif SANITIZER_SOLARIS
|
||||||
return (uptr)thr_self();
|
return thr_self();
|
||||||
#else
|
#else
|
||||||
return internal_syscall(SYSCALL(gettid));
|
return internal_syscall(SYSCALL(gettid));
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue