提交 ed92078b 编写于 作者: W WAKAYAMA Shirou

change Process to funcs on windows

上级 bc5f1da9
......@@ -70,23 +70,110 @@ func Pids() ([]int32, error) {
return ret, nil
}
func (p *Process) Ppid() (int32, error) {
return 0, nil
}
func (p *Process) Name() (string, error) {
name := ""
return name, nil
}
func (p *Process) Exe() (string, error) {
return "", nil
}
func (p *Process) Cmdline() (string, error) {
return "", nil
}
func (p *Process) Cwd() (string, error) {
return "", nil
}
func (p *Process) Parent() (*Process, error) {
return p, nil
}
func (p *Process) Status() (string, error) {
return "", nil
}
func (p *Process) Username() (string, error) {
return "", nil
}
func (p *Process) Uids() ([]int32, error) {
uids := make([]int32, 0)
return uids, nil
}
func (p *Process) Gids() ([]int32, error) {
gids := make([]int32, 0)
return gids, nil
}
func (p *Process) Terminal() (string, error) {
return "", nil
}
func (p *Process) Nice() (int32, error) {
return 0, nil
}
func (p *Process) Ionice() (int32, error) {
return 0, nil
}
func (p *Process) Rlimit() ([]RlimitStat, error) {
rlimit := make([]RlimitStat, 0)
return rlimit, nil
}
func (p *Process) Io_counters() (*Io_countersStat, error) {
return nil, nil
}
func (p *Process) Num_ctx_switches() (int32, error) {
return 0, nil
}
func (p *Process) Num_fds() (int32, error) {
return 0, nil
}
func (p *Process) Num_Threads() (int32, error) {
return 0, nil
}
func (p *Process) Threads() (map[string]string, error) {
ret := make(map[string]string, 0)
return ret, nil
}
func (p *Process) Cpu_times() (*CPU_TimesStat, error) {
return nil, nil
}
func (p *Process) Cpu_percent() (int32, error) {
return 0, nil
}
func (p *Process) Cpu_affinity() ([]int32, error) {
return nil, nil
}
func (p *Process) Memory_info() (*Memory_infoStat, error) {
return nil, nil
}
func (p *Process) Memory_info_ex() (*Memory_info_exStat, error) {
return nil, nil
}
func (p *Process) Memory_percent() (float32, error) {
return 0, nil
}
func (p *Process) Children() ([]*Process, error) {
return nil, nil
}
func (p *Process) Open_files() ([]Open_filesStat, error) {
return nil, nil
}
func (p *Process) Connections() ([]Net_connectionStat, error) {
return nil, nil
}
func (p *Process) Is_running() (bool, error) {
return true, nil
}
func (p *Process) Memory_Maps() (*[]Memory_mapsStat, error) {
ret := make([]Memory_mapsStat, 0)
return &ret, nil
return nil, nil
}
func NewProcess(pid int32) (*Process, error) {
p := &Process{Pid: pid}
if (pid == 0) || (pid == 4) {
p.Cmdline = ""
}
r, err := get_proc_info(pid)
if r == nil {
return p, err
}
return p, nil
}
......@@ -107,7 +194,7 @@ func (p *Process) Kill() error {
return nil
}
func copy_params(pe32 *PROCESSENTRY32, p *Process) error {
p.Ppid = int32(pe32.Th32ParentProcessID)
// p.Ppid = int32(pe32.Th32ParentProcessID)
return nil
}
......@@ -137,7 +224,6 @@ func processes() ([]*Process, error) {
if err != nil {
break
}
copy_params(&entry, p)
results = append(results, p)
ret, _, _ := procProcess32Next.Call(handle, uintptr(unsafe.Pointer(&entry)))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册