0

There are some Linux system calls (e.g., gettid) which have no glibc wrapper and thus must be invoked via the syscall function.

Looking in /usr/include/x86_64-linux-gnu/bits/syscall.h, I see definitions like

#ifdef __NR_gettid
# define SYS_gettid __NR_gettid
#endif

What is the reason for two aliases for the same system call number? Is one more portable/stable? I guess my question boils down to: Which macro should I be using in my code?

Daniel Walker
  • 6,380
  • 5
  • 22
  • 45
  • https://stackoverflow.com/questions/9565177/call-gettid-witin-glibc – KamilCuk Dec 15 '22 at 02:29
  • 2
    AFAICT, the `SYS_*` macros are the traditional ones, whereas the `__NR_*` ones are a Linux kernel convention. I'd lean toward the `SYS` ones, myself. – Hasturkun Dec 15 '22 at 09:21

0 Answers0