gunk-dev/the-valley

hostmem_linux.go

source601b054bc28emain's published tip history
263 bytes
1package main
2
3import "syscall"
4
5// hostMemory is the host's memory, in bytes.
6func hostMemory() (int64, error) {
7 var info syscall.Sysinfo_t
8 if err := syscall.Sysinfo(&info); err != nil {
9 return 0, err
10 }
11 return int64(info.Totalram) * int64(info.Unit), nil
12}