mirror of
https://github.com/ClementTsang/bottom.git
synced 2026-08-25 21:06:30 +00:00
don't use cached values
This commit is contained in:
@@ -117,7 +117,11 @@ fn mounts() -> CollectionResult<Vec<libc::statfs>> {
|
||||
|
||||
// SAFETY: System API FFI call. The buffer has capacity for `expected_len`
|
||||
// entries, and `bufsize` describes its size in bytes.
|
||||
let result = unsafe { libc::getfsstat(mounts.as_mut_ptr(), bufsize, libc::MNT_NOWAIT) };
|
||||
//
|
||||
// `MNT_WAIT` requests fresh statistics from each filesystem rather than
|
||||
// possibly-stale cached values (`MNT_NOWAIT`). This matches the default
|
||||
// behaviour of `df`, so the reported free/used space lines up with it.
|
||||
let result = unsafe { libc::getfsstat(mounts.as_mut_ptr(), bufsize, libc::MNT_WAIT) };
|
||||
if result < 0 {
|
||||
return Err(std::io::Error::last_os_error().into());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user