[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:
@@ -258,6 +258,13 @@ void onThreadExit(void (*destructor)(void*), void* destructorParameter) {
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/syscall.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
|
#endif
|
||||||
|
|
||||||
NO_EXTERNAL_CALLS_CHECK int currentThreadId() {
|
NO_EXTERNAL_CALLS_CHECK int currentThreadId() {
|
||||||
@@ -278,7 +285,7 @@ NO_EXTERNAL_CALLS_CHECK int currentThreadId() {
|
|||||||
#elif KONAN_ANDROID
|
#elif KONAN_ANDROID
|
||||||
return gettid();
|
return gettid();
|
||||||
#elif KONAN_LINUX
|
#elif KONAN_LINUX
|
||||||
return syscall(__NR_gettid);
|
return gettid();
|
||||||
#elif KONAN_WINDOWS
|
#elif KONAN_WINDOWS
|
||||||
return GetCurrentThreadId();
|
return GetCurrentThreadId();
|
||||||
#else
|
#else
|
||||||
|
|||||||
@@ -146,6 +146,8 @@ extern "C" const char* Kotlin_callsCheckerGoodFunctionNames[] = {
|
|||||||
"vsnprintf",
|
"vsnprintf",
|
||||||
"bcmp",
|
"bcmp",
|
||||||
|
|
||||||
|
"gettid",
|
||||||
|
|
||||||
"getenv",
|
"getenv",
|
||||||
"setenv",
|
"setenv",
|
||||||
"unsetenv",
|
"unsetenv",
|
||||||
|
|||||||
Reference in New Issue
Block a user