[K/N] Add own gettid implementation

Call-checker can't handle syscalls yet, so instead we wrap it
inside function.
This commit is contained in:
Sergey Bogolepov
2022-06-23 12:02:07 +03:00
committed by Space
parent 4e4b1c1d4d
commit 26d09040a4
2 changed files with 10 additions and 1 deletions
@@ -258,6 +258,13 @@ void onThreadExit(void (*destructor)(void*), void* destructorParameter) {
#include <unistd.h>
#include <sys/types.h>
#include <sys/syscall.h>
/**
* We can't use gettid from glibc 2.30 because it is too new for us.
*/
NO_EXTERNAL_CALLS_CHECK NO_INLINE int gettid() {
return static_cast<int>(syscall(__NR_gettid));
}
#endif
NO_EXTERNAL_CALLS_CHECK int currentThreadId() {
@@ -278,7 +285,7 @@ NO_EXTERNAL_CALLS_CHECK int currentThreadId() {
#elif KONAN_ANDROID
return gettid();
#elif KONAN_LINUX
return syscall(__NR_gettid);
return gettid();
#elif KONAN_WINDOWS
return GetCurrentThreadId();
#else