Function nc::fstatfs

source ·
pub unsafe fn fstatfs(fd: i32, buf: &mut statfs_t) -> Result<(), Errno>
Expand description

Get filesystem statistics.

§Example

let path = "/usr";
// Open folder directly.
let fd = unsafe { nc::openat(nc::AT_FDCWD, path, nc::O_PATH, 0) };
assert!(fd.is_ok());
let fd = fd.unwrap();
let mut statfs = nc::statfs_t::default();
let ret = unsafe { nc::fstatfs(fd, &mut statfs) };
assert!(ret.is_ok());
assert!(statfs.f_bfree > 0);
assert!(statfs.f_bavail > 0);
let ret = unsafe { nc::close(fd) };
assert!(ret.is_ok());