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.

19 lines
342 B

  1. // +build !windows,!openbsd,!netbsd,!plan9
  2. package stats
  3. import (
  4. "syscall"
  5. )
  6. func (disk *DiskStatus) fillInStatus() {
  7. fs := syscall.Statfs_t{}
  8. err := syscall.Statfs(disk.Dir, &fs)
  9. if err != nil {
  10. return
  11. }
  12. disk.All = fs.Blocks * uint64(fs.Bsize)
  13. disk.Free = fs.Bfree * uint64(fs.Bsize)
  14. disk.Used = disk.All - disk.Free
  15. return
  16. }