1
0
mirror of https://github.com/shirou/gopsutil.git synced 2025-05-04 22:17:34 +08:00

add Procs to Hostinfo by using mitchellh/go-ps.

This commit is contained in:
WAKAYAMA Shirou 2014-04-19 00:09:25 +09:00
parent 5fc807ed23
commit 8c60a8f8c5
2 changed files with 33 additions and 0 deletions

View File

@ -8,3 +8,5 @@ gopsutil: psutil for golang
- dstat: https://github.com/dagwieers/dstat
- gosiger: https://github.com/cloudfoundry/gosigar/
- goprocinfo: https://github.com/c9s/goprocinfo
- go-ps: https://github.com/mitchellh/go-ps

31
common_windows.go Normal file
View File

@ -0,0 +1,31 @@
// +build windows
package main
import (
"fmt"
"syscall"
)
type Proc struct {
Pid uint64
}
func GetProcList() ([]Proc, error) {
ret := make([]Proc, 0)
kernel32, err := syscall.LoadLibrary("kernel32.dll")
if err != nil {
return ret, err
}
defer syscall.FreeLibrary(kernel32)
Process32First, _ := syscall.GetProcAddress(kernel32, "Process32First")
// pFirst, _, err := syscall.Syscall(uintptr(Process32First), 0, 0, 0, 0)
pFirst, _, err := syscall.Syscall(uintptr(Process32First), 0, 0, 0, 0)
if err != nil {
return ret, err
}
fmt.Printf("Proc: %v\n", pFirst)
return ret, nil
}