nix icon indicating copy to clipboard operation
nix copied to clipboard

fstatfs and fstatvfs appear to have flipped documentation

Open ultrabear opened this issue 1 month ago • 1 comments

nix::sys::statfs is documented to state that

The result is OS-dependent. For a portable alternative, see [fstatvfs](https://docs.rs/nix/latest/nix/sys/statvfs/fn.fstatvfs.html).

However, statfs returns normalized rust number types while fstatvfs, the "portable" one, returns libc derived number types that differ in practice

Portability is most often read as "common interface with less user input", so this is confusing and inverted the order in which I used these functions (and indeed caused a build failure when we later tried to build on macos, oops!)

I can PR to fix the docs, but wanted to get visibility first to see if there was some intent in the docs that should be kept while disambiguating

ultrabear avatar Nov 13 '25 16:11 ultrabear

The more important difference is that statvfs is standardized. Its fields actually have the same meaning across differerent OSes. Whereas statfs is completely OS dependent. It doesn't even have the same fields everywhere.

asomers avatar Nov 13 '25 17:11 asomers