carlos / platform Public

Clone
git clone https://amadan.net/carlos/platform

Plain git — no account needed to clone.

Download

Download this file

1//go:build !windows
2
3package console
4
5import "syscall"
6
7// scratchFree is the bytes available to the console on dir's filesystem.
8// Bavail times Bsize, multiplied once here (Bsize is int64 on Linux and
9// uint32 on darwin, internal/host/statfs_unix.go's note).
10func scratchFree(dir string) (int64, error) {
11 var st syscall.Statfs_t
12 if err := syscall.Statfs(dir, &st); err != nil {
13 return 0, err
14 }
15 return int64(uint64(st.Bavail) * uint64(st.Bsize)), nil
16}
17