[libc-commits] [libc] [libc] Implement statx in sys/stat (PR #240031)

Pavel Labath via libc-commits libc-commits at lists.llvm.org
Wed Nov 11 03:53:57 PST 2026


labath wrote:

I'm thinking about reusing the structure declarations from linux/stat.h, but I'd like a second (or a third) opinion. My thinking is that linux/stat.h is fairly self contained, and defines just the two structures, plus a bunch of constants (constants, which you'd need to redeclare in order to make parsing `struct statx` info possible. Including this from our sys-stat-macros.h seems reasonable.

fcntl-macros.h (which includes sys-stat-macros) to get file mode constants is slightly trickier, as ideally we'd want just those constants, instead of the whole package. Glibc avoids this by guarding the defining the macros itself (and the kernel guards these with `ifndef __GLIBC__`). We can't do that, but we can still include sys-stat-macros.h (or even linux/stat.h, to get a slightly narrower set of symbols). That exposes more than is strictly necessary, but is still within POSIX (which says we "may" do that). And it's not a big departure from status quo, since (as of #234438), we already expose some symbols which aren't stricly necessary.

https://github.com/llvm/llvm-project/pull/240031


More information about the libc-commits mailing list