nix
nix copied to clipboard
Feature request: wrap Linux's `statx`
It has additional fourth "Birth time" for files.
This sounds like a reasonable addition. Would you care to submit a patch?
I can try, but I'm not sure it would be conformant to nix's standards.
How nix handles features available only in some (recent enough) Linux kernel versions?
We don't try to gate features based on kernel version. Rust links with --as-needed. That means if a binary crate that depends on nix doesn't use statx, then the resulting binary won't try to link that symbol at all. And if a binary crate does try to use statx, then it will either get a link error or get ENOSYS (if statx is a bare syscall, not wrapped by glibc). So from your perspective, there's little special care needed.
OK, I'll make a try.
How constants absent from libc should be handled (e.g. STATX_ATTR_DAX)?
Options:
- Omit from
nixuntillibcadds them (maybe also file a pull request to libc, but not wait for it to be merged); - Make a
nixpull request dependent onlibcpull request which adds additional values; - Hard code specific values within
nix, without usinglibc.
Also all statx-related things seem to be missing for musl target. Shall it be gated in nix as well or shall it be made independent instead?
My first attempt: #1660. Is it going in the correct direction or requires some substantial re-design?
The best way to handle constants that are missing in libc is to open a PR to add them to libc, and wait for that to merge before adding the functionality to Nix. And if musl lacks statx functionality, then simply disable it in Nix for musl targets. There should be plenty of examples of that.