Files
2026-09-12 23:26:07 +02:00

16 lines
345 B
Go

//go:build unix
package server
import "syscall"
// freeBytes reports the space available to an unprivileged writer on the
// filesystem holding path.
func freeBytes(path string) (int64, bool) {
var st syscall.Statfs_t
if err := syscall.Statfs(path, &st); err != nil {
return 0, false
}
return int64(st.Bavail) * int64(st.Bsize), true
}