You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

14 lines
270 B

//go:build linux
package capacity
import "golang.org/x/sys/unix"
func filesystemFreeBytes(path string) (int64, error) {
var stat unix.Statfs_t
if err := unix.Statfs(path, &stat); err != nil {
return 0, err
}
return int64(stat.Bavail) * int64(stat.Bsize), nil
}