Time To Get Rid Of errno
Time To Get Rid Of errno
Posted Aug 22, 2015 13:52 UTC (Sat) by hrw (subscriber, #44826)In reply to: Time To Get Rid Of errno by vapier
Parent article: Glibc wrappers for (nearly all) Linux system calls
Should I use __NR_stat, __NR_fstat, __NR_fstat64 or maybe __NR_newfstatat? Will my code run properly on all architectures if I use one of them or should I add some #ifdefs for architecture checks?
Even x86 has 3 architectures now (x86, x86-64, x32) which have different set of syscalls defined.
Posted Sep 23, 2015 3:24 UTC (Wed)
by vapier (guest, #15768)
[Link]
as for the syscalls you quoted, there are other stat variants (stat64 and fstatat64 at least). there's really no guarantee your code will compile or run properly when you call the syscalls directly. C libraries provide stable APIs/ABIs, including emulating newer functionality when the kernel is old (e.g. the *at syscalls could be emulated in userspace when the kernel was too old by utilizing /proc/self/fd/, but you'd have to call glibc's fstatat and not the kernel's syscall(__NR_newfstatat)).
Time To Get Rid Of errno