GCC使用glibc 2.30-8警告有关gettid()syscall包装器

man page and SO post#1/SO post#2 all suggest that gettid() was implemented in glibc 2.30. I think I am using GLIBC 2.30-8, according to ldd --version, but gcc still complains - warning: implicit declaration of function ‘gettid’; did you mean ‘getgid’? [-Wimplicit-function-declaration]. I can ignore the warning, and the program runs fine.

The header I tried to use with gettid() was <sys/types.h>, following the man page. Did I miss something?

Calling syscall(SYS_gettid) with header <sys/syscall.h> triggers no warning from gcc.

评论