gettid () is a system call. As for, as I know, there is no glibc shell for Gettid. You need to call gettid () using syscall (). The following code works for me.
#include <sys/syscall.h> #include <unistd.h> #include <stdlib.h> #include <stdio.h> int main() { long tid; tid = syscall(SYS_gettid); printf("%ld\n", tid); return EXIT_SUCCESS; }
user1203496
source share