Tonis Tiigi 6fcc6853d9
vendor: update buildkit to v0.17.0-rc2
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2024-10-28 15:39:50 -07:00

24 lines
489 B
Go

//go:build openbsd
// +build openbsd
package disk
import (
"syscall"
"github.com/pkg/errors"
)
func GetDiskStat(root string) (DiskStat, error) {
var st syscall.Statfs_t
if err := syscall.Statfs(root, &st); err != nil {
return DiskStat{}, errors.Wrapf(err, "could not stat fs at %s", root)
}
return DiskStat{
Total: int64(st.F_bsize) * int64(st.F_blocks),
Free: int64(st.F_bsize) * int64(st.F_bfree),
Available: int64(st.F_bsize) * int64(st.F_bavail),
}, nil
}