|
|
Subscribe / Log in / New account

Time To Get Rid Of errno

Time To Get Rid Of errno

Posted Sep 23, 2015 3:24 UTC (Wed) by vapier (guest, #15768)
In reply to: Time To Get Rid Of errno by hrw
Parent article: Glibc wrappers for (nearly all) Linux system calls

you should use the symbols provided by the C library. stat() if you have a path string, fstat() if you have a fd, and fstatat() if you have a dir fd.

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)).


to post comments


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds