Skip to content

Instantly share code, notes, and snippets.

@sparrc
Created January 25, 2016 23:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sparrc/b1b4068141d192f95e54 to your computer and use it in GitHub Desktop.
Save sparrc/b1b4068141d192f95e54 to your computer and use it in GitHub Desktop.
Golang statfs
package main
import (
"fmt"
"syscall"
)
func main() {
stat := syscall.Statfs_t{}
err := syscall.Statfs("/", &stat)
if err != nil {
fmt.Println(err.Error())
return
}
//bsize := stat.Bsize
//fmt.Println(stat)
s := fmt.Sprintf(`
Statfs_t {
Type %d
Bsize %d
Blocks %d
Bfree %d
Bavail %d
Files %d
Ffree %d
Frsize %d
Flags %d
}
`, stat.Type,
stat.Bsize,
stat.Blocks,
stat.Bfree,
stat.Bavail,
stat.Files,
stat.Ffree,
stat.Frsize,
stat.Flags)
fmt.Println(s)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment