add windows stub.

This commit is contained in:
WAKAYAMA Shirou 2014-04-18 21:28:00 +09:00
parent 4ffbd2a28f
commit ce81975573
6 changed files with 84 additions and 0 deletions

14
cpu_windows.go Normal file
View File

@ -0,0 +1,14 @@
// +build windows
package main
import (
"fmt"
)
func (c CPU) Cpu_times() ([]CPU_Times, error) {
ret := make([]CPU_Times, 0)
fmt.Println("Windows")
return ret, nil
}

10
disk_windows.go Normal file
View File

@ -0,0 +1,10 @@
// +build windows
package main
func (d Disk) Disk_usage(path string) (Disk_usage, error) {
ret := Disk_usage{}
return ret, nil
}

17
host_unix.go Normal file
View File

@ -0,0 +1,17 @@
// +build linux freebsd
package main
import (
"os"
"syscall"
)
func (h Host) HostInfo() (HostInfo, error) {
ret := HostInfo{}
hostname, err := os.Hostname()
ret.Hostname = hostname
ret.Uptime = sysinfo.Uptime
return ret, nil
}

19
host_windows.go Normal file
View File

@ -0,0 +1,19 @@
// +build windows
package main
import (
"os"
)
func (h Host) HostInfo() (HostInfo, error) {
ret := HostInfo{}
hostname, err := os.Hostname()
if err != nil {
return ret, err
}
ret.Hostname = hostname
return ret, nil
}

9
load_windows.go Normal file
View File

@ -0,0 +1,9 @@
// +build windows
package main
func (l Load) LoadAvg() (LoadAvg, error) {
ret := LoadAvg{}
return ret, nil
}

15
mem_windows.go Normal file
View File

@ -0,0 +1,15 @@
// +build windows
package main
func (m Mem) Virtual_memory() (Virtual_memory, error) {
ret := Virtual_memory{}
return ret, nil
}
func (m Mem) Swap_memory() (Swap_memory, error) {
ret := Swap_memory{}
return ret, nil
}