diff --git a/README.rst b/README.rst index 9652d70..9e10247 100644 --- a/README.rst +++ b/README.rst @@ -16,6 +16,7 @@ Available archtectures - FreeBSD/amd64 - Linux/amd64 +- Linux/arm (raspberry pi) - Windows/amd64 (I do not have a darwin machine) diff --git a/host_linux.go b/host_linux.go index 3383a53..685e362 100644 --- a/host_linux.go +++ b/host_linux.go @@ -1,4 +1,4 @@ -// +build linux,amd64 +// +build linux package gopsutil @@ -28,7 +28,7 @@ func BootTime() (int64, error) { if err := syscall.Sysinfo(sysinfo); err != nil { return 0, err } - return sysinfo.Uptime, nil + return int64(sysinfo.Uptime), nil } func Users() ([]UserStat, error) { diff --git a/host_linux_arm.go b/host_linux_arm.go new file mode 100644 index 0000000..b1371fd --- /dev/null +++ b/host_linux_arm.go @@ -0,0 +1,27 @@ +// +build linux +// +build arm + +package gopsutil + +type exitStatus struct { + Etermination int16 // Process termination status. + Eexit int16 // Process exit status. +} +type timeval struct { + TvSec uint32 // Seconds. + TvUsec uint32 // Microseconds. +} + +type utmp struct { + UtType int16 // Type of login. + UtPid int32 // Process ID of login process. + UtLine [32]byte // Devicename. + UtID [4]byte // Inittab ID. + UtUser [32]byte // Username. + UtHost [256]byte // Hostname for remote login. + UtExit exitStatus // Exit status of a process marked + UtSession int32 // Session ID, used for windowing. + UtTv timeval // Time entry was made. + UtAddrV6 [16]byte // Internet address of remote host. + Unused [20]byte // Reserved for future use. // original is 20 +} diff --git a/mem_linux.go b/mem_linux.go index cfe1d0c..08cac37 100644 --- a/mem_linux.go +++ b/mem_linux.go @@ -44,8 +44,8 @@ func SwapMemory() (*SwapMemoryStat, error) { return nil, err } ret := &SwapMemoryStat{ - Total: sysinfo.Totalswap, - Free: sysinfo.Freeswap, + Total: uint64(sysinfo.Totalswap), + Free: uint64(sysinfo.Freeswap), } ret.Used = ret.Total - ret.Free ret.UsedPercent = float64(ret.Total-ret.Free) / float64(ret.Total) * 100.0 diff --git a/process_linux_arm.go b/process_linux_arm.go new file mode 100644 index 0000000..32cb260 --- /dev/null +++ b/process_linux_arm.go @@ -0,0 +1,9 @@ +// +build linux +// +build arm + +package gopsutil + +const ( + CLOCK_TICKS = 100 // C.sysconf(C._SC_CLK_TCK) + PAGESIZE = 4096 // C.sysconf(C._SC_PAGE_SIZE) +)