diff options
author | David Carlier <devnexen@gmail.com> | 2019-08-28 14:18:05 +0000 |
---|---|---|
committer | David Carlier <devnexen@gmail.com> | 2019-08-28 14:18:05 +0000 |
commit | a47b69c243569b43cf8b41bf513ba9cdd49b3f78 (patch) | |
tree | 26edb9c18c154dc414d78a67834de4d08a1f9344 /test | |
parent | fefe1b3cfde0d03deb474e14f9c560cc0f8588b6 (diff) | |
download | compiler-rt-a47b69c243569b43cf8b41bf513ba9cdd49b3f78.tar.gz |
[XRay] Fixing one test case for FreeBSD
Reviewers: dberris
Reviewed By: dberris
Differential Revision: https://reviews.llvm.org/D66867
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@370209 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/xray/TestCases/Posix/fork_basic_logging.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/xray/TestCases/Posix/fork_basic_logging.cpp b/test/xray/TestCases/Posix/fork_basic_logging.cpp index 3873325ef..fd8b781b8 100644 --- a/test/xray/TestCases/Posix/fork_basic_logging.cpp +++ b/test/xray/TestCases/Posix/fork_basic_logging.cpp @@ -18,14 +18,24 @@ #include <stdio.h> #include <unistd.h> #include <stdint.h> +#if defined(__linux__) #include <sys/syscall.h> +#elif defined(__FreeBSD__) +#include <sys/thr.h> +#endif //modified from sanitizer static uintptr_t syscall_gettid() { uint64_t retval; +#ifdef __linux__ asm volatile("syscall" : "=a"(retval) : "a"(__NR_gettid) : "rcx", "r11", "memory", "cc"); +#else + long t; + thr_self(&t); + retval = static_cast<uint64_t>(t); +#endif return retval; } |