9.26 gettid

int gettid(void);

This syscall returns the current thread id. It never fails.