I am working in glibc and I need to get the id of the current thread. For this i use
syscall(SYS_gettid); Issue is, i am forced to include bits/syscall.h instead of ideal case i.e sys/syscall.h.
sys/syscall.h internally calls bits/syscall.h but that is wrapped with #ifndef _LIBC macro. i.e
#ifndef _LIBC
/* The Linux kernel header file defines macros `__NR_<name>', but some
programs expect the traditional form `SYS_<name>'. So in building libc
we scan the kernel's list and produce <bits/syscall.h> with macros for
all the `SYS_' names. */
# include <bits/syscall.h>
#endif
also bits/syscall.h states that
"Never use bits/syscall.h directly; include sys/syscall.h instead."
Since _LIBC will be defined in my case as i am writing code directly in malloc.c,
please suggest my how can i overcome this.
Thanks, Kapil