//go:build linux package webapp import ( "syscall" ) // statDisk fills Total/Free/Used for a DiskSample via statfs(2). // Linux-only because syscall.Statfs_t is platform-specific. Tests // that exercise the metric paths stub statDisk at the function // boundary so the build is hermetic. func statDisk(mount string, d *DiskSample) error { var st syscall.Statfs_t if err := syscall.Statfs(mount, &st); err != nil { return err } bsize := uint64(st.Frsize) total := st.Blocks * bsize free := st.Bavail * bsize used := total - free d.Total = total d.Free = free d.Used = used if total > 0 { d.UsedPct = pct(used, total) } return nil }