add NotImplementedError as fixed variable.
This commit is contained in:
parent
d08c3d9b78
commit
594816dd1f
|
@ -12,8 +12,11 @@ import (
|
|||
"reflect"
|
||||
"strconv"
|
||||
"strings"
|
||||
"errors"
|
||||
)
|
||||
|
||||
var NotImplementedError = errors.New("not implemented yet")
|
||||
|
||||
// readLines read contents from file and split by new line.
|
||||
func readLines(filename string) ([]string, error) {
|
||||
f, err := os.Open(filename)
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
package gopsutil
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"syscall"
|
||||
"unsafe"
|
||||
)
|
||||
|
@ -83,7 +82,7 @@ func DiskPartitions(all bool) ([]DiskPartitionStat, error) {
|
|||
}
|
||||
|
||||
func DiskIOCounters() (map[string]DiskIOCountersStat, error) {
|
||||
return nil, errors.New("not implemented yet")
|
||||
return nil, NotImplementedError
|
||||
|
||||
// statinfo->devinfo->devstat
|
||||
// /usr/include/devinfo.h
|
||||
|
|
|
@ -4,7 +4,6 @@ package gopsutil
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"syscall"
|
||||
"unsafe"
|
||||
)
|
||||
|
@ -109,5 +108,5 @@ func DiskPartitions(all bool) ([]DiskPartitionStat, error) {
|
|||
|
||||
func DiskIOCounters() (map[string]DiskIOCountersStat, error) {
|
||||
ret := make(map[string]DiskIOCountersStat, 0)
|
||||
return ret, errors.New("not implemented yet")
|
||||
return ret, NotImplementedError
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
package gopsutil
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"net"
|
||||
"os"
|
||||
"syscall"
|
||||
|
@ -72,7 +71,7 @@ func NetIOCounters(pernic bool) ([]NetIOCountersStat, error) {
|
|||
func NetConnections(kind string) ([]NetConnectionStat, error) {
|
||||
var ret []NetConnectionStat
|
||||
|
||||
return ret, errors.New("not implemented yet")
|
||||
return ret, NotImplementedError
|
||||
}
|
||||
|
||||
// borrowed from src/pkg/net/interface_windows.go
|
||||
|
|
|
@ -5,7 +5,6 @@ package gopsutil
|
|||
import (
|
||||
"bytes"
|
||||
"encoding/binary"
|
||||
"errors"
|
||||
"syscall"
|
||||
"unsafe"
|
||||
)
|
||||
|
@ -48,19 +47,19 @@ func (p *Process) Name() (string, error) {
|
|||
return string(k.KiComm[:]), nil
|
||||
}
|
||||
func (p *Process) Exe() (string, error) {
|
||||
return "", errors.New("not implemented yet")
|
||||
return "", NotImplementedError
|
||||
}
|
||||
func (p *Process) Cmdline() (string, error) {
|
||||
return "", errors.New("not implemented yet")
|
||||
return "", NotImplementedError
|
||||
}
|
||||
func (p *Process) CreateTime() (int64, error) {
|
||||
return 0, errors.New("not implemented yet")
|
||||
return 0, NotImplementedError
|
||||
}
|
||||
func (p *Process) Cwd() (string, error) {
|
||||
return "", errors.New("not implemented yet")
|
||||
return "", NotImplementedError
|
||||
}
|
||||
func (p *Process) Parent() (*Process, error) {
|
||||
return p, errors.New("not implemented yet")
|
||||
return p, NotImplementedError
|
||||
}
|
||||
func (p *Process) Status() (string, error) {
|
||||
k, err := p.getKProc()
|
||||
|
@ -71,7 +70,7 @@ func (p *Process) Status() (string, error) {
|
|||
return string(k.KiStat[:]), nil
|
||||
}
|
||||
func (p *Process) Username() (string, error) {
|
||||
return "", errors.New("not implemented yet")
|
||||
return "", NotImplementedError
|
||||
}
|
||||
func (p *Process) Uids() ([]int32, error) {
|
||||
k, err := p.getKProc()
|
||||
|
@ -112,23 +111,23 @@ func (p *Process) Terminal() (string, error) {
|
|||
return termmap[ttyNr], nil
|
||||
}
|
||||
func (p *Process) Nice() (int32, error) {
|
||||
return 0, errors.New("not implemented yet")
|
||||
return 0, NotImplementedError
|
||||
}
|
||||
func (p *Process) IOnice() (int32, error) {
|
||||
return 0, errors.New("not implemented yet")
|
||||
return 0, NotImplementedError
|
||||
}
|
||||
func (p *Process) Rlimit() ([]RlimitStat, error) {
|
||||
var rlimit []RlimitStat
|
||||
return rlimit, errors.New("not implemented yet")
|
||||
return rlimit, NotImplementedError
|
||||
}
|
||||
func (p *Process) IOCounters() (*IOCountersStat, error) {
|
||||
return nil, errors.New("not implemented yet")
|
||||
return nil, NotImplementedError
|
||||
}
|
||||
func (p *Process) NumCtxSwitches() (*NumCtxSwitchesStat, error) {
|
||||
return nil, errors.New("not implemented yet")
|
||||
return nil, NotImplementedError
|
||||
}
|
||||
func (p *Process) NumFDs() (int32, error) {
|
||||
return 0, errors.New("not implemented yet")
|
||||
return 0, NotImplementedError
|
||||
}
|
||||
func (p *Process) NumThreads() (int32, error) {
|
||||
k, err := p.getKProc()
|
||||
|
@ -140,16 +139,16 @@ func (p *Process) NumThreads() (int32, error) {
|
|||
}
|
||||
func (p *Process) Threads() (map[string]string, error) {
|
||||
ret := make(map[string]string, 0)
|
||||
return ret, errors.New("not implemented yet")
|
||||
return ret, NotImplementedError
|
||||
}
|
||||
func (p *Process) CPUTimes() (*CPUTimesStat, error) {
|
||||
return nil, errors.New("not implemented yet")
|
||||
return nil, NotImplementedError
|
||||
}
|
||||
func (p *Process) CPUPercent() (int32, error) {
|
||||
return 0, errors.New("not implemented yet")
|
||||
return 0, NotImplementedError
|
||||
}
|
||||
func (p *Process) CPUAffinity() ([]int32, error) {
|
||||
return nil, errors.New("not implemented yet")
|
||||
return nil, NotImplementedError
|
||||
}
|
||||
func (p *Process) MemoryInfo() (*MemoryInfoStat, error) {
|
||||
k, err := p.getKProc()
|
||||
|
@ -165,30 +164,30 @@ func (p *Process) MemoryInfo() (*MemoryInfoStat, error) {
|
|||
return ret, nil
|
||||
}
|
||||
func (p *Process) MemoryInfoEx() (*MemoryInfoExStat, error) {
|
||||
return nil, errors.New("not implemented yet")
|
||||
return nil, NotImplementedError
|
||||
}
|
||||
func (p *Process) MemoryPercent() (float32, error) {
|
||||
return 0, errors.New("not implemented yet")
|
||||
return 0, NotImplementedError
|
||||
}
|
||||
|
||||
func (p *Process) Children() ([]*Process, error) {
|
||||
return nil, errors.New("not implemented yet")
|
||||
return nil, NotImplementedError
|
||||
}
|
||||
|
||||
func (p *Process) OpenFiles() ([]OpenFilesStat, error) {
|
||||
return nil, errors.New("not implemented yet")
|
||||
return nil, NotImplementedError
|
||||
}
|
||||
|
||||
func (p *Process) Connections() ([]NetConnectionStat, error) {
|
||||
return nil, errors.New("not implemented yet")
|
||||
return nil, NotImplementedError
|
||||
}
|
||||
|
||||
func (p *Process) IsRunning() (bool, error) {
|
||||
return true, errors.New("not implemented yet")
|
||||
return true, NotImplementedError
|
||||
}
|
||||
func (p *Process) MemoryMaps(grouped bool) (*[]MemoryMapsStat, error) {
|
||||
var ret []MemoryMapsStat
|
||||
return &ret, errors.New("not implemented yet")
|
||||
return &ret, NotImplementedError
|
||||
}
|
||||
|
||||
func copyParams(k *KinfoProc, p *Process) error {
|
||||
|
|
|
@ -4,7 +4,6 @@ package gopsutil
|
|||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
@ -93,7 +92,7 @@ func (p *Process) Cwd() (string, error) {
|
|||
return p.fillFromCwd()
|
||||
}
|
||||
func (p *Process) Parent() (*Process, error) {
|
||||
return nil, errors.New("not implemented yet")
|
||||
return nil, NotImplementedError
|
||||
}
|
||||
func (p *Process) Status() (string, error) {
|
||||
_, status, _, _, _, _, err := p.fillFromStatus()
|
||||
|
@ -134,10 +133,10 @@ func (p *Process) Nice() (int32, error) {
|
|||
return nice, nil
|
||||
}
|
||||
func (p *Process) IOnice() (int32, error) {
|
||||
return 0, errors.New("not implemented yet")
|
||||
return 0, NotImplementedError
|
||||
}
|
||||
func (p *Process) Rlimit() ([]RlimitStat, error) {
|
||||
return nil, errors.New("not implemented yet")
|
||||
return nil, NotImplementedError
|
||||
}
|
||||
func (p *Process) IOCounters() (*IOCountersStat, error) {
|
||||
return p.fillFromIO()
|
||||
|
@ -150,7 +149,7 @@ func (p *Process) NumCtxSwitches() (*NumCtxSwitchesStat, error) {
|
|||
return numCtxSwitches, nil
|
||||
}
|
||||
func (p *Process) NumFDs() (int32, error) {
|
||||
return 0, errors.New("not implemented yet")
|
||||
return 0, NotImplementedError
|
||||
}
|
||||
func (p *Process) NumThreads() (int32, error) {
|
||||
_, _, _, _, numThreads, _, err := p.fillFromStatus()
|
||||
|
@ -171,10 +170,10 @@ func (p *Process) CPUTimes() (*CPUTimesStat, error) {
|
|||
return cpuTimes, nil
|
||||
}
|
||||
func (p *Process) CPUPpercent() (int32, error) {
|
||||
return 0, errors.New("not implemented yet")
|
||||
return 0, NotImplementedError
|
||||
}
|
||||
func (p *Process) CPUAffinity() ([]int32, error) {
|
||||
return nil, errors.New("not implemented yet")
|
||||
return nil, NotImplementedError
|
||||
}
|
||||
func (p *Process) MemoryInfo() (*MemoryInfoStat, error) {
|
||||
memInfo, _, err := p.fillFromStatm()
|
||||
|
@ -191,23 +190,23 @@ func (p *Process) MemoryInfoEx() (*MemoryInfoExStat, error) {
|
|||
return memInfoEx, nil
|
||||
}
|
||||
func (p *Process) MemoryPercent() (float32, error) {
|
||||
return 0, errors.New("not implemented yet")
|
||||
return 0, NotImplementedError
|
||||
}
|
||||
|
||||
func (p *Process) Children() ([]*Process, error) {
|
||||
return nil, errors.New("not implemented yet")
|
||||
return nil, NotImplementedError
|
||||
}
|
||||
|
||||
func (p *Process) OpenFiles() ([]OpenFilesStat, error) {
|
||||
return nil, errors.New("not implemented yet")
|
||||
return nil, NotImplementedError
|
||||
}
|
||||
|
||||
func (p *Process) Connections() ([]NetConnectionStat, error) {
|
||||
return nil, errors.New("not implemented yet")
|
||||
return nil, NotImplementedError
|
||||
}
|
||||
|
||||
func (p *Process) IsRunning() (bool, error) {
|
||||
return true, errors.New("not implemented yet")
|
||||
return true, NotImplementedError
|
||||
}
|
||||
|
||||
// MemoryMaps get memory maps from /proc/(pid)/smaps
|
||||
|
|
|
@ -61,7 +61,7 @@ func (p *Process) Ppid() (int32, error) {
|
|||
}
|
||||
func (p *Process) Name() (string, error) {
|
||||
name := ""
|
||||
return name, errors.New("not implemented yet")
|
||||
return name, NotImplementedError
|
||||
}
|
||||
func (p *Process) Exe() (string, error) {
|
||||
_, _, ret, err := p.getFromSnapProcess(p.Pid)
|
||||
|
@ -71,51 +71,51 @@ func (p *Process) Exe() (string, error) {
|
|||
return ret, nil
|
||||
}
|
||||
func (p *Process) Cmdline() (string, error) {
|
||||
return "", errors.New("not implemented yet")
|
||||
return "", NotImplementedError
|
||||
}
|
||||
func (p *Process) Cwd() (string, error) {
|
||||
return "", errors.New("not implemented yet")
|
||||
return "", NotImplementedError
|
||||
}
|
||||
func (p *Process) Parent() (*Process, error) {
|
||||
return p, errors.New("not implemented yet")
|
||||
return p, NotImplementedError
|
||||
}
|
||||
func (p *Process) Status() (string, error) {
|
||||
return "", errors.New("not implemented yet")
|
||||
return "", NotImplementedError
|
||||
}
|
||||
func (p *Process) Username() (string, error) {
|
||||
return "", errors.New("not implemented yet")
|
||||
return "", NotImplementedError
|
||||
}
|
||||
func (p *Process) Uids() ([]int32, error) {
|
||||
var uids []int32
|
||||
|
||||
return uids, errors.New("not implemented yet")
|
||||
return uids, NotImplementedError
|
||||
}
|
||||
func (p *Process) Gids() ([]int32, error) {
|
||||
var gids []int32
|
||||
return gids, errors.New("not implemented yet")
|
||||
return gids, NotImplementedError
|
||||
}
|
||||
func (p *Process) Terminal() (string, error) {
|
||||
return "", errors.New("not implemented yet")
|
||||
return "", NotImplementedError
|
||||
}
|
||||
func (p *Process) Nice() (int32, error) {
|
||||
return 0, errors.New("not implemented yet")
|
||||
return 0, NotImplementedError
|
||||
}
|
||||
func (p *Process) IOnice() (int32, error) {
|
||||
return 0, errors.New("not implemented yet")
|
||||
return 0, NotImplementedError
|
||||
}
|
||||
func (p *Process) Rlimit() ([]RlimitStat, error) {
|
||||
var rlimit []RlimitStat
|
||||
|
||||
return rlimit, errors.New("not implemented yet")
|
||||
return rlimit, NotImplementedError
|
||||
}
|
||||
func (p *Process) IOCounters() (*IOCountersStat, error) {
|
||||
return nil, errors.New("not implemented yet")
|
||||
return nil, NotImplementedError
|
||||
}
|
||||
func (p *Process) NumCtxSwitches() (*NumCtxSwitchesStat, error) {
|
||||
return nil, errors.New("not implemented yet")
|
||||
return nil, NotImplementedError
|
||||
}
|
||||
func (p *Process) NumFDs() (int32, error) {
|
||||
return 0, errors.New("not implemented yet")
|
||||
return 0, NotImplementedError
|
||||
}
|
||||
func (p *Process) NumThreads() (int32, error) {
|
||||
_, ret, _, err := p.getFromSnapProcess(p.Pid)
|
||||
|
@ -126,46 +126,46 @@ func (p *Process) NumThreads() (int32, error) {
|
|||
}
|
||||
func (p *Process) Threads() (map[string]string, error) {
|
||||
ret := make(map[string]string, 0)
|
||||
return ret, errors.New("not implemented yet")
|
||||
return ret, NotImplementedError
|
||||
}
|
||||
func (p *Process) CPUTimes() (*CPUTimesStat, error) {
|
||||
return nil, errors.New("not implemented yet")
|
||||
return nil, NotImplementedError
|
||||
}
|
||||
func (p *Process) CPUPercent() (int32, error) {
|
||||
return 0, errors.New("not implemented yet")
|
||||
return 0, NotImplementedError
|
||||
}
|
||||
func (p *Process) CPUAffinity() ([]int32, error) {
|
||||
return nil, errors.New("not implemented yet")
|
||||
return nil, NotImplementedError
|
||||
}
|
||||
func (p *Process) MemoryInfo() (*MemoryInfoStat, error) {
|
||||
return nil, errors.New("not implemented yet")
|
||||
return nil, NotImplementedError
|
||||
}
|
||||
func (p *Process) MemoryInfoEx() (*MemoryInfoExStat, error) {
|
||||
return nil, errors.New("not implemented yet")
|
||||
return nil, NotImplementedError
|
||||
}
|
||||
func (p *Process) MemoryPercent() (float32, error) {
|
||||
return 0, errors.New("not implemented yet")
|
||||
return 0, NotImplementedError
|
||||
}
|
||||
|
||||
func (p *Process) Children() ([]*Process, error) {
|
||||
return nil, errors.New("not implemented yet")
|
||||
return nil, NotImplementedError
|
||||
}
|
||||
|
||||
func (p *Process) OpenFiles() ([]OpenFilesStat, error) {
|
||||
return nil, errors.New("not implemented yet")
|
||||
return nil, NotImplementedError
|
||||
}
|
||||
|
||||
func (p *Process) Connections() ([]NetConnectionStat, error) {
|
||||
return nil, errors.New("not implemented yet")
|
||||
return nil, NotImplementedError
|
||||
}
|
||||
|
||||
func (p *Process) IsRunning() (bool, error) {
|
||||
return true, errors.New("not implemented yet")
|
||||
return true, NotImplementedError
|
||||
}
|
||||
|
||||
func (p *Process) MemoryMaps(grouped bool) (*[]MemoryMapsStat, error) {
|
||||
ret := make([]MemoryMapsStat, 0)
|
||||
return &ret, errors.New("not implemented yet")
|
||||
return &ret, NotImplementedError
|
||||
}
|
||||
|
||||
func NewProcess(pid int32) (*Process, error) {
|
||||
|
@ -175,20 +175,20 @@ func NewProcess(pid int32) (*Process, error) {
|
|||
}
|
||||
|
||||
func (p *Process) SendSignal(sig syscall.Signal) error {
|
||||
return errors.New("not implemented yet")
|
||||
return NotImplementedError
|
||||
}
|
||||
|
||||
func (p *Process) Suspend() error {
|
||||
return errors.New("not implemented yet")
|
||||
return NotImplementedError
|
||||
}
|
||||
func (p *Process) Resume() error {
|
||||
return errors.New("not implemented yet")
|
||||
return NotImplementedError
|
||||
}
|
||||
func (p *Process) Terminate() error {
|
||||
return errors.New("not implemented yet")
|
||||
return NotImplementedError
|
||||
}
|
||||
func (p *Process) Kill() error {
|
||||
return errors.New("not implemented yet")
|
||||
return NotImplementedError
|
||||
}
|
||||
|
||||
func (p *Process) getFromSnapProcess(pid int32) (int32, int32, string, error) {
|
||||
|
|
Loading…
Reference in New Issue