fix for overview panel

This commit is contained in:
onysd 2026-08-07 04:26:56 +03:00
parent 21d8e91756
commit d16f34070d
21 changed files with 920 additions and 40 deletions

View file

@ -0,0 +1,19 @@
//go:build !windows
package hoststats
import "golang.org/x/sys/unix"
// diskFreeBytes returns free (available to an unprivileged caller, not
// counting reserved blocks) and total bytes for the filesystem containing
// path. Mirrors internal/app/files/diskspace_unix.go's localDiskFreeBytes --
// duplicated locally rather than exported cross-package since this is a
// three-line syscall wrapper, not shared logic worth coupling two packages
// over.
func diskFreeBytes(path string) (free, total int64, err error) {
var st unix.Statfs_t
if err := unix.Statfs(path, &st); err != nil {
return 0, 0, err
}
return int64(st.Bavail) * int64(st.Bsize), int64(st.Blocks) * int64(st.Bsize), nil
}