pull/1783/merge
Matthieu MOREL 22 hours ago committed by GitHub
commit 4c32fefa98
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -95,7 +95,6 @@ linters-settings:
- name: unnecessary-stmt - name: unnecessary-stmt
- name: unreachable-code - name: unreachable-code
- name: unused-parameter - name: unused-parameter
disabled: true
- name: use-any - name: use-any
- name: var-declaration - name: var-declaration
- name: var-naming - name: var-naming

@ -59,7 +59,7 @@ func Times(percpu bool) ([]TimesStat, error) {
return TimesWithContext(context.Background(), percpu) return TimesWithContext(context.Background(), percpu)
} }
func TimesWithContext(ctx context.Context, percpu bool) ([]TimesStat, error) { func TimesWithContext(_ context.Context, percpu bool) ([]TimesStat, error) {
lib, err := common.NewLibrary(common.System) lib, err := common.NewLibrary(common.System)
if err != nil { if err != nil {
return nil, err return nil, err
@ -78,7 +78,7 @@ func Info() ([]InfoStat, error) {
return InfoWithContext(context.Background()) return InfoWithContext(context.Background())
} }
func InfoWithContext(ctx context.Context) ([]InfoStat, error) { func InfoWithContext(_ context.Context) ([]InfoStat, error) {
var ret []InfoStat var ret []InfoStat
c := InfoStat{} c := InfoStat{}
@ -121,7 +121,7 @@ func InfoWithContext(ctx context.Context) ([]InfoStat, error) {
return append(ret, c), nil return append(ret, c), nil
} }
func CountsWithContext(ctx context.Context, logical bool) (int, error) { func CountsWithContext(_ context.Context, logical bool) (int, error) {
var cpuArgument string var cpuArgument string
if logical { if logical {
cpuArgument = "hw.logicalcpu" cpuArgument = "hw.logicalcpu"

@ -51,7 +51,7 @@ func Times(percpu bool) ([]TimesStat, error) {
return TimesWithContext(context.Background(), percpu) return TimesWithContext(context.Background(), percpu)
} }
func TimesWithContext(ctx context.Context, percpu bool) ([]TimesStat, error) { func TimesWithContext(_ context.Context, percpu bool) ([]TimesStat, error) {
if percpu { if percpu {
buf, err := unix.SysctlRaw("kern.cp_times") buf, err := unix.SysctlRaw("kern.cp_times")
if err != nil { if err != nil {
@ -92,7 +92,7 @@ func Info() ([]InfoStat, error) {
return InfoWithContext(context.Background()) return InfoWithContext(context.Background())
} }
func InfoWithContext(ctx context.Context) ([]InfoStat, error) { func InfoWithContext(_ context.Context) ([]InfoStat, error) {
const dmesgBoot = "/var/run/dmesg.boot" const dmesgBoot = "/var/run/dmesg.boot"
c, err := parseDmesgBoot(dmesgBoot) c, err := parseDmesgBoot(dmesgBoot)
@ -153,6 +153,6 @@ func parseDmesgBoot(fileName string) (InfoStat, error) {
return c, nil return c, nil
} }
func CountsWithContext(ctx context.Context, logical bool) (int, error) { func CountsWithContext(_ context.Context, _ bool) (int, error) {
return runtime.NumCPU(), nil return runtime.NumCPU(), nil
} }

@ -52,7 +52,7 @@ func Times(percpu bool) ([]TimesStat, error) {
return TimesWithContext(context.Background(), percpu) return TimesWithContext(context.Background(), percpu)
} }
func TimesWithContext(ctx context.Context, percpu bool) ([]TimesStat, error) { func TimesWithContext(_ context.Context, percpu bool) ([]TimesStat, error) {
if percpu { if percpu {
buf, err := unix.SysctlRaw("kern.cp_times") buf, err := unix.SysctlRaw("kern.cp_times")
if err != nil { if err != nil {
@ -93,7 +93,7 @@ func Info() ([]InfoStat, error) {
return InfoWithContext(context.Background()) return InfoWithContext(context.Background())
} }
func InfoWithContext(ctx context.Context) ([]InfoStat, error) { func InfoWithContext(_ context.Context) ([]InfoStat, error) {
const dmesgBoot = "/var/run/dmesg.boot" const dmesgBoot = "/var/run/dmesg.boot"
c, num, err := parseDmesgBoot(dmesgBoot) c, num, err := parseDmesgBoot(dmesgBoot)
@ -165,6 +165,6 @@ func parseDmesgBoot(fileName string) (InfoStat, int, error) {
return c, cpuNum, nil return c, cpuNum, nil
} }
func CountsWithContext(ctx context.Context, logical bool) (int, error) { func CountsWithContext(_ context.Context, _ bool) (int, error) {
return runtime.NumCPU(), nil return runtime.NumCPU(), nil
} }

@ -36,7 +36,7 @@ func Times(percpu bool) ([]TimesStat, error) {
return TimesWithContext(context.Background(), percpu) return TimesWithContext(context.Background(), percpu)
} }
func TimesWithContext(ctx context.Context, percpu bool) (ret []TimesStat, err error) { func TimesWithContext(_ context.Context, percpu bool) (ret []TimesStat, err error) {
if !percpu { if !percpu {
mib := []int32{ctlKern, kernCpTime} mib := []int32{ctlKern, kernCpTime}
buf, _, err := common.CallSyscall(mib) buf, _, err := common.CallSyscall(mib)
@ -87,7 +87,7 @@ func Info() ([]InfoStat, error) {
return InfoWithContext(context.Background()) return InfoWithContext(context.Background())
} }
func InfoWithContext(ctx context.Context) ([]InfoStat, error) { func InfoWithContext(_ context.Context) ([]InfoStat, error) {
var ret []InfoStat var ret []InfoStat
var err error var err error
@ -115,6 +115,6 @@ func InfoWithContext(ctx context.Context) ([]InfoStat, error) {
return append(ret, c), nil return append(ret, c), nil
} }
func CountsWithContext(ctx context.Context, logical bool) (int, error) { func CountsWithContext(_ context.Context, _ bool) (int, error) {
return runtime.NumCPU(), nil return runtime.NumCPU(), nil
} }

@ -54,7 +54,7 @@ func Times(percpu bool) ([]TimesStat, error) {
return TimesWithContext(context.Background(), percpu) return TimesWithContext(context.Background(), percpu)
} }
func TimesWithContext(ctx context.Context, percpu bool) (ret []TimesStat, err error) { func TimesWithContext(_ context.Context, percpu bool) (ret []TimesStat, err error) {
if !percpu { if !percpu {
mib := []int32{ctlKern, kernCpTime} mib := []int32{ctlKern, kernCpTime}
buf, _, err := common.CallSyscall(mib) buf, _, err := common.CallSyscall(mib)
@ -108,7 +108,7 @@ func Info() ([]InfoStat, error) {
return InfoWithContext(context.Background()) return InfoWithContext(context.Background())
} }
func InfoWithContext(ctx context.Context) ([]InfoStat, error) { func InfoWithContext(_ context.Context) ([]InfoStat, error) {
var ret []InfoStat var ret []InfoStat
var err error var err error
@ -133,6 +133,6 @@ func InfoWithContext(ctx context.Context) ([]InfoStat, error) {
return append(ret, c), nil return append(ret, c), nil
} }
func CountsWithContext(ctx context.Context, logical bool) (int, error) { func CountsWithContext(_ context.Context, _ bool) (int, error) {
return runtime.NumCPU(), nil return runtime.NumCPU(), nil
} }

@ -17,7 +17,7 @@ func Times(percpu bool) ([]TimesStat, error) {
return TimesWithContext(context.Background(), percpu) return TimesWithContext(context.Background(), percpu)
} }
func TimesWithContext(ctx context.Context, percpu bool) ([]TimesStat, error) { func TimesWithContext(ctx context.Context, _ bool) ([]TimesStat, error) {
// BUG: percpu flag is not supported yet. // BUG: percpu flag is not supported yet.
root := os.Getenv("HOST_ROOT") root := os.Getenv("HOST_ROOT")
c, err := stats.ReadCPUType(ctx, stats.WithRootDir(root)) c, err := stats.ReadCPUType(ctx, stats.WithRootDir(root))
@ -42,10 +42,10 @@ func Info() ([]InfoStat, error) {
return InfoWithContext(context.Background()) return InfoWithContext(context.Background())
} }
func InfoWithContext(ctx context.Context) ([]InfoStat, error) { func InfoWithContext(_ context.Context) ([]InfoStat, error) {
return []InfoStat{}, common.ErrNotImplementedError return []InfoStat{}, common.ErrNotImplementedError
} }
func CountsWithContext(ctx context.Context, logical bool) (int, error) { func CountsWithContext(_ context.Context, _ bool) (int, error) {
return runtime.NumCPU(), nil return runtime.NumCPU(), nil
} }

@ -265,6 +265,6 @@ func parseProcessorInfo(cmdOutput string) ([]InfoStat, error) {
return result, nil return result, nil
} }
func CountsWithContext(ctx context.Context, logical bool) (int, error) { func CountsWithContext(_ context.Context, _ bool) (int, error) {
return runtime.NumCPU(), nil return runtime.NumCPU(), nil
} }

@ -58,7 +58,7 @@ func Times(percpu bool) ([]TimesStat, error) {
return TimesWithContext(context.Background(), percpu) return TimesWithContext(context.Background(), percpu)
} }
func TimesWithContext(ctx context.Context, percpu bool) ([]TimesStat, error) { func TimesWithContext(_ context.Context, percpu bool) ([]TimesStat, error) {
if percpu { if percpu {
return perCPUTimes() return perCPUTimes()
} }

@ -16,7 +16,7 @@ import (
// PartitionsWithContext returns disk partition. // PartitionsWithContext returns disk partition.
// 'all' argument is ignored, see: https://github.com/giampaolo/psutil/issues/906 // 'all' argument is ignored, see: https://github.com/giampaolo/psutil/issues/906
func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, error) { func PartitionsWithContext(_ context.Context, _ bool) ([]PartitionStat, error) {
var ret []PartitionStat var ret []PartitionStat
count, err := unix.Getfsstat(nil, unix.MNT_WAIT) count, err := unix.Getfsstat(nil, unix.MNT_WAIT)
@ -88,15 +88,15 @@ func getFsType(stat unix.Statfs_t) string {
return common.ByteToString(stat.Fstypename[:]) return common.ByteToString(stat.Fstypename[:])
} }
func SerialNumberWithContext(ctx context.Context, name string) (string, error) { func SerialNumberWithContext(_ context.Context, _ string) (string, error) {
return "", common.ErrNotImplementedError return "", common.ErrNotImplementedError
} }
func LabelWithContext(ctx context.Context, name string) (string, error) { func LabelWithContext(_ context.Context, _ string) (string, error) {
return "", common.ErrNotImplementedError return "", common.ErrNotImplementedError
} }
func IOCountersWithContext(ctx context.Context, names ...string) (map[string]IOCountersStat, error) { func IOCountersWithContext(_ context.Context, names ...string) (map[string]IOCountersStat, error) {
ioKit, err := common.NewLibrary(common.IOKit) ioKit, err := common.NewLibrary(common.IOKit)
if err != nil { if err != nil {
return nil, err return nil, err

@ -9,22 +9,22 @@ import (
"github.com/shirou/gopsutil/v4/internal/common" "github.com/shirou/gopsutil/v4/internal/common"
) )
func IOCountersWithContext(ctx context.Context, names ...string) (map[string]IOCountersStat, error) { func IOCountersWithContext(_ context.Context, _ ...string) (map[string]IOCountersStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, error) { func PartitionsWithContext(_ context.Context, _ bool) ([]PartitionStat, error) {
return []PartitionStat{}, common.ErrNotImplementedError return []PartitionStat{}, common.ErrNotImplementedError
} }
func UsageWithContext(ctx context.Context, path string) (*UsageStat, error) { func UsageWithContext(_ context.Context, _ string) (*UsageStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func SerialNumberWithContext(ctx context.Context, name string) (string, error) { func SerialNumberWithContext(_ context.Context, _ string) (string, error) {
return "", common.ErrNotImplementedError return "", common.ErrNotImplementedError
} }
func LabelWithContext(ctx context.Context, name string) (string, error) { func LabelWithContext(_ context.Context, _ string) (string, error) {
return "", common.ErrNotImplementedError return "", common.ErrNotImplementedError
} }

@ -19,7 +19,7 @@ import (
// PartitionsWithContext returns disk partition. // PartitionsWithContext returns disk partition.
// 'all' argument is ignored, see: https://github.com/giampaolo/psutil/issues/906 // 'all' argument is ignored, see: https://github.com/giampaolo/psutil/issues/906
func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, error) { func PartitionsWithContext(_ context.Context, _ bool) ([]PartitionStat, error) {
var ret []PartitionStat var ret []PartitionStat
// get length // get length
@ -188,6 +188,6 @@ func SerialNumberWithContext(ctx context.Context, name string) (string, error) {
return serial, nil return serial, nil
} }
func LabelWithContext(ctx context.Context, name string) (string, error) { func LabelWithContext(_ context.Context, _ string) (string, error) {
return "", common.ErrNotImplementedError return "", common.ErrNotImplementedError
} }

@ -24,7 +24,7 @@ const (
MNT_SOFTDEP = 0x80000000 /* Use soft dependencies */ MNT_SOFTDEP = 0x80000000 /* Use soft dependencies */
) )
func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, error) { func PartitionsWithContext(_ context.Context, _ bool) ([]PartitionStat, error) {
var ret []PartitionStat var ret []PartitionStat
flag := uint64(1) // ST_WAIT/MNT_WAIT, see sys/fstypes.h flag := uint64(1) // ST_WAIT/MNT_WAIT, see sys/fstypes.h
@ -97,12 +97,12 @@ func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, erro
return ret, nil return ret, nil
} }
func IOCountersWithContext(ctx context.Context, names ...string) (map[string]IOCountersStat, error) { func IOCountersWithContext(_ context.Context, _ ...string) (map[string]IOCountersStat, error) {
ret := make(map[string]IOCountersStat) ret := make(map[string]IOCountersStat)
return ret, common.ErrNotImplementedError return ret, common.ErrNotImplementedError
} }
func UsageWithContext(ctx context.Context, path string) (*UsageStat, error) { func UsageWithContext(_ context.Context, path string) (*UsageStat, error) {
stat := Statvfs{} stat := Statvfs{}
flag := uint64(1) // ST_WAIT/MNT_WAIT, see sys/fstypes.h flag := uint64(1) // ST_WAIT/MNT_WAIT, see sys/fstypes.h
@ -144,10 +144,10 @@ func getFsType(stat Statvfs) string {
return common.ByteToString(stat.Fstypename[:]) return common.ByteToString(stat.Fstypename[:])
} }
func SerialNumberWithContext(ctx context.Context, name string) (string, error) { func SerialNumberWithContext(_ context.Context, _ string) (string, error) {
return "", common.ErrNotImplementedError return "", common.ErrNotImplementedError
} }
func LabelWithContext(ctx context.Context, name string) (string, error) { func LabelWithContext(_ context.Context, _ string) (string, error) {
return "", common.ErrNotImplementedError return "", common.ErrNotImplementedError
} }

@ -13,7 +13,7 @@ import (
"github.com/shirou/gopsutil/v4/internal/common" "github.com/shirou/gopsutil/v4/internal/common"
) )
func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, error) { func PartitionsWithContext(_ context.Context, _ bool) ([]PartitionStat, error) {
var ret []PartitionStat var ret []PartitionStat
// get length // get length
@ -70,7 +70,7 @@ func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, erro
return ret, nil return ret, nil
} }
func IOCountersWithContext(ctx context.Context, names ...string) (map[string]IOCountersStat, error) { func IOCountersWithContext(_ context.Context, names ...string) (map[string]IOCountersStat, error) {
ret := make(map[string]IOCountersStat) ret := make(map[string]IOCountersStat)
r, err := unix.SysctlRaw("hw.diskstats") r, err := unix.SysctlRaw("hw.diskstats")
@ -122,7 +122,7 @@ func parseDiskstats(buf []byte) (Diskstats, error) {
return ds, nil return ds, nil
} }
func UsageWithContext(ctx context.Context, path string) (*UsageStat, error) { func UsageWithContext(_ context.Context, path string) (*UsageStat, error) {
stat := unix.Statfs_t{} stat := unix.Statfs_t{}
err := unix.Statfs(path, &stat) err := unix.Statfs(path, &stat)
if err != nil { if err != nil {
@ -151,10 +151,10 @@ func getFsType(stat unix.Statfs_t) string {
return common.ByteToString(stat.F_fstypename[:]) return common.ByteToString(stat.F_fstypename[:])
} }
func SerialNumberWithContext(ctx context.Context, name string) (string, error) { func SerialNumberWithContext(_ context.Context, _ string) (string, error) {
return "", common.ErrNotImplementedError return "", common.ErrNotImplementedError
} }
func LabelWithContext(ctx context.Context, name string) (string, error) { func LabelWithContext(_ context.Context, _ string) (string, error) {
return "", common.ErrNotImplementedError return "", common.ErrNotImplementedError
} }

@ -44,7 +44,7 @@ var fsTypeBlacklist = map[string]struct{}{
"proc": {}, "proc": {},
} }
func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, error) { func PartitionsWithContext(_ context.Context, _ bool) ([]PartitionStat, error) {
ret := make([]PartitionStat, 0, _DEFAULT_NUM_MOUNTS) ret := make([]PartitionStat, 0, _DEFAULT_NUM_MOUNTS)
// Scan mnttab(4) // Scan mnttab(4)
@ -199,7 +199,7 @@ func IOCountersWithContext(ctx context.Context, names ...string) (map[string]IOC
return ret, nil return ret, nil
} }
func UsageWithContext(ctx context.Context, path string) (*UsageStat, error) { func UsageWithContext(_ context.Context, path string) (*UsageStat, error) {
statvfs := unix.Statvfs_t{} statvfs := unix.Statvfs_t{}
if err := unix.Statvfs(path, &statvfs); err != nil { if err := unix.Statvfs(path, &statvfs); err != nil {
return nil, fmt.Errorf("unable to call statvfs(2) on %q: %w", path, err) return nil, fmt.Errorf("unable to call statvfs(2) on %q: %w", path, err)
@ -258,6 +258,6 @@ func SerialNumberWithContext(ctx context.Context, name string) (string, error) {
return "", nil return "", nil
} }
func LabelWithContext(ctx context.Context, name string) (string, error) { func LabelWithContext(_ context.Context, _ string) (string, error) {
return "", common.ErrNotImplementedError return "", common.ErrNotImplementedError
} }

@ -10,7 +10,7 @@ import (
"golang.org/x/sys/unix" "golang.org/x/sys/unix"
) )
func UsageWithContext(ctx context.Context, path string) (*UsageStat, error) { func UsageWithContext(_ context.Context, path string) (*UsageStat, error) {
stat := unix.Statfs_t{} stat := unix.Statfs_t{}
err := unix.Statfs(path, &stat) err := unix.Statfs(path, &stat)
if err != nil { if err != nil {

@ -55,7 +55,7 @@ func init() {
} }
} }
func UsageWithContext(ctx context.Context, path string) (*UsageStat, error) { func UsageWithContext(_ context.Context, path string) (*UsageStat, error) {
lpFreeBytesAvailable := int64(0) lpFreeBytesAvailable := int64(0)
lpTotalNumberOfBytes := int64(0) lpTotalNumberOfBytes := int64(0)
lpTotalNumberOfFreeBytes := int64(0) lpTotalNumberOfFreeBytes := int64(0)
@ -83,7 +83,7 @@ func UsageWithContext(ctx context.Context, path string) (*UsageStat, error) {
// PartitionsWithContext returns disk partitions. // PartitionsWithContext returns disk partitions.
// Since GetVolumeInformation doesn't have a timeout, this method uses context to set deadline by users. // Since GetVolumeInformation doesn't have a timeout, this method uses context to set deadline by users.
func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, error) { func PartitionsWithContext(ctx context.Context, _ bool) ([]PartitionStat, error) {
warnings := Warnings{ warnings := Warnings{
Verbose: true, Verbose: true,
} }
@ -182,7 +182,7 @@ func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, erro
} }
} }
func IOCountersWithContext(ctx context.Context, names ...string) (map[string]IOCountersStat, error) { func IOCountersWithContext(_ context.Context, names ...string) (map[string]IOCountersStat, error) {
// https://github.com/giampaolo/psutil/blob/544e9daa4f66a9f80d7bf6c7886d693ee42f0a13/psutil/arch/windows/disk.c#L83 // https://github.com/giampaolo/psutil/blob/544e9daa4f66a9f80d7bf6c7886d693ee42f0a13/psutil/arch/windows/disk.c#L83
drivemap := make(map[string]IOCountersStat, 0) drivemap := make(map[string]IOCountersStat, 0)
var diskPerformance diskPerformance var diskPerformance diskPerformance
@ -236,10 +236,10 @@ func IOCountersWithContext(ctx context.Context, names ...string) (map[string]IOC
return drivemap, nil return drivemap, nil
} }
func SerialNumberWithContext(ctx context.Context, name string) (string, error) { func SerialNumberWithContext(_ context.Context, _ string) (string, error) {
return "", common.ErrNotImplementedError return "", common.ErrNotImplementedError
} }
func LabelWithContext(ctx context.Context, name string) (string, error) { func LabelWithContext(_ context.Context, _ string) (string, error) {
return "", common.ErrNotImplementedError return "", common.ErrNotImplementedError
} }

@ -8,7 +8,7 @@ import (
"testing" "testing"
) )
func TestGetDockerIDList(t *testing.T) { func TestGetDockerIDList(_ *testing.T) {
// If there is not docker environment, this test always fail. // If there is not docker environment, this test always fail.
// not tested here // not tested here
/* /*
@ -19,7 +19,7 @@ func TestGetDockerIDList(t *testing.T) {
*/ */
} }
func TestGetDockerStat(t *testing.T) { func TestGetDockerStat(_ *testing.T) {
// If there is not docker environment, this test always fail. // If there is not docker environment, this test always fail.
// not tested here // not tested here

@ -15,7 +15,7 @@ func GetDockerStat() ([]CgroupDockerStat, error) {
return GetDockerStatWithContext(context.Background()) return GetDockerStatWithContext(context.Background())
} }
func GetDockerStatWithContext(ctx context.Context) ([]CgroupDockerStat, error) { func GetDockerStatWithContext(_ context.Context) ([]CgroupDockerStat, error) {
return nil, ErrDockerNotAvailable return nil, ErrDockerNotAvailable
} }
@ -25,7 +25,7 @@ func GetDockerIDList() ([]string, error) {
return GetDockerIDListWithContext(context.Background()) return GetDockerIDListWithContext(context.Background())
} }
func GetDockerIDListWithContext(ctx context.Context) ([]string, error) { func GetDockerIDListWithContext(_ context.Context) ([]string, error) {
return nil, ErrDockerNotAvailable return nil, ErrDockerNotAvailable
} }
@ -37,7 +37,7 @@ func CgroupCPU(containerid string, base string) (*CgroupCPUStat, error) {
return CgroupCPUWithContext(context.Background(), containerid, base) return CgroupCPUWithContext(context.Background(), containerid, base)
} }
func CgroupCPUWithContext(ctx context.Context, containerid string, base string) (*CgroupCPUStat, error) { func CgroupCPUWithContext(_ context.Context, _ string, _ string) (*CgroupCPUStat, error) {
return nil, ErrCgroupNotAvailable return nil, ErrCgroupNotAvailable
} }
@ -53,7 +53,7 @@ func CgroupMem(containerid string, base string) (*CgroupMemStat, error) {
return CgroupMemWithContext(context.Background(), containerid, base) return CgroupMemWithContext(context.Background(), containerid, base)
} }
func CgroupMemWithContext(ctx context.Context, containerid string, base string) (*CgroupMemStat, error) { func CgroupMemWithContext(_ context.Context, _ string, _ string) (*CgroupMemStat, error) {
return nil, ErrCgroupNotAvailable return nil, ErrCgroupNotAvailable
} }

@ -6,7 +6,7 @@ import (
"testing" "testing"
) )
func TestSysAdvancedDockerInfo(t *testing.T) { func TestSysAdvancedDockerInfo(_ *testing.T) {
list, err := GetDockerIDList() list, err := GetDockerIDList()
if err != nil { if err != nil {
fmt.Println(err) fmt.Println(err)

@ -13,7 +13,7 @@ import (
// cachedBootTime must be accessed via atomic.Load/StoreUint64 // cachedBootTime must be accessed via atomic.Load/StoreUint64
var cachedBootTime uint64 var cachedBootTime uint64
func BootTimeWithContext(ctx context.Context) (uint64, error) { func BootTimeWithContext(_ context.Context) (uint64, error) {
if enableBootTimeCache { if enableBootTimeCache {
t := atomic.LoadUint64(&cachedBootTime) t := atomic.LoadUint64(&cachedBootTime)
if t != 0 { if t != 0 {

@ -49,7 +49,7 @@ func numProcs(ctx context.Context) (uint64, error) {
return uint64(len(procs)), nil return uint64(len(procs)), nil
} }
func UsersWithContext(ctx context.Context) ([]UserStat, error) { func UsersWithContext(_ context.Context) ([]UserStat, error) {
utmpfile := "/var/run/utmpx" utmpfile := "/var/run/utmpx"
var ret []UserStat var ret []UserStat
@ -123,11 +123,11 @@ func PlatformInformationWithContext(ctx context.Context) (string, string, string
return platform, family, pver, nil return platform, family, pver, nil
} }
func VirtualizationWithContext(ctx context.Context) (string, string, error) { func VirtualizationWithContext(_ context.Context) (string, string, error) {
return "", "", common.ErrNotImplementedError return "", "", common.ErrNotImplementedError
} }
func KernelVersionWithContext(ctx context.Context) (string, error) { func KernelVersionWithContext(_ context.Context) (string, error) {
version, err := unix.Sysctl("kern.osrelease") version, err := unix.Sysctl("kern.osrelease")
return strings.ToLower(version), err return strings.ToLower(version), err
} }

@ -9,35 +9,35 @@ import (
"github.com/shirou/gopsutil/v4/internal/common" "github.com/shirou/gopsutil/v4/internal/common"
) )
func HostIDWithContext(ctx context.Context) (string, error) { func HostIDWithContext(_ context.Context) (string, error) {
return "", common.ErrNotImplementedError return "", common.ErrNotImplementedError
} }
func numProcs(ctx context.Context) (uint64, error) { func numProcs(_ context.Context) (uint64, error) {
return 0, common.ErrNotImplementedError return 0, common.ErrNotImplementedError
} }
func BootTimeWithContext(ctx context.Context) (uint64, error) { func BootTimeWithContext(_ context.Context) (uint64, error) {
return 0, common.ErrNotImplementedError return 0, common.ErrNotImplementedError
} }
func UptimeWithContext(ctx context.Context) (uint64, error) { func UptimeWithContext(_ context.Context) (uint64, error) {
return 0, common.ErrNotImplementedError return 0, common.ErrNotImplementedError
} }
func UsersWithContext(ctx context.Context) ([]UserStat, error) { func UsersWithContext(_ context.Context) ([]UserStat, error) {
return []UserStat{}, common.ErrNotImplementedError return []UserStat{}, common.ErrNotImplementedError
} }
func VirtualizationWithContext(ctx context.Context) (string, string, error) { func VirtualizationWithContext(_ context.Context) (string, string, error) {
return "", "", common.ErrNotImplementedError return "", "", common.ErrNotImplementedError
} }
func KernelVersionWithContext(ctx context.Context) (string, error) { func KernelVersionWithContext(_ context.Context) (string, error) {
return "", common.ErrNotImplementedError return "", common.ErrNotImplementedError
} }
func PlatformInformationWithContext(ctx context.Context) (string, string, string, error) { func PlatformInformationWithContext(_ context.Context) (string, string, string, error) {
return "", "", "", common.ErrNotImplementedError return "", "", "", common.ErrNotImplementedError
} }

@ -25,7 +25,7 @@ const (
UTHostSize = 16 UTHostSize = 16
) )
func HostIDWithContext(ctx context.Context) (string, error) { func HostIDWithContext(_ context.Context) (string, error) {
uuid, err := unix.Sysctl("kern.hostuuid") uuid, err := unix.Sysctl("kern.hostuuid")
if err != nil { if err != nil {
return "", err return "", err
@ -41,7 +41,7 @@ func numProcs(ctx context.Context) (uint64, error) {
return uint64(len(procs)), nil return uint64(len(procs)), nil
} }
func UsersWithContext(ctx context.Context) ([]UserStat, error) { func UsersWithContext(_ context.Context) ([]UserStat, error) {
utmpfile := "/var/run/utx.active" utmpfile := "/var/run/utx.active"
if !common.PathExists(utmpfile) { if !common.PathExists(utmpfile) {
utmpfile = "/var/run/utmp" // before 9.0 utmpfile = "/var/run/utmp" // before 9.0
@ -85,7 +85,7 @@ func UsersWithContext(ctx context.Context) ([]UserStat, error) {
return ret, nil return ret, nil
} }
func PlatformInformationWithContext(ctx context.Context) (string, string, string, error) { func PlatformInformationWithContext(_ context.Context) (string, string, string, error) {
platform, err := unix.Sysctl("kern.ostype") platform, err := unix.Sysctl("kern.ostype")
if err != nil { if err != nil {
return "", "", "", err return "", "", "", err
@ -99,7 +99,7 @@ func PlatformInformationWithContext(ctx context.Context) (string, string, string
return strings.ToLower(platform), "", strings.ToLower(version), nil return strings.ToLower(platform), "", strings.ToLower(version), nil
} }
func VirtualizationWithContext(ctx context.Context) (string, string, error) { func VirtualizationWithContext(_ context.Context) (string, string, error) {
return "", "", common.ErrNotImplementedError return "", "", common.ErrNotImplementedError
} }

@ -70,7 +70,7 @@ func BootTimeWithContext(ctx context.Context) (uint64, error) {
return common.BootTimeWithContext(ctx, enableBootTimeCache) return common.BootTimeWithContext(ctx, enableBootTimeCache)
} }
func UptimeWithContext(ctx context.Context) (uint64, error) { func UptimeWithContext(_ context.Context) (uint64, error) {
sysinfo := &unix.Sysinfo_t{} sysinfo := &unix.Sysinfo_t{}
if err := unix.Sysinfo(sysinfo); err != nil { if err := unix.Sysinfo(sysinfo); err != nil {
return 0, err return 0, err
@ -322,7 +322,7 @@ func PlatformInformationWithContext(ctx context.Context) (platform string, famil
return platform, family, version, nil return platform, family, version, nil
} }
func KernelVersionWithContext(ctx context.Context) (version string, err error) { func KernelVersionWithContext(_ context.Context) (version string, err error) {
var utsname unix.Utsname var utsname unix.Utsname
err = unix.Uname(&utsname) err = unix.Uname(&utsname)
if err != nil { if err != nil {

@ -12,15 +12,15 @@ import (
"github.com/shirou/gopsutil/v4/internal/common" "github.com/shirou/gopsutil/v4/internal/common"
) )
func HostIDWithContext(ctx context.Context) (string, error) { func HostIDWithContext(_ context.Context) (string, error) {
return "", common.ErrNotImplementedError return "", common.ErrNotImplementedError
} }
func numProcs(ctx context.Context) (uint64, error) { func numProcs(_ context.Context) (uint64, error) {
return 0, common.ErrNotImplementedError return 0, common.ErrNotImplementedError
} }
func PlatformInformationWithContext(ctx context.Context) (string, string, string, error) { func PlatformInformationWithContext(_ context.Context) (string, string, string, error) {
platform := "" platform := ""
family := "" family := ""
version := "" version := ""
@ -37,11 +37,11 @@ func PlatformInformationWithContext(ctx context.Context) (string, string, string
return platform, family, version, nil return platform, family, version, nil
} }
func VirtualizationWithContext(ctx context.Context) (string, string, error) { func VirtualizationWithContext(_ context.Context) (string, string, error) {
return "", "", common.ErrNotImplementedError return "", "", common.ErrNotImplementedError
} }
func UsersWithContext(ctx context.Context) ([]UserStat, error) { func UsersWithContext(_ context.Context) ([]UserStat, error) {
var ret []UserStat var ret []UserStat
return ret, common.ErrNotImplementedError return ret, common.ErrNotImplementedError
} }

@ -24,7 +24,7 @@ const (
UTHostSize = 16 UTHostSize = 16
) )
func HostIDWithContext(ctx context.Context) (string, error) { func HostIDWithContext(_ context.Context) (string, error) {
return "", common.ErrNotImplementedError return "", common.ErrNotImplementedError
} }
@ -36,7 +36,7 @@ func numProcs(ctx context.Context) (uint64, error) {
return uint64(len(procs)), nil return uint64(len(procs)), nil
} }
func PlatformInformationWithContext(ctx context.Context) (string, string, string, error) { func PlatformInformationWithContext(_ context.Context) (string, string, string, error) {
platform := "" platform := ""
family := "" family := ""
version := "" version := ""
@ -53,11 +53,11 @@ func PlatformInformationWithContext(ctx context.Context) (string, string, string
return platform, family, version, nil return platform, family, version, nil
} }
func VirtualizationWithContext(ctx context.Context) (string, string, error) { func VirtualizationWithContext(_ context.Context) (string, string, error) {
return "", "", common.ErrNotImplementedError return "", "", common.ErrNotImplementedError
} }
func UsersWithContext(ctx context.Context) ([]UserStat, error) { func UsersWithContext(_ context.Context) ([]UserStat, error) {
var ret []UserStat var ret []UserStat
utmpfile := "/var/run/utmp" utmpfile := "/var/run/utmp"
file, err := os.Open(utmpfile) file, err := os.Open(utmpfile)

@ -59,7 +59,7 @@ func HostIDWithContext(ctx context.Context) (string, error) {
} }
// Count number of processes based on the number of entries in /proc // Count number of processes based on the number of entries in /proc
func numProcs(ctx context.Context) (uint64, error) { func numProcs(_ context.Context) (uint64, error) {
dirs, err := os.ReadDir("/proc") dirs, err := os.ReadDir("/proc")
if err != nil { if err != nil {
return 0, err return 0, err
@ -84,18 +84,18 @@ func BootTimeWithContext(ctx context.Context) (uint64, error) {
} }
func UptimeWithContext(ctx context.Context) (uint64, error) { func UptimeWithContext(ctx context.Context) (uint64, error) {
bootTime, err := BootTime() //nolint:contextcheck //FIXME bootTime, err := BootTimeWithContext(ctx)
if err != nil { if err != nil {
return 0, err return 0, err
} }
return timeSince(bootTime), nil return timeSince(bootTime), nil
} }
func UsersWithContext(ctx context.Context) ([]UserStat, error) { func UsersWithContext(_ context.Context) ([]UserStat, error) {
return []UserStat{}, common.ErrNotImplementedError return []UserStat{}, common.ErrNotImplementedError
} }
func VirtualizationWithContext(ctx context.Context) (string, string, error) { func VirtualizationWithContext(_ context.Context) (string, string, error) {
return "", "", common.ErrNotImplementedError return "", "", common.ErrNotImplementedError
} }

@ -56,7 +56,7 @@ type systemInfo struct {
wProcessorRevision uint16 wProcessorRevision uint16
} }
func HostIDWithContext(ctx context.Context) (string, error) { func HostIDWithContext(_ context.Context) (string, error) {
// there has been reports of issues on 32bit using golang.org/x/sys/windows/registry, see https://github.com/shirou/gopsutil/pull/312#issuecomment-277422612 // there has been reports of issues on 32bit using golang.org/x/sys/windows/registry, see https://github.com/shirou/gopsutil/pull/312#issuecomment-277422612
// for rationale of using windows.RegOpenKeyEx/RegQueryValueEx instead of registry.OpenKey/GetStringValue // for rationale of using windows.RegOpenKeyEx/RegQueryValueEx instead of registry.OpenKey/GetStringValue
var h windows.Handle var h windows.Handle
@ -94,7 +94,7 @@ func numProcs(ctx context.Context) (uint64, error) {
return uint64(len(procs)), nil return uint64(len(procs)), nil
} }
func UptimeWithContext(ctx context.Context) (uint64, error) { func UptimeWithContext(_ context.Context) (uint64, error) {
up, err := uptimeMillis() up, err := uptimeMillis()
if err != nil { if err != nil {
return 0, err return 0, err
@ -118,7 +118,7 @@ func uptimeMillis() (uint64, error) {
// cachedBootTime must be accessed via atomic.Load/StoreUint64 // cachedBootTime must be accessed via atomic.Load/StoreUint64
var cachedBootTime uint64 var cachedBootTime uint64
func BootTimeWithContext(ctx context.Context) (uint64, error) { func BootTimeWithContext(_ context.Context) (uint64, error) {
if enableBootTimeCache { if enableBootTimeCache {
t := atomic.LoadUint64(&cachedBootTime) t := atomic.LoadUint64(&cachedBootTime)
if t != 0 { if t != 0 {
@ -234,13 +234,13 @@ func platformInformation() (platform, family, version, displayVersion string, er
return platform, family, version, displayVersion, nil return platform, family, version, displayVersion, nil
} }
func UsersWithContext(ctx context.Context) ([]UserStat, error) { func UsersWithContext(_ context.Context) ([]UserStat, error) {
var ret []UserStat var ret []UserStat
return ret, common.ErrNotImplementedError return ret, common.ErrNotImplementedError
} }
func VirtualizationWithContext(ctx context.Context) (string, string, error) { func VirtualizationWithContext(_ context.Context) (string, string, error) {
return "", "", common.ErrNotImplementedError return "", "", common.ErrNotImplementedError
} }

@ -93,7 +93,7 @@ func (i FakeInvoke) Command(name string, arg ...string) ([]byte, error) {
return []byte{}, fmt.Errorf("could not find testdata: %s", fpath) return []byte{}, fmt.Errorf("could not find testdata: %s", fpath)
} }
func (i FakeInvoke) CommandWithContext(ctx context.Context, name string, arg ...string) ([]byte, error) { func (i FakeInvoke) CommandWithContext(_ context.Context, name string, arg ...string) ([]byte, error) {
return i.Command(name, arg...) return i.Command(name, arg...)
} }

@ -15,7 +15,7 @@ func Avg() (*AvgStat, error) {
return AvgWithContext(context.Background()) return AvgWithContext(context.Background())
} }
func AvgWithContext(ctx context.Context) (*AvgStat, error) { func AvgWithContext(_ context.Context) (*AvgStat, error) {
// This SysctlRaw method borrowed from // This SysctlRaw method borrowed from
// https://github.com/prometheus/node_exporter/blob/master/collector/loadavg_freebsd.go // https://github.com/prometheus/node_exporter/blob/master/collector/loadavg_freebsd.go
type loadavg struct { type loadavg struct {

@ -15,7 +15,7 @@ func Avg() (*AvgStat, error) {
return AvgWithContext(context.Background()) return AvgWithContext(context.Background())
} }
func AvgWithContext(ctx context.Context) (*AvgStat, error) { func AvgWithContext(_ context.Context) (*AvgStat, error) {
// This SysctlRaw method borrowed from // This SysctlRaw method borrowed from
// https://github.com/prometheus/node_exporter/blob/master/collector/loadavg_freebsd.go // https://github.com/prometheus/node_exporter/blob/master/collector/loadavg_freebsd.go
// this implementation is common with BSDs // this implementation is common with BSDs

@ -13,7 +13,7 @@ func Avg() (*AvgStat, error) {
return AvgWithContext(context.Background()) return AvgWithContext(context.Background())
} }
func AvgWithContext(ctx context.Context) (*AvgStat, error) { func AvgWithContext(_ context.Context) (*AvgStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
@ -21,6 +21,6 @@ func Misc() (*MiscStat, error) {
return MiscWithContext(context.Background()) return MiscWithContext(context.Background())
} }
func MiscWithContext(ctx context.Context) (*MiscStat, error) { func MiscWithContext(_ context.Context) (*MiscStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }

@ -86,7 +86,7 @@ func Misc() (*MiscStat, error) {
return MiscWithContext(context.Background()) return MiscWithContext(context.Background())
} }
func MiscWithContext(ctx context.Context) (*MiscStat, error) { func MiscWithContext(_ context.Context) (*MiscStat, error) {
ret := MiscStat{} ret := MiscStat{}
return &ret, common.ErrNotImplementedError return &ret, common.ErrNotImplementedError

@ -35,7 +35,7 @@ func SwapMemory() (*SwapMemoryStat, error) {
return SwapMemoryWithContext(context.Background()) return SwapMemoryWithContext(context.Background())
} }
func SwapMemoryWithContext(ctx context.Context) (*SwapMemoryStat, error) { func SwapMemoryWithContext(_ context.Context) (*SwapMemoryStat, error) {
// https://github.com/yanllearnn/go-osstat/blob/ae8a279d26f52ec946a03698c7f50a26cfb427e3/memory/memory_darwin.go // https://github.com/yanllearnn/go-osstat/blob/ae8a279d26f52ec946a03698c7f50a26cfb427e3/memory/memory_darwin.go
var ret *SwapMemoryStat var ret *SwapMemoryStat
@ -67,7 +67,7 @@ func SwapDevices() ([]*SwapDevice, error) {
return SwapDevicesWithContext(context.Background()) return SwapDevicesWithContext(context.Background())
} }
func SwapDevicesWithContext(ctx context.Context) ([]*SwapDevice, error) { func SwapDevicesWithContext(_ context.Context) ([]*SwapDevice, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
@ -84,7 +84,7 @@ func VirtualMemory() (*VirtualMemoryStat, error) {
return VirtualMemoryWithContext(context.Background()) return VirtualMemoryWithContext(context.Background())
} }
func VirtualMemoryWithContext(ctx context.Context) (*VirtualMemoryStat, error) { func VirtualMemoryWithContext(_ context.Context) (*VirtualMemoryStat, error) {
machLib, err := common.NewLibrary(common.System) machLib, err := common.NewLibrary(common.System)
if err != nil { if err != nil {
return nil, err return nil, err

@ -13,7 +13,7 @@ func VirtualMemory() (*VirtualMemoryStat, error) {
return VirtualMemoryWithContext(context.Background()) return VirtualMemoryWithContext(context.Background())
} }
func VirtualMemoryWithContext(ctx context.Context) (*VirtualMemoryStat, error) { func VirtualMemoryWithContext(_ context.Context) (*VirtualMemoryStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
@ -21,7 +21,7 @@ func SwapMemory() (*SwapMemoryStat, error) {
return SwapMemoryWithContext(context.Background()) return SwapMemoryWithContext(context.Background())
} }
func SwapMemoryWithContext(ctx context.Context) (*SwapMemoryStat, error) { func SwapMemoryWithContext(_ context.Context) (*SwapMemoryStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
@ -29,6 +29,6 @@ func SwapDevices() ([]*SwapDevice, error) {
return SwapDevicesWithContext(context.Background()) return SwapDevicesWithContext(context.Background())
} }
func SwapDevicesWithContext(ctx context.Context) ([]*SwapDevice, error) { func SwapDevicesWithContext(_ context.Context) ([]*SwapDevice, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }

@ -17,7 +17,7 @@ func VirtualMemory() (*VirtualMemoryStat, error) {
return VirtualMemoryWithContext(context.Background()) return VirtualMemoryWithContext(context.Background())
} }
func VirtualMemoryWithContext(ctx context.Context) (*VirtualMemoryStat, error) { func VirtualMemoryWithContext(_ context.Context) (*VirtualMemoryStat, error) {
pageSize, err := common.SysctlUint("vm.stats.vm.v_page_size") pageSize, err := common.SysctlUint("vm.stats.vm.v_page_size")
if err != nil { if err != nil {
return nil, err return nil, err
@ -110,7 +110,7 @@ type xswdev11 struct {
Used int32 // Used is the number of blocks used Used int32 // Used is the number of blocks used
} }
func SwapMemoryWithContext(ctx context.Context) (*SwapMemoryStat, error) { func SwapMemoryWithContext(_ context.Context) (*SwapMemoryStat, error) {
// FreeBSD can have multiple swap devices so we total them up // FreeBSD can have multiple swap devices so we total them up
i, err := common.SysctlUint("vm.nswapdev") i, err := common.SysctlUint("vm.nswapdev")
if err != nil { if err != nil {

@ -15,7 +15,7 @@ func GetPageSize() (uint64, error) {
return GetPageSizeWithContext(context.Background()) return GetPageSizeWithContext(context.Background())
} }
func GetPageSizeWithContext(ctx context.Context) (uint64, error) { func GetPageSizeWithContext(_ context.Context) (uint64, error) {
uvmexp, err := unix.SysctlUvmexp("vm.uvmexp2") uvmexp, err := unix.SysctlUvmexp("vm.uvmexp2")
if err != nil { if err != nil {
return 0, err return 0, err
@ -27,7 +27,7 @@ func VirtualMemory() (*VirtualMemoryStat, error) {
return VirtualMemoryWithContext(context.Background()) return VirtualMemoryWithContext(context.Background())
} }
func VirtualMemoryWithContext(ctx context.Context) (*VirtualMemoryStat, error) { func VirtualMemoryWithContext(_ context.Context) (*VirtualMemoryStat, error) {
uvmexp, err := unix.SysctlUvmexp("vm.uvmexp2") uvmexp, err := unix.SysctlUvmexp("vm.uvmexp2")
if err != nil { if err != nil {
return nil, err return nil, err

@ -19,7 +19,7 @@ func GetPageSize() (uint64, error) {
return GetPageSizeWithContext(context.Background()) return GetPageSizeWithContext(context.Background())
} }
func GetPageSizeWithContext(ctx context.Context) (uint64, error) { func GetPageSizeWithContext(_ context.Context) (uint64, error) {
uvmexp, err := unix.SysctlUvmexp("vm.uvmexp") uvmexp, err := unix.SysctlUvmexp("vm.uvmexp")
if err != nil { if err != nil {
return 0, err return 0, err
@ -31,7 +31,7 @@ func VirtualMemory() (*VirtualMemoryStat, error) {
return VirtualMemoryWithContext(context.Background()) return VirtualMemoryWithContext(context.Background())
} }
func VirtualMemoryWithContext(ctx context.Context) (*VirtualMemoryStat, error) { func VirtualMemoryWithContext(_ context.Context) (*VirtualMemoryStat, error) {
uvmexp, err := unix.SysctlUvmexp("vm.uvmexp") uvmexp, err := unix.SysctlUvmexp("vm.uvmexp")
if err != nil { if err != nil {
return nil, err return nil, err

@ -64,6 +64,6 @@ func SwapDevices() ([]*SwapDevice, error) {
return SwapDevicesWithContext(context.Background()) return SwapDevicesWithContext(context.Background())
} }
func SwapDevicesWithContext(ctx context.Context) ([]*SwapDevice, error) { func SwapDevicesWithContext(_ context.Context) ([]*SwapDevice, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }

@ -58,7 +58,7 @@ func SwapMemory() (*SwapMemoryStat, error) {
return SwapMemoryWithContext(context.Background()) return SwapMemoryWithContext(context.Background())
} }
func SwapMemoryWithContext(ctx context.Context) (*SwapMemoryStat, error) { func SwapMemoryWithContext(_ context.Context) (*SwapMemoryStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }

@ -37,7 +37,7 @@ func VirtualMemory() (*VirtualMemoryStat, error) {
return VirtualMemoryWithContext(context.Background()) return VirtualMemoryWithContext(context.Background())
} }
func VirtualMemoryWithContext(ctx context.Context) (*VirtualMemoryStat, error) { func VirtualMemoryWithContext(_ context.Context) (*VirtualMemoryStat, error) {
var memInfo memoryStatusEx var memInfo memoryStatusEx
memInfo.cbSize = uint32(unsafe.Sizeof(memInfo)) memInfo.cbSize = uint32(unsafe.Sizeof(memInfo))
mem, _, _ := procGlobalMemoryStatusEx.Call(uintptr(unsafe.Pointer(&memInfo))) mem, _, _ := procGlobalMemoryStatusEx.Call(uintptr(unsafe.Pointer(&memInfo)))
@ -77,7 +77,7 @@ func SwapMemory() (*SwapMemoryStat, error) {
return SwapMemoryWithContext(context.Background()) return SwapMemoryWithContext(context.Background())
} }
func SwapMemoryWithContext(ctx context.Context) (*SwapMemoryStat, error) { func SwapMemoryWithContext(_ context.Context) (*SwapMemoryStat, error) {
// Use the performance counter to get the swap usage percentage // Use the performance counter to get the swap usage percentage
counter, err := common.NewWin32PerformanceCounter("swap_percentage", `\Paging File(_Total)\% Usage`) counter, err := common.NewWin32PerformanceCounter("swap_percentage", `\Paging File(_Total)\% Usage`)
if err != nil { if err != nil {
@ -151,7 +151,7 @@ func SwapDevices() ([]*SwapDevice, error) {
return SwapDevicesWithContext(context.Background()) return SwapDevicesWithContext(context.Background())
} }
func SwapDevicesWithContext(ctx context.Context) ([]*SwapDevice, error) { func SwapDevicesWithContext(_ context.Context) ([]*SwapDevice, error) {
pageSizeOnce.Do(func() { pageSizeOnce.Do(func() {
var sysInfo systemInfo var sysInfo systemInfo
procGetNativeSystemInfo.Call(uintptr(unsafe.Pointer(&sysInfo))) procGetNativeSystemInfo.Call(uintptr(unsafe.Pointer(&sysInfo)))

@ -207,7 +207,7 @@ func Interfaces() (InterfaceStatList, error) {
return InterfacesWithContext(context.Background()) return InterfacesWithContext(context.Background())
} }
func InterfacesWithContext(ctx context.Context) (InterfaceStatList, error) { func InterfacesWithContext(_ context.Context) (InterfaceStatList, error) {
is, err := net.Interfaces() is, err := net.Interfaces()
if err != nil { if err != nil {
return nil, err return nil, err

@ -163,7 +163,7 @@ func (mapi mapInterfaceNameUsage) notTruncated() []string {
} }
// Deprecated: use process.PidsWithContext instead // Deprecated: use process.PidsWithContext instead
func PidsWithContext(ctx context.Context) ([]int32, error) { func PidsWithContext(_ context.Context) ([]int32, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
@ -254,18 +254,18 @@ func IOCountersWithContext(ctx context.Context, pernic bool) ([]IOCountersStat,
return ret, nil return ret, nil
} }
func IOCountersByFileWithContext(ctx context.Context, pernic bool, filename string) ([]IOCountersStat, error) { func IOCountersByFileWithContext(ctx context.Context, pernic bool, _ string) ([]IOCountersStat, error) {
return IOCountersWithContext(ctx, pernic) return IOCountersWithContext(ctx, pernic)
} }
func FilterCountersWithContext(ctx context.Context) ([]FilterStat, error) { func FilterCountersWithContext(_ context.Context) ([]FilterStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func ConntrackStatsWithContext(ctx context.Context, percpu bool) ([]ConntrackStat, error) { func ConntrackStatsWithContext(_ context.Context, _ bool) ([]ConntrackStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func ProtoCountersWithContext(ctx context.Context, protocols []string) ([]ProtoCountersStat, error) { func ProtoCountersWithContext(_ context.Context, _ []string) ([]ProtoCountersStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }

@ -9,32 +9,32 @@ import (
"github.com/shirou/gopsutil/v4/internal/common" "github.com/shirou/gopsutil/v4/internal/common"
) )
func IOCountersWithContext(ctx context.Context, pernic bool) ([]IOCountersStat, error) { func IOCountersWithContext(_ context.Context, _ bool) ([]IOCountersStat, error) {
return []IOCountersStat{}, common.ErrNotImplementedError return []IOCountersStat{}, common.ErrNotImplementedError
} }
func IOCountersByFileWithContext(ctx context.Context, pernic bool, filename string) ([]IOCountersStat, error) { func IOCountersByFileWithContext(ctx context.Context, pernic bool, _ string) ([]IOCountersStat, error) {
return IOCountersWithContext(ctx, pernic) return IOCountersWithContext(ctx, pernic)
} }
func FilterCountersWithContext(ctx context.Context) ([]FilterStat, error) { func FilterCountersWithContext(_ context.Context) ([]FilterStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func ConntrackStatsWithContext(ctx context.Context, percpu bool) ([]ConntrackStat, error) { func ConntrackStatsWithContext(_ context.Context, _ bool) ([]ConntrackStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func ProtoCountersWithContext(ctx context.Context, protocols []string) ([]ProtoCountersStat, error) { func ProtoCountersWithContext(_ context.Context, _ []string) ([]ProtoCountersStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
// Deprecated: use process.PidsWithContext instead // Deprecated: use process.PidsWithContext instead
func PidsWithContext(ctx context.Context) ([]int32, error) { func PidsWithContext(_ context.Context) ([]int32, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func ConnectionsWithContext(ctx context.Context, kind string) ([]ConnectionStat, error) { func ConnectionsWithContext(_ context.Context, _ string) ([]ConnectionStat, error) {
return []ConnectionStat{}, common.ErrNotImplementedError return []ConnectionStat{}, common.ErrNotImplementedError
} }

@ -12,7 +12,7 @@ import (
) )
// Deprecated: use process.PidsWithContext instead // Deprecated: use process.PidsWithContext instead
func PidsWithContext(ctx context.Context) ([]int32, error) { func PidsWithContext(_ context.Context) ([]int32, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
@ -91,18 +91,18 @@ func IOCountersWithContext(ctx context.Context, pernic bool) ([]IOCountersStat,
return ret, nil return ret, nil
} }
func IOCountersByFileWithContext(ctx context.Context, pernic bool, filename string) ([]IOCountersStat, error) { func IOCountersByFileWithContext(ctx context.Context, pernic bool, _ string) ([]IOCountersStat, error) {
return IOCountersWithContext(ctx, pernic) return IOCountersWithContext(ctx, pernic)
} }
func FilterCountersWithContext(ctx context.Context) ([]FilterStat, error) { func FilterCountersWithContext(_ context.Context) ([]FilterStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func ConntrackStatsWithContext(ctx context.Context, percpu bool) ([]ConntrackStat, error) { func ConntrackStatsWithContext(_ context.Context, _ bool) ([]ConntrackStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func ProtoCountersWithContext(ctx context.Context, protocols []string) ([]ProtoCountersStat, error) { func ProtoCountersWithContext(_ context.Context, _ []string) ([]ProtoCountersStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }

@ -44,7 +44,7 @@ func IOCountersWithContext(ctx context.Context, pernic bool) ([]IOCountersStat,
return IOCountersByFileWithContext(ctx, pernic, filename) return IOCountersByFileWithContext(ctx, pernic, filename)
} }
func IOCountersByFileWithContext(ctx context.Context, pernic bool, filename string) ([]IOCountersStat, error) { func IOCountersByFileWithContext(_ context.Context, pernic bool, filename string) ([]IOCountersStat, error) {
lines, err := common.ReadLines(filename) lines, err := common.ReadLines(filename)
if err != nil { if err != nil {
return nil, err return nil, err

@ -107,7 +107,7 @@ func ParseNetstat(output string, mode string,
} }
// Deprecated: use process.PidsWithContext instead // Deprecated: use process.PidsWithContext instead
func PidsWithContext(ctx context.Context) ([]int32, error) { func PidsWithContext(_ context.Context) ([]int32, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
@ -157,19 +157,19 @@ func IOCountersWithContext(ctx context.Context, pernic bool) ([]IOCountersStat,
return ret, nil return ret, nil
} }
func IOCountersByFileWithContext(ctx context.Context, pernic bool, filename string) ([]IOCountersStat, error) { func IOCountersByFileWithContext(ctx context.Context, pernic bool, _ string) ([]IOCountersStat, error) {
return IOCounters(pernic) //nolint:contextcheck //FIXME return IOCountersWithContext(ctx, pernic)
} }
func FilterCountersWithContext(ctx context.Context) ([]FilterStat, error) { func FilterCountersWithContext(_ context.Context) ([]FilterStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func ConntrackStatsWithContext(ctx context.Context, percpu bool) ([]ConntrackStat, error) { func ConntrackStatsWithContext(_ context.Context, _ bool) ([]ConntrackStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func ProtoCountersWithContext(ctx context.Context, protocols []string) ([]ProtoCountersStat, error) { func ProtoCountersWithContext(_ context.Context, _ []string) ([]ProtoCountersStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
@ -310,15 +310,15 @@ func ConnectionsWithContext(ctx context.Context, kind string) ([]ConnectionStat,
return ret, nil return ret, nil
} }
func ConnectionsPidWithContext(ctx context.Context, kind string, pid int32) ([]ConnectionStat, error) { func ConnectionsPidWithContext(_ context.Context, _ string, _ int32) ([]ConnectionStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func ConnectionsMaxWithContext(ctx context.Context, kind string, maxConn int) ([]ConnectionStat, error) { func ConnectionsMaxWithContext(_ context.Context, _ string, _ int) ([]ConnectionStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func ConnectionsPidMaxWithContext(ctx context.Context, kind string, pid int32, maxConn int) ([]ConnectionStat, error) { func ConnectionsPidMaxWithContext(_ context.Context, _ string, _ int32, _ int) ([]ConnectionStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
@ -338,6 +338,6 @@ func ConnectionsPidMaxWithoutUidsWithContext(ctx context.Context, kind string, p
return connectionsPidMaxWithoutUidsWithContext(ctx, kind, pid, maxConn) return connectionsPidMaxWithoutUidsWithContext(ctx, kind, pid, maxConn)
} }
func connectionsPidMaxWithoutUidsWithContext(ctx context.Context, kind string, pid int32, maxConn int) ([]ConnectionStat, error) { func connectionsPidMaxWithoutUidsWithContext(_ context.Context, _ string, _ int32, _ int) ([]ConnectionStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }

@ -111,28 +111,28 @@ func IOCountersWithContext(ctx context.Context, pernic bool) ([]IOCountersStat,
return ret, nil return ret, nil
} }
func IOCountersByFileWithContext(ctx context.Context, pernic bool, filename string) ([]IOCountersStat, error) { func IOCountersByFileWithContext(ctx context.Context, pernic bool, _ string) ([]IOCountersStat, error) {
return IOCountersWithContext(ctx, pernic) return IOCountersWithContext(ctx, pernic)
} }
func FilterCountersWithContext(ctx context.Context) ([]FilterStat, error) { func FilterCountersWithContext(_ context.Context) ([]FilterStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func ConntrackStatsWithContext(ctx context.Context, percpu bool) ([]ConntrackStat, error) { func ConntrackStatsWithContext(_ context.Context, _ bool) ([]ConntrackStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func ProtoCountersWithContext(ctx context.Context, protocols []string) ([]ProtoCountersStat, error) { func ProtoCountersWithContext(_ context.Context, _ []string) ([]ProtoCountersStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
// Deprecated: use process.PidsWithContext instead // Deprecated: use process.PidsWithContext instead
func PidsWithContext(ctx context.Context) ([]int32, error) { func PidsWithContext(_ context.Context) ([]int32, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func ConnectionsWithContext(ctx context.Context, kind string) ([]ConnectionStat, error) { func ConnectionsWithContext(_ context.Context, _ string) ([]ConnectionStat, error) {
return []ConnectionStat{}, common.ErrNotImplementedError return []ConnectionStat{}, common.ErrNotImplementedError
} }

@ -18,7 +18,7 @@ func ConnectionsWithContext(ctx context.Context, kind string) ([]ConnectionStat,
return ConnectionsPidWithContext(ctx, kind, 0) return ConnectionsPidWithContext(ctx, kind, 0)
} }
func ConnectionsMaxWithContext(ctx context.Context, kind string, maxConn int) ([]ConnectionStat, error) { func ConnectionsMaxWithContext(_ context.Context, _ string, _ int) ([]ConnectionStat, error) {
return []ConnectionStat{}, common.ErrNotImplementedError return []ConnectionStat{}, common.ErrNotImplementedError
} }
@ -163,7 +163,7 @@ func parseNetAddr(line string) (laddr Addr, raddr Addr, err error) {
return laddr, raddr, err return laddr, raddr, err
} }
func ConnectionsPidMaxWithContext(ctx context.Context, kind string, pid int32, maxConn int) ([]ConnectionStat, error) { func ConnectionsPidMaxWithContext(_ context.Context, _ string, _ int32, _ int) ([]ConnectionStat, error) {
return []ConnectionStat{}, common.ErrNotImplementedError return []ConnectionStat{}, common.ErrNotImplementedError
} }
@ -183,6 +183,6 @@ func ConnectionsPidMaxWithoutUidsWithContext(ctx context.Context, kind string, p
return connectionsPidMaxWithoutUidsWithContext(ctx, kind, pid, maxConn) return connectionsPidMaxWithoutUidsWithContext(ctx, kind, pid, maxConn)
} }
func connectionsPidMaxWithoutUidsWithContext(ctx context.Context, kind string, pid int32, maxConn int) ([]ConnectionStat, error) { func connectionsPidMaxWithoutUidsWithContext(_ context.Context, _ string, _ int32, _ int) ([]ConnectionStat, error) {
return []ConnectionStat{}, common.ErrNotImplementedError return []ConnectionStat{}, common.ErrNotImplementedError
} }

@ -138,7 +138,7 @@ type mibIfRow2 struct {
OutQLen uint64 OutQLen uint64
} }
func IOCountersWithContext(ctx context.Context, pernic bool) ([]IOCountersStat, error) { func IOCountersWithContext(_ context.Context, pernic bool) ([]IOCountersStat, error) {
ifs, err := net.Interfaces() ifs, err := net.Interfaces()
if err != nil { if err != nil {
return nil, err return nil, err
@ -198,15 +198,15 @@ func IOCountersWithContext(ctx context.Context, pernic bool) ([]IOCountersStat,
return counters, nil return counters, nil
} }
func IOCountersByFileWithContext(ctx context.Context, pernic bool, filename string) ([]IOCountersStat, error) { func IOCountersByFileWithContext(ctx context.Context, pernic bool, _ string) ([]IOCountersStat, error) {
return IOCounters(pernic) //nolint:contextcheck //FIXME return IOCountersWithContext(ctx, pernic)
} }
func ConnectionsWithContext(ctx context.Context, kind string) ([]ConnectionStat, error) { func ConnectionsWithContext(ctx context.Context, kind string) ([]ConnectionStat, error) {
return ConnectionsPidWithContext(ctx, kind, 0) return ConnectionsPidWithContext(ctx, kind, 0)
} }
func ConnectionsPidWithContext(ctx context.Context, kind string, pid int32) ([]ConnectionStat, error) { func ConnectionsPidWithContext(_ context.Context, kind string, pid int32) ([]ConnectionStat, error) {
tmap, ok := netConnectionKindMap[kind] tmap, ok := netConnectionKindMap[kind]
if !ok { if !ok {
return nil, fmt.Errorf("invalid kind, %s", kind) return nil, fmt.Errorf("invalid kind, %s", kind)
@ -258,7 +258,7 @@ func getNetStatWithKind(kindType netConnectionKindType) ([]ConnectionStat, error
} }
// Deprecated: use process.PidsWithContext instead // Deprecated: use process.PidsWithContext instead
func PidsWithContext(ctx context.Context) ([]int32, error) { func PidsWithContext(_ context.Context) ([]int32, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
@ -290,15 +290,15 @@ func connectionsPidMaxWithoutUidsWithContext(_ context.Context, _ string, _ int3
return []ConnectionStat{}, common.ErrNotImplementedError return []ConnectionStat{}, common.ErrNotImplementedError
} }
func FilterCountersWithContext(ctx context.Context) ([]FilterStat, error) { func FilterCountersWithContext(_ context.Context) ([]FilterStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func ConntrackStatsWithContext(ctx context.Context, percpu bool) ([]ConntrackStat, error) { func ConntrackStatsWithContext(_ context.Context, _ bool) ([]ConntrackStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func ProtoCountersWithContext(ctx context.Context, protocols []string) ([]ProtoCountersStat, error) { func ProtoCountersWithContext(_ context.Context, _ []string) ([]ProtoCountersStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }

@ -16,55 +16,55 @@ type MemoryInfoExStat struct{}
type MemoryMapsStat struct{} type MemoryMapsStat struct{}
func (p *Process) TgidWithContext(ctx context.Context) (int32, error) { func (p *Process) TgidWithContext(_ context.Context) (int32, error) {
return 0, common.ErrNotImplementedError return 0, common.ErrNotImplementedError
} }
func (p *Process) IOniceWithContext(ctx context.Context) (int32, error) { func (p *Process) IOniceWithContext(_ context.Context) (int32, error) {
return 0, common.ErrNotImplementedError return 0, common.ErrNotImplementedError
} }
func (p *Process) RlimitWithContext(ctx context.Context) ([]RlimitStat, error) { func (p *Process) RlimitWithContext(_ context.Context) ([]RlimitStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func (p *Process) RlimitUsageWithContext(ctx context.Context, gatherUsed bool) ([]RlimitStat, error) { func (p *Process) RlimitUsageWithContext(_ context.Context, _ bool) ([]RlimitStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func (p *Process) NumCtxSwitchesWithContext(ctx context.Context) (*NumCtxSwitchesStat, error) { func (p *Process) NumCtxSwitchesWithContext(_ context.Context) (*NumCtxSwitchesStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func (p *Process) NumFDsWithContext(ctx context.Context) (int32, error) { func (p *Process) NumFDsWithContext(_ context.Context) (int32, error) {
return 0, common.ErrNotImplementedError return 0, common.ErrNotImplementedError
} }
func (p *Process) CPUAffinityWithContext(ctx context.Context) ([]int32, error) { func (p *Process) CPUAffinityWithContext(_ context.Context) ([]int32, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func (p *Process) MemoryInfoExWithContext(ctx context.Context) (*MemoryInfoExStat, error) { func (p *Process) MemoryInfoExWithContext(_ context.Context) (*MemoryInfoExStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func (p *Process) PageFaultsWithContext(ctx context.Context) (*PageFaultsStat, error) { func (p *Process) PageFaultsWithContext(_ context.Context) (*PageFaultsStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func (p *Process) OpenFilesWithContext(ctx context.Context) ([]OpenFilesStat, error) { func (p *Process) OpenFilesWithContext(_ context.Context) ([]OpenFilesStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func (p *Process) MemoryMapsWithContext(ctx context.Context, grouped bool) (*[]MemoryMapsStat, error) { func (p *Process) MemoryMapsWithContext(_ context.Context, _ bool) (*[]MemoryMapsStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func (p *Process) ThreadsWithContext(ctx context.Context) (map[int32]*cpu.TimesStat, error) { func (p *Process) ThreadsWithContext(_ context.Context) (map[int32]*cpu.TimesStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func (p *Process) EnvironWithContext(ctx context.Context) ([]string, error) { func (p *Process) EnvironWithContext(_ context.Context) ([]string, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }

@ -37,7 +37,7 @@ type _Ctype_struct___0 struct {
Pad uint64 Pad uint64
} }
func pidsWithContext(ctx context.Context) ([]int32, error) { func pidsWithContext(_ context.Context) ([]int32, error) {
var ret []int32 var ret []int32
kprocs, err := unix.SysctlKinfoProcSlice("kern.proc.all") kprocs, err := unix.SysctlKinfoProcSlice("kern.proc.all")
@ -52,7 +52,7 @@ func pidsWithContext(ctx context.Context) ([]int32, error) {
return ret, nil return ret, nil
} }
func (p *Process) PpidWithContext(ctx context.Context) (int32, error) { func (p *Process) PpidWithContext(_ context.Context) (int32, error) {
k, err := p.getKProc() k, err := p.getKProc()
if err != nil { if err != nil {
return 0, err return 0, err
@ -85,7 +85,7 @@ func (p *Process) NameWithContext(ctx context.Context) (string, error) {
return name, nil return name, nil
} }
func (p *Process) createTimeWithContext(ctx context.Context) (int64, error) { func (p *Process) createTimeWithContext(_ context.Context) (int64, error) {
k, err := p.getKProc() k, err := p.getKProc()
if err != nil { if err != nil {
return 0, err return 0, err
@ -113,7 +113,7 @@ func (p *Process) ForegroundWithContext(ctx context.Context) (bool, error) {
return strings.IndexByte(string(out), '+') != -1, nil return strings.IndexByte(string(out), '+') != -1, nil
} }
func (p *Process) UidsWithContext(ctx context.Context) ([]uint32, error) { func (p *Process) UidsWithContext(_ context.Context) ([]uint32, error) {
k, err := p.getKProc() k, err := p.getKProc()
if err != nil { if err != nil {
return nil, err return nil, err
@ -125,7 +125,7 @@ func (p *Process) UidsWithContext(ctx context.Context) ([]uint32, error) {
return []uint32{userEffectiveUID}, nil return []uint32{userEffectiveUID}, nil
} }
func (p *Process) GidsWithContext(ctx context.Context) ([]uint32, error) { func (p *Process) GidsWithContext(_ context.Context) ([]uint32, error) {
k, err := p.getKProc() k, err := p.getKProc()
if err != nil { if err != nil {
return nil, err return nil, err
@ -137,7 +137,7 @@ func (p *Process) GidsWithContext(ctx context.Context) ([]uint32, error) {
return gids, nil return gids, nil
} }
func (p *Process) GroupsWithContext(ctx context.Context) ([]uint32, error) { func (p *Process) GroupsWithContext(_ context.Context) ([]uint32, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
// k, err := p.getKProc() // k, err := p.getKProc()
// if err != nil { // if err != nil {
@ -152,7 +152,7 @@ func (p *Process) GroupsWithContext(ctx context.Context) ([]uint32, error) {
// return groups, nil // return groups, nil
} }
func (p *Process) TerminalWithContext(ctx context.Context) (string, error) { func (p *Process) TerminalWithContext(_ context.Context) (string, error) {
return "", common.ErrNotImplementedError return "", common.ErrNotImplementedError
/* /*
k, err := p.getKProc() k, err := p.getKProc()
@ -170,7 +170,7 @@ func (p *Process) TerminalWithContext(ctx context.Context) (string, error) {
*/ */
} }
func (p *Process) NiceWithContext(ctx context.Context) (int32, error) { func (p *Process) NiceWithContext(_ context.Context) (int32, error) {
k, err := p.getKProc() k, err := p.getKProc()
if err != nil { if err != nil {
return 0, err return 0, err
@ -178,7 +178,7 @@ func (p *Process) NiceWithContext(ctx context.Context) (int32, error) {
return int32(k.Proc.P_nice), nil return int32(k.Proc.P_nice), nil
} }
func (p *Process) IOCountersWithContext(ctx context.Context) (*IOCountersStat, error) { func (p *Process) IOCountersWithContext(_ context.Context) (*IOCountersStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
@ -304,7 +304,7 @@ func getTimeScaleToNanoSeconds() float64 {
return float64(timeBaseInfo.Numer) / float64(timeBaseInfo.Denom) return float64(timeBaseInfo.Numer) / float64(timeBaseInfo.Denom)
} }
func (p *Process) ExeWithContext(ctx context.Context) (string, error) { func (p *Process) ExeWithContext(_ context.Context) (string, error) {
lib, err := registerFuncs() lib, err := registerFuncs()
if err != nil { if err != nil {
return "", err return "", err
@ -333,7 +333,7 @@ type vnodePathInfo struct {
// EUID can access. Otherwise "operation not permitted" will be returned as the // EUID can access. Otherwise "operation not permitted" will be returned as the
// error. // error.
// Note: This might also work for other *BSD OSs. // Note: This might also work for other *BSD OSs.
func (p *Process) CwdWithContext(ctx context.Context) (string, error) { func (p *Process) CwdWithContext(_ context.Context) (string, error) {
lib, err := registerFuncs() lib, err := registerFuncs()
if err != nil { if err != nil {
return "", err return "", err
@ -430,7 +430,7 @@ func (p *Process) CmdlineWithContext(ctx context.Context) (string, error) {
return strings.Join(r, " "), err return strings.Join(r, " "), err
} }
func (p *Process) NumThreadsWithContext(ctx context.Context) (int32, error) { func (p *Process) NumThreadsWithContext(_ context.Context) (int32, error) {
lib, err := registerFuncs() lib, err := registerFuncs()
if err != nil { if err != nil {
return 0, err return 0, err
@ -443,7 +443,7 @@ func (p *Process) NumThreadsWithContext(ctx context.Context) (int32, error) {
return int32(ti.Threadnum), nil return int32(ti.Threadnum), nil
} }
func (p *Process) TimesWithContext(ctx context.Context) (*cpu.TimesStat, error) { func (p *Process) TimesWithContext(_ context.Context) (*cpu.TimesStat, error) {
lib, err := registerFuncs() lib, err := registerFuncs()
if err != nil { if err != nil {
return nil, err return nil, err
@ -462,7 +462,7 @@ func (p *Process) TimesWithContext(ctx context.Context) (*cpu.TimesStat, error)
return ret, nil return ret, nil
} }
func (p *Process) MemoryInfoWithContext(ctx context.Context) (*MemoryInfoStat, error) { func (p *Process) MemoryInfoWithContext(_ context.Context) (*MemoryInfoStat, error) {
lib, err := registerFuncs() lib, err := registerFuncs()
if err != nil { if err != nil {
return nil, err return nil, err

@ -30,174 +30,174 @@ type MemoryMapsStat struct {
type MemoryInfoExStat struct{} type MemoryInfoExStat struct{}
func pidsWithContext(ctx context.Context) ([]int32, error) { func pidsWithContext(_ context.Context) ([]int32, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func ProcessesWithContext(ctx context.Context) ([]*Process, error) { func ProcessesWithContext(_ context.Context) ([]*Process, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func PidExistsWithContext(ctx context.Context, pid int32) (bool, error) { func PidExistsWithContext(_ context.Context, _ int32) (bool, error) {
return false, common.ErrNotImplementedError return false, common.ErrNotImplementedError
} }
func (p *Process) PpidWithContext(ctx context.Context) (int32, error) { func (p *Process) PpidWithContext(_ context.Context) (int32, error) {
return 0, common.ErrNotImplementedError return 0, common.ErrNotImplementedError
} }
func (p *Process) NameWithContext(ctx context.Context) (string, error) { func (p *Process) NameWithContext(_ context.Context) (string, error) {
return "", common.ErrNotImplementedError return "", common.ErrNotImplementedError
} }
func (p *Process) TgidWithContext(ctx context.Context) (int32, error) { func (p *Process) TgidWithContext(_ context.Context) (int32, error) {
return 0, common.ErrNotImplementedError return 0, common.ErrNotImplementedError
} }
func (p *Process) ExeWithContext(ctx context.Context) (string, error) { func (p *Process) ExeWithContext(_ context.Context) (string, error) {
return "", common.ErrNotImplementedError return "", common.ErrNotImplementedError
} }
func (p *Process) CmdlineWithContext(ctx context.Context) (string, error) { func (p *Process) CmdlineWithContext(_ context.Context) (string, error) {
return "", common.ErrNotImplementedError return "", common.ErrNotImplementedError
} }
func (p *Process) CmdlineSliceWithContext(ctx context.Context) ([]string, error) { func (p *Process) CmdlineSliceWithContext(_ context.Context) ([]string, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func (p *Process) createTimeWithContext(ctx context.Context) (int64, error) { func (p *Process) createTimeWithContext(_ context.Context) (int64, error) {
return 0, common.ErrNotImplementedError return 0, common.ErrNotImplementedError
} }
func (p *Process) CwdWithContext(ctx context.Context) (string, error) { func (p *Process) CwdWithContext(_ context.Context) (string, error) {
return "", common.ErrNotImplementedError return "", common.ErrNotImplementedError
} }
func (p *Process) StatusWithContext(ctx context.Context) ([]string, error) { func (p *Process) StatusWithContext(_ context.Context) ([]string, error) {
return []string{""}, common.ErrNotImplementedError return []string{""}, common.ErrNotImplementedError
} }
func (p *Process) ForegroundWithContext(ctx context.Context) (bool, error) { func (p *Process) ForegroundWithContext(_ context.Context) (bool, error) {
return false, common.ErrNotImplementedError return false, common.ErrNotImplementedError
} }
func (p *Process) UidsWithContext(ctx context.Context) ([]uint32, error) { func (p *Process) UidsWithContext(_ context.Context) ([]uint32, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func (p *Process) GidsWithContext(ctx context.Context) ([]uint32, error) { func (p *Process) GidsWithContext(_ context.Context) ([]uint32, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func (p *Process) GroupsWithContext(ctx context.Context) ([]uint32, error) { func (p *Process) GroupsWithContext(_ context.Context) ([]uint32, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func (p *Process) TerminalWithContext(ctx context.Context) (string, error) { func (p *Process) TerminalWithContext(_ context.Context) (string, error) {
return "", common.ErrNotImplementedError return "", common.ErrNotImplementedError
} }
func (p *Process) NiceWithContext(ctx context.Context) (int32, error) { func (p *Process) NiceWithContext(_ context.Context) (int32, error) {
return 0, common.ErrNotImplementedError return 0, common.ErrNotImplementedError
} }
func (p *Process) IOniceWithContext(ctx context.Context) (int32, error) { func (p *Process) IOniceWithContext(_ context.Context) (int32, error) {
return 0, common.ErrNotImplementedError return 0, common.ErrNotImplementedError
} }
func (p *Process) RlimitWithContext(ctx context.Context) ([]RlimitStat, error) { func (p *Process) RlimitWithContext(_ context.Context) ([]RlimitStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func (p *Process) RlimitUsageWithContext(ctx context.Context, gatherUsed bool) ([]RlimitStat, error) { func (p *Process) RlimitUsageWithContext(_ context.Context, _ bool) ([]RlimitStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func (p *Process) IOCountersWithContext(ctx context.Context) (*IOCountersStat, error) { func (p *Process) IOCountersWithContext(_ context.Context) (*IOCountersStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func (p *Process) NumCtxSwitchesWithContext(ctx context.Context) (*NumCtxSwitchesStat, error) { func (p *Process) NumCtxSwitchesWithContext(_ context.Context) (*NumCtxSwitchesStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func (p *Process) NumFDsWithContext(ctx context.Context) (int32, error) { func (p *Process) NumFDsWithContext(_ context.Context) (int32, error) {
return 0, common.ErrNotImplementedError return 0, common.ErrNotImplementedError
} }
func (p *Process) NumThreadsWithContext(ctx context.Context) (int32, error) { func (p *Process) NumThreadsWithContext(_ context.Context) (int32, error) {
return 0, common.ErrNotImplementedError return 0, common.ErrNotImplementedError
} }
func (p *Process) ThreadsWithContext(ctx context.Context) (map[int32]*cpu.TimesStat, error) { func (p *Process) ThreadsWithContext(_ context.Context) (map[int32]*cpu.TimesStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func (p *Process) TimesWithContext(ctx context.Context) (*cpu.TimesStat, error) { func (p *Process) TimesWithContext(_ context.Context) (*cpu.TimesStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func (p *Process) CPUAffinityWithContext(ctx context.Context) ([]int32, error) { func (p *Process) CPUAffinityWithContext(_ context.Context) ([]int32, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func (p *Process) MemoryInfoWithContext(ctx context.Context) (*MemoryInfoStat, error) { func (p *Process) MemoryInfoWithContext(_ context.Context) (*MemoryInfoStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func (p *Process) MemoryInfoExWithContext(ctx context.Context) (*MemoryInfoExStat, error) { func (p *Process) MemoryInfoExWithContext(_ context.Context) (*MemoryInfoExStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func (p *Process) PageFaultsWithContext(ctx context.Context) (*PageFaultsStat, error) { func (p *Process) PageFaultsWithContext(_ context.Context) (*PageFaultsStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func (p *Process) ChildrenWithContext(ctx context.Context) ([]*Process, error) { func (p *Process) ChildrenWithContext(_ context.Context) ([]*Process, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func (p *Process) OpenFilesWithContext(ctx context.Context) ([]OpenFilesStat, error) { func (p *Process) OpenFilesWithContext(_ context.Context) ([]OpenFilesStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func (p *Process) ConnectionsWithContext(ctx context.Context) ([]net.ConnectionStat, error) { func (p *Process) ConnectionsWithContext(_ context.Context) ([]net.ConnectionStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func (p *Process) ConnectionsMaxWithContext(ctx context.Context, maxConn int) ([]net.ConnectionStat, error) { func (p *Process) ConnectionsMaxWithContext(_ context.Context, _ int) ([]net.ConnectionStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func (p *Process) MemoryMapsWithContext(ctx context.Context, grouped bool) (*[]MemoryMapsStat, error) { func (p *Process) MemoryMapsWithContext(_ context.Context, _ bool) (*[]MemoryMapsStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func (p *Process) SendSignalWithContext(ctx context.Context, sig Signal) error { func (p *Process) SendSignalWithContext(_ context.Context, _ Signal) error {
return common.ErrNotImplementedError return common.ErrNotImplementedError
} }
func (p *Process) SuspendWithContext(ctx context.Context) error { func (p *Process) SuspendWithContext(_ context.Context) error {
return common.ErrNotImplementedError return common.ErrNotImplementedError
} }
func (p *Process) ResumeWithContext(ctx context.Context) error { func (p *Process) ResumeWithContext(_ context.Context) error {
return common.ErrNotImplementedError return common.ErrNotImplementedError
} }
func (p *Process) TerminateWithContext(ctx context.Context) error { func (p *Process) TerminateWithContext(_ context.Context) error {
return common.ErrNotImplementedError return common.ErrNotImplementedError
} }
func (p *Process) KillWithContext(ctx context.Context) error { func (p *Process) KillWithContext(_ context.Context) error {
return common.ErrNotImplementedError return common.ErrNotImplementedError
} }
func (p *Process) UsernameWithContext(ctx context.Context) (string, error) { func (p *Process) UsernameWithContext(_ context.Context) (string, error) {
return "", common.ErrNotImplementedError return "", common.ErrNotImplementedError
} }
func (p *Process) EnvironWithContext(ctx context.Context) ([]string, error) { func (p *Process) EnvironWithContext(_ context.Context) ([]string, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }

@ -34,7 +34,7 @@ func pidsWithContext(ctx context.Context) ([]int32, error) {
return ret, nil return ret, nil
} }
func (p *Process) PpidWithContext(ctx context.Context) (int32, error) { func (p *Process) PpidWithContext(_ context.Context) (int32, error) {
k, err := p.getKProc() k, err := p.getKProc()
if err != nil { if err != nil {
return 0, err return 0, err
@ -66,7 +66,7 @@ func (p *Process) NameWithContext(ctx context.Context) (string, error) {
return name, nil return name, nil
} }
func (p *Process) CwdWithContext(ctx context.Context) (string, error) { func (p *Process) CwdWithContext(_ context.Context) (string, error) {
mib := []int32{CTLKern, KernProc, KernProcCwd, p.Pid} mib := []int32{CTLKern, KernProc, KernProcCwd, p.Pid}
buf, length, err := common.CallSyscall(mib) buf, length, err := common.CallSyscall(mib)
if err != nil { if err != nil {
@ -87,7 +87,7 @@ func (p *Process) CwdWithContext(ctx context.Context) (string, error) {
return cwd, nil return cwd, nil
} }
func (p *Process) ExeWithContext(ctx context.Context) (string, error) { func (p *Process) ExeWithContext(_ context.Context) (string, error) {
mib := []int32{CTLKern, KernProc, KernProcPathname, p.Pid} mib := []int32{CTLKern, KernProc, KernProcPathname, p.Pid}
buf, _, err := common.CallSyscall(mib) buf, _, err := common.CallSyscall(mib)
if err != nil { if err != nil {
@ -97,7 +97,7 @@ func (p *Process) ExeWithContext(ctx context.Context) (string, error) {
return strings.Trim(string(buf), "\x00"), nil return strings.Trim(string(buf), "\x00"), nil
} }
func (p *Process) CmdlineWithContext(ctx context.Context) (string, error) { func (p *Process) CmdlineWithContext(_ context.Context) (string, error) {
mib := []int32{CTLKern, KernProc, KernProcArgs, p.Pid} mib := []int32{CTLKern, KernProc, KernProcArgs, p.Pid}
buf, _, err := common.CallSyscall(mib) buf, _, err := common.CallSyscall(mib)
if err != nil { if err != nil {
@ -110,7 +110,7 @@ func (p *Process) CmdlineWithContext(ctx context.Context) (string, error) {
return strings.Join(ret, " "), nil return strings.Join(ret, " "), nil
} }
func (p *Process) CmdlineSliceWithContext(ctx context.Context) ([]string, error) { func (p *Process) CmdlineSliceWithContext(_ context.Context) ([]string, error) {
mib := []int32{CTLKern, KernProc, KernProcArgs, p.Pid} mib := []int32{CTLKern, KernProc, KernProcArgs, p.Pid}
buf, _, err := common.CallSyscall(mib) buf, _, err := common.CallSyscall(mib)
if err != nil { if err != nil {
@ -131,7 +131,7 @@ func (p *Process) CmdlineSliceWithContext(ctx context.Context) ([]string, error)
return strParts, nil return strParts, nil
} }
func (p *Process) createTimeWithContext(ctx context.Context) (int64, error) { func (p *Process) createTimeWithContext(_ context.Context) (int64, error) {
k, err := p.getKProc() k, err := p.getKProc()
if err != nil { if err != nil {
return 0, err return 0, err
@ -139,7 +139,7 @@ func (p *Process) createTimeWithContext(ctx context.Context) (int64, error) {
return int64(k.Start.Sec)*1000 + int64(k.Start.Usec)/1000, nil return int64(k.Start.Sec)*1000 + int64(k.Start.Usec)/1000, nil
} }
func (p *Process) StatusWithContext(ctx context.Context) ([]string, error) { func (p *Process) StatusWithContext(_ context.Context) ([]string, error) {
k, err := p.getKProc() k, err := p.getKProc()
if err != nil { if err != nil {
return []string{""}, err return []string{""}, err
@ -175,7 +175,7 @@ func (p *Process) ForegroundWithContext(ctx context.Context) (bool, error) {
return strings.IndexByte(string(out), '+') != -1, nil return strings.IndexByte(string(out), '+') != -1, nil
} }
func (p *Process) UidsWithContext(ctx context.Context) ([]uint32, error) { func (p *Process) UidsWithContext(_ context.Context) ([]uint32, error) {
k, err := p.getKProc() k, err := p.getKProc()
if err != nil { if err != nil {
return nil, err return nil, err
@ -188,7 +188,7 @@ func (p *Process) UidsWithContext(ctx context.Context) ([]uint32, error) {
return uids, nil return uids, nil
} }
func (p *Process) GidsWithContext(ctx context.Context) ([]uint32, error) { func (p *Process) GidsWithContext(_ context.Context) ([]uint32, error) {
k, err := p.getKProc() k, err := p.getKProc()
if err != nil { if err != nil {
return nil, err return nil, err
@ -200,7 +200,7 @@ func (p *Process) GidsWithContext(ctx context.Context) ([]uint32, error) {
return gids, nil return gids, nil
} }
func (p *Process) GroupsWithContext(ctx context.Context) ([]uint32, error) { func (p *Process) GroupsWithContext(_ context.Context) ([]uint32, error) {
k, err := p.getKProc() k, err := p.getKProc()
if err != nil { if err != nil {
return nil, err return nil, err
@ -214,7 +214,7 @@ func (p *Process) GroupsWithContext(ctx context.Context) ([]uint32, error) {
return groups, nil return groups, nil
} }
func (p *Process) TerminalWithContext(ctx context.Context) (string, error) { func (p *Process) TerminalWithContext(_ context.Context) (string, error) {
k, err := p.getKProc() k, err := p.getKProc()
if err != nil { if err != nil {
return "", err return "", err
@ -230,7 +230,7 @@ func (p *Process) TerminalWithContext(ctx context.Context) (string, error) {
return termmap[ttyNr], nil return termmap[ttyNr], nil
} }
func (p *Process) NiceWithContext(ctx context.Context) (int32, error) { func (p *Process) NiceWithContext(_ context.Context) (int32, error) {
k, err := p.getKProc() k, err := p.getKProc()
if err != nil { if err != nil {
return 0, err return 0, err
@ -238,7 +238,7 @@ func (p *Process) NiceWithContext(ctx context.Context) (int32, error) {
return int32(k.Nice), nil return int32(k.Nice), nil
} }
func (p *Process) IOCountersWithContext(ctx context.Context) (*IOCountersStat, error) { func (p *Process) IOCountersWithContext(_ context.Context) (*IOCountersStat, error) {
k, err := p.getKProc() k, err := p.getKProc()
if err != nil { if err != nil {
return nil, err return nil, err
@ -249,7 +249,7 @@ func (p *Process) IOCountersWithContext(ctx context.Context) (*IOCountersStat, e
}, nil }, nil
} }
func (p *Process) NumThreadsWithContext(ctx context.Context) (int32, error) { func (p *Process) NumThreadsWithContext(_ context.Context) (int32, error) {
k, err := p.getKProc() k, err := p.getKProc()
if err != nil { if err != nil {
return 0, err return 0, err
@ -258,7 +258,7 @@ func (p *Process) NumThreadsWithContext(ctx context.Context) (int32, error) {
return k.Numthreads, nil return k.Numthreads, nil
} }
func (p *Process) TimesWithContext(ctx context.Context) (*cpu.TimesStat, error) { func (p *Process) TimesWithContext(_ context.Context) (*cpu.TimesStat, error) {
k, err := p.getKProc() k, err := p.getKProc()
if err != nil { if err != nil {
return nil, err return nil, err
@ -270,7 +270,7 @@ func (p *Process) TimesWithContext(ctx context.Context) (*cpu.TimesStat, error)
}, nil }, nil
} }
func (p *Process) MemoryInfoWithContext(ctx context.Context) (*MemoryInfoStat, error) { func (p *Process) MemoryInfoWithContext(_ context.Context) (*MemoryInfoStat, error) {
k, err := p.getKProc() k, err := p.getKProc()
if err != nil { if err != nil {
return nil, err return nil, err

@ -194,7 +194,7 @@ func (p *Process) NiceWithContext(ctx context.Context) (int32, error) {
return nice, nil return nice, nil
} }
func (p *Process) IOniceWithContext(ctx context.Context) (int32, error) { func (p *Process) IOniceWithContext(_ context.Context) (int32, error) {
return 0, common.ErrNotImplementedError return 0, common.ErrNotImplementedError
} }
@ -310,7 +310,7 @@ func (p *Process) TimesWithContext(ctx context.Context) (*cpu.TimesStat, error)
return cpuTimes, nil return cpuTimes, nil
} }
func (p *Process) CPUAffinityWithContext(ctx context.Context) ([]int32, error) { func (p *Process) CPUAffinityWithContext(_ context.Context) ([]int32, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }

@ -37,7 +37,7 @@ func pidsWithContext(ctx context.Context) ([]int32, error) {
return ret, nil return ret, nil
} }
func (p *Process) PpidWithContext(ctx context.Context) (int32, error) { func (p *Process) PpidWithContext(_ context.Context) (int32, error) {
k, err := p.getKProc() k, err := p.getKProc()
if err != nil { if err != nil {
return 0, err return 0, err
@ -69,7 +69,7 @@ func (p *Process) NameWithContext(ctx context.Context) (string, error) {
return name, nil return name, nil
} }
func (p *Process) CwdWithContext(ctx context.Context) (string, error) { func (p *Process) CwdWithContext(_ context.Context) (string, error) {
mib := []int32{CTLKern, KernProcCwd, p.Pid} mib := []int32{CTLKern, KernProcCwd, p.Pid}
buf, _, err := common.CallSyscall(mib) buf, _, err := common.CallSyscall(mib)
if err != nil { if err != nil {
@ -78,11 +78,11 @@ func (p *Process) CwdWithContext(ctx context.Context) (string, error) {
return common.ByteToString(buf), nil return common.ByteToString(buf), nil
} }
func (p *Process) ExeWithContext(ctx context.Context) (string, error) { func (p *Process) ExeWithContext(_ context.Context) (string, error) {
return "", common.ErrNotImplementedError return "", common.ErrNotImplementedError
} }
func (p *Process) CmdlineSliceWithContext(ctx context.Context) ([]string, error) { func (p *Process) CmdlineSliceWithContext(_ context.Context) ([]string, error) {
mib := []int32{CTLKern, KernProcArgs, p.Pid, KernProcArgv} mib := []int32{CTLKern, KernProcArgs, p.Pid, KernProcArgv}
buf, _, err := common.CallSyscall(mib) buf, _, err := common.CallSyscall(mib)
if err != nil { if err != nil {
@ -142,11 +142,11 @@ func (p *Process) CmdlineWithContext(ctx context.Context) (string, error) {
return strings.Join(argv, " "), nil return strings.Join(argv, " "), nil
} }
func (p *Process) createTimeWithContext(ctx context.Context) (int64, error) { func (p *Process) createTimeWithContext(_ context.Context) (int64, error) {
return 0, common.ErrNotImplementedError return 0, common.ErrNotImplementedError
} }
func (p *Process) StatusWithContext(ctx context.Context) ([]string, error) { func (p *Process) StatusWithContext(_ context.Context) ([]string, error) {
k, err := p.getKProc() k, err := p.getKProc()
if err != nil { if err != nil {
return []string{""}, err return []string{""}, err
@ -178,7 +178,7 @@ func (p *Process) ForegroundWithContext(ctx context.Context) (bool, error) {
return strings.IndexByte(string(out), '+') != -1, nil return strings.IndexByte(string(out), '+') != -1, nil
} }
func (p *Process) UidsWithContext(ctx context.Context) ([]uint32, error) { func (p *Process) UidsWithContext(_ context.Context) ([]uint32, error) {
k, err := p.getKProc() k, err := p.getKProc()
if err != nil { if err != nil {
return nil, err return nil, err
@ -191,7 +191,7 @@ func (p *Process) UidsWithContext(ctx context.Context) ([]uint32, error) {
return uids, nil return uids, nil
} }
func (p *Process) GidsWithContext(ctx context.Context) ([]uint32, error) { func (p *Process) GidsWithContext(_ context.Context) ([]uint32, error) {
k, err := p.getKProc() k, err := p.getKProc()
if err != nil { if err != nil {
return nil, err return nil, err
@ -203,7 +203,7 @@ func (p *Process) GidsWithContext(ctx context.Context) ([]uint32, error) {
return gids, nil return gids, nil
} }
func (p *Process) GroupsWithContext(ctx context.Context) ([]uint32, error) { func (p *Process) GroupsWithContext(_ context.Context) ([]uint32, error) {
k, err := p.getKProc() k, err := p.getKProc()
if err != nil { if err != nil {
return nil, err return nil, err
@ -217,7 +217,7 @@ func (p *Process) GroupsWithContext(ctx context.Context) ([]uint32, error) {
return groups, nil return groups, nil
} }
func (p *Process) TerminalWithContext(ctx context.Context) (string, error) { func (p *Process) TerminalWithContext(_ context.Context) (string, error) {
k, err := p.getKProc() k, err := p.getKProc()
if err != nil { if err != nil {
return "", err return "", err
@ -233,7 +233,7 @@ func (p *Process) TerminalWithContext(ctx context.Context) (string, error) {
return termmap[ttyNr], nil return termmap[ttyNr], nil
} }
func (p *Process) NiceWithContext(ctx context.Context) (int32, error) { func (p *Process) NiceWithContext(_ context.Context) (int32, error) {
k, err := p.getKProc() k, err := p.getKProc()
if err != nil { if err != nil {
return 0, err return 0, err
@ -241,7 +241,7 @@ func (p *Process) NiceWithContext(ctx context.Context) (int32, error) {
return int32(k.Nice), nil return int32(k.Nice), nil
} }
func (p *Process) IOCountersWithContext(ctx context.Context) (*IOCountersStat, error) { func (p *Process) IOCountersWithContext(_ context.Context) (*IOCountersStat, error) {
k, err := p.getKProc() k, err := p.getKProc()
if err != nil { if err != nil {
return nil, err return nil, err
@ -252,12 +252,12 @@ func (p *Process) IOCountersWithContext(ctx context.Context) (*IOCountersStat, e
}, nil }, nil
} }
func (p *Process) NumThreadsWithContext(ctx context.Context) (int32, error) { func (p *Process) NumThreadsWithContext(_ context.Context) (int32, error) {
/* not supported, just return 1 */ /* not supported, just return 1 */
return 1, nil return 1, nil
} }
func (p *Process) TimesWithContext(ctx context.Context) (*cpu.TimesStat, error) { func (p *Process) TimesWithContext(_ context.Context) (*cpu.TimesStat, error) {
k, err := p.getKProc() k, err := p.getKProc()
if err != nil { if err != nil {
return nil, err return nil, err
@ -305,11 +305,11 @@ func (p *Process) ChildrenWithContext(ctx context.Context) ([]*Process, error) {
return ret, nil return ret, nil
} }
func (p *Process) ConnectionsWithContext(ctx context.Context) ([]net.ConnectionStat, error) { func (p *Process) ConnectionsWithContext(_ context.Context) ([]net.ConnectionStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func (p *Process) ConnectionsMaxWithContext(ctx context.Context, maxConn int) ([]net.ConnectionStat, error) { func (p *Process) ConnectionsMaxWithContext(_ context.Context, _ int) ([]net.ConnectionStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }

@ -30,174 +30,174 @@ type MemoryMapsStat struct {
type MemoryInfoExStat struct{} type MemoryInfoExStat struct{}
func pidsWithContext(ctx context.Context) ([]int32, error) { func pidsWithContext(_ context.Context) ([]int32, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func ProcessesWithContext(ctx context.Context) ([]*Process, error) { func ProcessesWithContext(_ context.Context) ([]*Process, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func PidExistsWithContext(ctx context.Context, pid int32) (bool, error) { func PidExistsWithContext(_ context.Context, _ int32) (bool, error) {
return false, common.ErrNotImplementedError return false, common.ErrNotImplementedError
} }
func (p *Process) PpidWithContext(ctx context.Context) (int32, error) { func (p *Process) PpidWithContext(_ context.Context) (int32, error) {
return 0, common.ErrNotImplementedError return 0, common.ErrNotImplementedError
} }
func (p *Process) NameWithContext(ctx context.Context) (string, error) { func (p *Process) NameWithContext(_ context.Context) (string, error) {
return "", common.ErrNotImplementedError return "", common.ErrNotImplementedError
} }
func (p *Process) TgidWithContext(ctx context.Context) (int32, error) { func (p *Process) TgidWithContext(_ context.Context) (int32, error) {
return 0, common.ErrNotImplementedError return 0, common.ErrNotImplementedError
} }
func (p *Process) ExeWithContext(ctx context.Context) (string, error) { func (p *Process) ExeWithContext(_ context.Context) (string, error) {
return "", common.ErrNotImplementedError return "", common.ErrNotImplementedError
} }
func (p *Process) CmdlineWithContext(ctx context.Context) (string, error) { func (p *Process) CmdlineWithContext(_ context.Context) (string, error) {
return "", common.ErrNotImplementedError return "", common.ErrNotImplementedError
} }
func (p *Process) CmdlineSliceWithContext(ctx context.Context) ([]string, error) { func (p *Process) CmdlineSliceWithContext(_ context.Context) ([]string, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func (p *Process) createTimeWithContext(ctx context.Context) (int64, error) { func (p *Process) createTimeWithContext(_ context.Context) (int64, error) {
return 0, common.ErrNotImplementedError return 0, common.ErrNotImplementedError
} }
func (p *Process) CwdWithContext(ctx context.Context) (string, error) { func (p *Process) CwdWithContext(_ context.Context) (string, error) {
return "", common.ErrNotImplementedError return "", common.ErrNotImplementedError
} }
func (p *Process) StatusWithContext(ctx context.Context) ([]string, error) { func (p *Process) StatusWithContext(_ context.Context) ([]string, error) {
return []string{""}, common.ErrNotImplementedError return []string{""}, common.ErrNotImplementedError
} }
func (p *Process) ForegroundWithContext(ctx context.Context) (bool, error) { func (p *Process) ForegroundWithContext(_ context.Context) (bool, error) {
return false, common.ErrNotImplementedError return false, common.ErrNotImplementedError
} }
func (p *Process) UidsWithContext(ctx context.Context) ([]uint32, error) { func (p *Process) UidsWithContext(_ context.Context) ([]uint32, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func (p *Process) GidsWithContext(ctx context.Context) ([]uint32, error) { func (p *Process) GidsWithContext(_ context.Context) ([]uint32, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func (p *Process) GroupsWithContext(ctx context.Context) ([]uint32, error) { func (p *Process) GroupsWithContext(_ context.Context) ([]uint32, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func (p *Process) TerminalWithContext(ctx context.Context) (string, error) { func (p *Process) TerminalWithContext(_ context.Context) (string, error) {
return "", common.ErrNotImplementedError return "", common.ErrNotImplementedError
} }
func (p *Process) NiceWithContext(ctx context.Context) (int32, error) { func (p *Process) NiceWithContext(_ context.Context) (int32, error) {
return 0, common.ErrNotImplementedError return 0, common.ErrNotImplementedError
} }
func (p *Process) IOniceWithContext(ctx context.Context) (int32, error) { func (p *Process) IOniceWithContext(_ context.Context) (int32, error) {
return 0, common.ErrNotImplementedError return 0, common.ErrNotImplementedError
} }
func (p *Process) RlimitWithContext(ctx context.Context) ([]RlimitStat, error) { func (p *Process) RlimitWithContext(_ context.Context) ([]RlimitStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func (p *Process) RlimitUsageWithContext(ctx context.Context, gatherUsed bool) ([]RlimitStat, error) { func (p *Process) RlimitUsageWithContext(_ context.Context, _ bool) ([]RlimitStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func (p *Process) IOCountersWithContext(ctx context.Context) (*IOCountersStat, error) { func (p *Process) IOCountersWithContext(_ context.Context) (*IOCountersStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func (p *Process) NumCtxSwitchesWithContext(ctx context.Context) (*NumCtxSwitchesStat, error) { func (p *Process) NumCtxSwitchesWithContext(_ context.Context) (*NumCtxSwitchesStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func (p *Process) NumFDsWithContext(ctx context.Context) (int32, error) { func (p *Process) NumFDsWithContext(_ context.Context) (int32, error) {
return 0, common.ErrNotImplementedError return 0, common.ErrNotImplementedError
} }
func (p *Process) NumThreadsWithContext(ctx context.Context) (int32, error) { func (p *Process) NumThreadsWithContext(_ context.Context) (int32, error) {
return 0, common.ErrNotImplementedError return 0, common.ErrNotImplementedError
} }
func (p *Process) ThreadsWithContext(ctx context.Context) (map[int32]*cpu.TimesStat, error) { func (p *Process) ThreadsWithContext(_ context.Context) (map[int32]*cpu.TimesStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func (p *Process) TimesWithContext(ctx context.Context) (*cpu.TimesStat, error) { func (p *Process) TimesWithContext(_ context.Context) (*cpu.TimesStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func (p *Process) CPUAffinityWithContext(ctx context.Context) ([]int32, error) { func (p *Process) CPUAffinityWithContext(_ context.Context) ([]int32, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func (p *Process) MemoryInfoWithContext(ctx context.Context) (*MemoryInfoStat, error) { func (p *Process) MemoryInfoWithContext(_ context.Context) (*MemoryInfoStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func (p *Process) MemoryInfoExWithContext(ctx context.Context) (*MemoryInfoExStat, error) { func (p *Process) MemoryInfoExWithContext(_ context.Context) (*MemoryInfoExStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func (p *Process) PageFaultsWithContext(ctx context.Context) (*PageFaultsStat, error) { func (p *Process) PageFaultsWithContext(_ context.Context) (*PageFaultsStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func (p *Process) ChildrenWithContext(ctx context.Context) ([]*Process, error) { func (p *Process) ChildrenWithContext(_ context.Context) ([]*Process, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func (p *Process) OpenFilesWithContext(ctx context.Context) ([]OpenFilesStat, error) { func (p *Process) OpenFilesWithContext(_ context.Context) ([]OpenFilesStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func (p *Process) ConnectionsWithContext(ctx context.Context) ([]net.ConnectionStat, error) { func (p *Process) ConnectionsWithContext(_ context.Context) ([]net.ConnectionStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func (p *Process) ConnectionsMaxWithContext(ctx context.Context, maxConn int) ([]net.ConnectionStat, error) { func (p *Process) ConnectionsMaxWithContext(_ context.Context, _ int) ([]net.ConnectionStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func (p *Process) MemoryMapsWithContext(ctx context.Context, grouped bool) (*[]MemoryMapsStat, error) { func (p *Process) MemoryMapsWithContext(_ context.Context, _ bool) (*[]MemoryMapsStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func (p *Process) SendSignalWithContext(ctx context.Context, sig Signal) error { func (p *Process) SendSignalWithContext(_ context.Context, _ Signal) error {
return common.ErrNotImplementedError return common.ErrNotImplementedError
} }
func (p *Process) SuspendWithContext(ctx context.Context) error { func (p *Process) SuspendWithContext(_ context.Context) error {
return common.ErrNotImplementedError return common.ErrNotImplementedError
} }
func (p *Process) ResumeWithContext(ctx context.Context) error { func (p *Process) ResumeWithContext(_ context.Context) error {
return common.ErrNotImplementedError return common.ErrNotImplementedError
} }
func (p *Process) TerminateWithContext(ctx context.Context) error { func (p *Process) TerminateWithContext(_ context.Context) error {
return common.ErrNotImplementedError return common.ErrNotImplementedError
} }
func (p *Process) KillWithContext(ctx context.Context) error { func (p *Process) KillWithContext(_ context.Context) error {
return common.ErrNotImplementedError return common.ErrNotImplementedError
} }
func (p *Process) UsernameWithContext(ctx context.Context) (string, error) { func (p *Process) UsernameWithContext(_ context.Context) (string, error) {
return "", common.ErrNotImplementedError return "", common.ErrNotImplementedError
} }
func (p *Process) EnvironWithContext(ctx context.Context) ([]string, error) { func (p *Process) EnvironWithContext(_ context.Context) ([]string, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }

@ -140,7 +140,7 @@ func PidExistsWithContext(ctx context.Context, pid int32) (bool, error) {
return false, err return false, err
} }
func (p *Process) SendSignalWithContext(ctx context.Context, sig syscall.Signal) error { func (p *Process) SendSignalWithContext(_ context.Context, sig syscall.Signal) error {
process, err := os.FindProcess(int(p.Pid)) process, err := os.FindProcess(int(p.Pid))
if err != nil { if err != nil {
return err return err

@ -52,15 +52,15 @@ func ProcessesWithContext(ctx context.Context) ([]*Process, error) {
return out, nil return out, nil
} }
func (p *Process) PpidWithContext(ctx context.Context) (int32, error) { func (p *Process) PpidWithContext(_ context.Context) (int32, error) {
return 0, common.ErrNotImplementedError return 0, common.ErrNotImplementedError
} }
func (p *Process) NameWithContext(ctx context.Context) (string, error) { func (p *Process) NameWithContext(_ context.Context) (string, error) {
return "", common.ErrNotImplementedError return "", common.ErrNotImplementedError
} }
func (p *Process) TgidWithContext(ctx context.Context) (int32, error) { func (p *Process) TgidWithContext(_ context.Context) (int32, error) {
return 0, common.ErrNotImplementedError return 0, common.ErrNotImplementedError
} }
@ -80,7 +80,7 @@ func (p *Process) CmdlineSliceWithContext(ctx context.Context) ([]string, error)
return p.fillSliceFromCmdlineWithContext(ctx) return p.fillSliceFromCmdlineWithContext(ctx)
} }
func (p *Process) createTimeWithContext(ctx context.Context) (int64, error) { func (p *Process) createTimeWithContext(_ context.Context) (int64, error) {
return 0, common.ErrNotImplementedError return 0, common.ErrNotImplementedError
} }
@ -88,51 +88,51 @@ func (p *Process) CwdWithContext(ctx context.Context) (string, error) {
return p.fillFromPathCwdWithContext(ctx) return p.fillFromPathCwdWithContext(ctx)
} }
func (p *Process) StatusWithContext(ctx context.Context) ([]string, error) { func (p *Process) StatusWithContext(_ context.Context) ([]string, error) {
return []string{""}, common.ErrNotImplementedError return []string{""}, common.ErrNotImplementedError
} }
func (p *Process) ForegroundWithContext(ctx context.Context) (bool, error) { func (p *Process) ForegroundWithContext(_ context.Context) (bool, error) {
return false, common.ErrNotImplementedError return false, common.ErrNotImplementedError
} }
func (p *Process) UidsWithContext(ctx context.Context) ([]uint32, error) { func (p *Process) UidsWithContext(_ context.Context) ([]uint32, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func (p *Process) GidsWithContext(ctx context.Context) ([]uint32, error) { func (p *Process) GidsWithContext(_ context.Context) ([]uint32, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func (p *Process) GroupsWithContext(ctx context.Context) ([]uint32, error) { func (p *Process) GroupsWithContext(_ context.Context) ([]uint32, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func (p *Process) TerminalWithContext(ctx context.Context) (string, error) { func (p *Process) TerminalWithContext(_ context.Context) (string, error) {
return "", common.ErrNotImplementedError return "", common.ErrNotImplementedError
} }
func (p *Process) NiceWithContext(ctx context.Context) (int32, error) { func (p *Process) NiceWithContext(_ context.Context) (int32, error) {
return 0, common.ErrNotImplementedError return 0, common.ErrNotImplementedError
} }
func (p *Process) IOniceWithContext(ctx context.Context) (int32, error) { func (p *Process) IOniceWithContext(_ context.Context) (int32, error) {
return 0, common.ErrNotImplementedError return 0, common.ErrNotImplementedError
} }
func (p *Process) RlimitWithContext(ctx context.Context) ([]RlimitStat, error) { func (p *Process) RlimitWithContext(_ context.Context) ([]RlimitStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func (p *Process) RlimitUsageWithContext(ctx context.Context, gatherUsed bool) ([]RlimitStat, error) { func (p *Process) RlimitUsageWithContext(_ context.Context, _ bool) ([]RlimitStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func (p *Process) IOCountersWithContext(ctx context.Context) (*IOCountersStat, error) { func (p *Process) IOCountersWithContext(_ context.Context) (*IOCountersStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func (p *Process) NumCtxSwitchesWithContext(ctx context.Context) (*NumCtxSwitchesStat, error) { func (p *Process) NumCtxSwitchesWithContext(_ context.Context) (*NumCtxSwitchesStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
@ -141,55 +141,55 @@ func (p *Process) NumFDsWithContext(ctx context.Context) (int32, error) {
return int32(len(fnames)), err return int32(len(fnames)), err
} }
func (p *Process) NumThreadsWithContext(ctx context.Context) (int32, error) { func (p *Process) NumThreadsWithContext(_ context.Context) (int32, error) {
return 0, common.ErrNotImplementedError return 0, common.ErrNotImplementedError
} }
func (p *Process) ThreadsWithContext(ctx context.Context) (map[int32]*cpu.TimesStat, error) { func (p *Process) ThreadsWithContext(_ context.Context) (map[int32]*cpu.TimesStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func (p *Process) TimesWithContext(ctx context.Context) (*cpu.TimesStat, error) { func (p *Process) TimesWithContext(_ context.Context) (*cpu.TimesStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func (p *Process) CPUAffinityWithContext(ctx context.Context) ([]int32, error) { func (p *Process) CPUAffinityWithContext(_ context.Context) ([]int32, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func (p *Process) MemoryInfoWithContext(ctx context.Context) (*MemoryInfoStat, error) { func (p *Process) MemoryInfoWithContext(_ context.Context) (*MemoryInfoStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func (p *Process) MemoryInfoExWithContext(ctx context.Context) (*MemoryInfoExStat, error) { func (p *Process) MemoryInfoExWithContext(_ context.Context) (*MemoryInfoExStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func (p *Process) PageFaultsWithContext(ctx context.Context) (*PageFaultsStat, error) { func (p *Process) PageFaultsWithContext(_ context.Context) (*PageFaultsStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func (p *Process) ChildrenWithContext(ctx context.Context) ([]*Process, error) { func (p *Process) ChildrenWithContext(_ context.Context) ([]*Process, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func (p *Process) OpenFilesWithContext(ctx context.Context) ([]OpenFilesStat, error) { func (p *Process) OpenFilesWithContext(_ context.Context) ([]OpenFilesStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func (p *Process) ConnectionsWithContext(ctx context.Context) ([]net.ConnectionStat, error) { func (p *Process) ConnectionsWithContext(_ context.Context) ([]net.ConnectionStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func (p *Process) ConnectionsMaxWithContext(ctx context.Context, maxConn int) ([]net.ConnectionStat, error) { func (p *Process) ConnectionsMaxWithContext(_ context.Context, _ int) ([]net.ConnectionStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func (p *Process) MemoryMapsWithContext(ctx context.Context, grouped bool) (*[]MemoryMapsStat, error) { func (p *Process) MemoryMapsWithContext(_ context.Context, _ bool) (*[]MemoryMapsStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func (p *Process) EnvironWithContext(ctx context.Context) ([]string, error) { func (p *Process) EnvironWithContext(_ context.Context) ([]string, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }

@ -241,7 +241,7 @@ func init() {
0) 0)
} }
func pidsWithContext(ctx context.Context) ([]int32, error) { func pidsWithContext(_ context.Context) ([]int32, error) {
// inspired by https://gist.github.com/henkman/3083408 // inspired by https://gist.github.com/henkman/3083408
// and https://github.com/giampaolo/psutil/blob/1c3a15f637521ba5c0031283da39c733fda53e4c/psutil/arch/windows/process_info.c#L315-L329 // and https://github.com/giampaolo/psutil/blob/1c3a15f637521ba5c0031283da39c733fda53e4c/psutil/arch/windows/process_info.c#L315-L329
var ret []int32 var ret []int32
@ -302,7 +302,7 @@ func PidExistsWithContext(ctx context.Context, pid int32) (bool, error) {
return event == uint32(windows.WAIT_TIMEOUT), err return event == uint32(windows.WAIT_TIMEOUT), err
} }
func (p *Process) PpidWithContext(ctx context.Context) (int32, error) { func (p *Process) PpidWithContext(_ context.Context) (int32, error) {
// if cached already, return from cache // if cached already, return from cache
cachedPpid := p.getPpid() cachedPpid := p.getPpid()
if cachedPpid != 0 { if cachedPpid != 0 {
@ -336,11 +336,11 @@ func (p *Process) NameWithContext(ctx context.Context) (string, error) {
return filepath.Base(exe), nil return filepath.Base(exe), nil
} }
func (p *Process) TgidWithContext(ctx context.Context) (int32, error) { func (p *Process) TgidWithContext(_ context.Context) (int32, error) {
return 0, common.ErrNotImplementedError return 0, common.ErrNotImplementedError
} }
func (p *Process) ExeWithContext(ctx context.Context) (string, error) { func (p *Process) ExeWithContext(_ context.Context) (string, error) {
c, err := windows.OpenProcess(processQueryInformation, false, uint32(p.Pid)) c, err := windows.OpenProcess(processQueryInformation, false, uint32(p.Pid))
if err != nil { if err != nil {
return "", err return "", err
@ -403,7 +403,7 @@ func parseCmdline(cmdline string) ([]string, error) {
return argv, nil return argv, nil
} }
func (p *Process) createTimeWithContext(ctx context.Context) (int64, error) { func (p *Process) createTimeWithContext(_ context.Context) (int64, error) {
ru, err := getRusage(p.Pid) ru, err := getRusage(p.Pid)
if err != nil { if err != nil {
return 0, fmt.Errorf("could not get CreationDate: %w", err) return 0, fmt.Errorf("could not get CreationDate: %w", err)
@ -456,15 +456,15 @@ func (p *Process) CwdWithContext(_ context.Context) (string, error) {
return "", nil return "", nil
} }
func (p *Process) StatusWithContext(ctx context.Context) ([]string, error) { func (p *Process) StatusWithContext(_ context.Context) ([]string, error) {
return []string{""}, common.ErrNotImplementedError return []string{""}, common.ErrNotImplementedError
} }
func (p *Process) ForegroundWithContext(ctx context.Context) (bool, error) { func (p *Process) ForegroundWithContext(_ context.Context) (bool, error) {
return false, common.ErrNotImplementedError return false, common.ErrNotImplementedError
} }
func (p *Process) UsernameWithContext(ctx context.Context) (string, error) { func (p *Process) UsernameWithContext(_ context.Context) (string, error) {
pid := p.Pid pid := p.Pid
c, err := windows.OpenProcess(processQueryInformation, false, uint32(pid)) c, err := windows.OpenProcess(processQueryInformation, false, uint32(pid))
if err != nil { if err != nil {
@ -487,19 +487,19 @@ func (p *Process) UsernameWithContext(ctx context.Context) (string, error) {
return domain + "\\" + user, err return domain + "\\" + user, err
} }
func (p *Process) UidsWithContext(ctx context.Context) ([]uint32, error) { func (p *Process) UidsWithContext(_ context.Context) ([]uint32, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func (p *Process) GidsWithContext(ctx context.Context) ([]uint32, error) { func (p *Process) GidsWithContext(_ context.Context) ([]uint32, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func (p *Process) GroupsWithContext(ctx context.Context) ([]uint32, error) { func (p *Process) GroupsWithContext(_ context.Context) ([]uint32, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func (p *Process) TerminalWithContext(ctx context.Context) (string, error) { func (p *Process) TerminalWithContext(_ context.Context) (string, error) {
return "", common.ErrNotImplementedError return "", common.ErrNotImplementedError
} }
@ -515,7 +515,7 @@ var priorityClasses = map[int]int32{
0x00000100: 24, // REALTIME_PRIORITY_CLASS 0x00000100: 24, // REALTIME_PRIORITY_CLASS
} }
func (p *Process) NiceWithContext(ctx context.Context) (int32, error) { func (p *Process) NiceWithContext(_ context.Context) (int32, error) {
c, err := windows.OpenProcess(processQueryInformation, false, uint32(p.Pid)) c, err := windows.OpenProcess(processQueryInformation, false, uint32(p.Pid))
if err != nil { if err != nil {
return 0, err return 0, err
@ -532,19 +532,19 @@ func (p *Process) NiceWithContext(ctx context.Context) (int32, error) {
return priority, nil return priority, nil
} }
func (p *Process) IOniceWithContext(ctx context.Context) (int32, error) { func (p *Process) IOniceWithContext(_ context.Context) (int32, error) {
return 0, common.ErrNotImplementedError return 0, common.ErrNotImplementedError
} }
func (p *Process) RlimitWithContext(ctx context.Context) ([]RlimitStat, error) { func (p *Process) RlimitWithContext(_ context.Context) ([]RlimitStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func (p *Process) RlimitUsageWithContext(ctx context.Context, gatherUsed bool) ([]RlimitStat, error) { func (p *Process) RlimitUsageWithContext(_ context.Context, _ bool) ([]RlimitStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func (p *Process) IOCountersWithContext(ctx context.Context) (*IOCountersStat, error) { func (p *Process) IOCountersWithContext(_ context.Context) (*IOCountersStat, error) {
c, err := windows.OpenProcess(processQueryInformation, false, uint32(p.Pid)) c, err := windows.OpenProcess(processQueryInformation, false, uint32(p.Pid))
if err != nil { if err != nil {
return nil, err return nil, err
@ -565,13 +565,13 @@ func (p *Process) IOCountersWithContext(ctx context.Context) (*IOCountersStat, e
return stats, nil return stats, nil
} }
func (p *Process) NumCtxSwitchesWithContext(ctx context.Context) (*NumCtxSwitchesStat, error) { func (p *Process) NumCtxSwitchesWithContext(_ context.Context) (*NumCtxSwitchesStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
// NumFDsWithContext returns the number of handles for a process on Windows, // NumFDsWithContext returns the number of handles for a process on Windows,
// not the number of file descriptors (FDs). // not the number of file descriptors (FDs).
func (p *Process) NumFDsWithContext(ctx context.Context) (int32, error) { func (p *Process) NumFDsWithContext(_ context.Context) (int32, error) {
handle, err := windows.OpenProcess(processQueryInformation, false, uint32(p.Pid)) handle, err := windows.OpenProcess(processQueryInformation, false, uint32(p.Pid))
if err != nil { if err != nil {
return 0, err return 0, err
@ -586,7 +586,7 @@ func (p *Process) NumFDsWithContext(ctx context.Context) (int32, error) {
return int32(handleCount), nil return int32(handleCount), nil
} }
func (p *Process) NumThreadsWithContext(ctx context.Context) (int32, error) { func (p *Process) NumThreadsWithContext(_ context.Context) (int32, error) {
ppid, ret, _, err := getFromSnapProcess(p.Pid) ppid, ret, _, err := getFromSnapProcess(p.Pid)
if err != nil { if err != nil {
return 0, err return 0, err
@ -601,11 +601,11 @@ func (p *Process) NumThreadsWithContext(ctx context.Context) (int32, error) {
return ret, nil return ret, nil
} }
func (p *Process) ThreadsWithContext(ctx context.Context) (map[int32]*cpu.TimesStat, error) { func (p *Process) ThreadsWithContext(_ context.Context) (map[int32]*cpu.TimesStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func (p *Process) TimesWithContext(ctx context.Context) (*cpu.TimesStat, error) { func (p *Process) TimesWithContext(_ context.Context) (*cpu.TimesStat, error) {
sysTimes, err := getProcessCPUTimes(p.Pid) sysTimes, err := getProcessCPUTimes(p.Pid)
if err != nil { if err != nil {
return nil, err return nil, err
@ -629,11 +629,11 @@ func (p *Process) TimesWithContext(ctx context.Context) (*cpu.TimesStat, error)
}, nil }, nil
} }
func (p *Process) CPUAffinityWithContext(ctx context.Context) ([]int32, error) { func (p *Process) CPUAffinityWithContext(_ context.Context) ([]int32, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func (p *Process) MemoryInfoWithContext(ctx context.Context) (*MemoryInfoStat, error) { func (p *Process) MemoryInfoWithContext(_ context.Context) (*MemoryInfoStat, error) {
mem, err := getMemoryInfo(p.Pid) mem, err := getMemoryInfo(p.Pid)
if err != nil { if err != nil {
return nil, err return nil, err
@ -647,11 +647,11 @@ func (p *Process) MemoryInfoWithContext(ctx context.Context) (*MemoryInfoStat, e
return ret, nil return ret, nil
} }
func (p *Process) MemoryInfoExWithContext(ctx context.Context) (*MemoryInfoExStat, error) { func (p *Process) MemoryInfoExWithContext(_ context.Context) (*MemoryInfoExStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func (p *Process) PageFaultsWithContext(ctx context.Context) (*PageFaultsStat, error) { func (p *Process) PageFaultsWithContext(_ context.Context) (*PageFaultsStat, error) {
mem, err := getMemoryInfo(p.Pid) mem, err := getMemoryInfo(p.Pid)
if err != nil { if err != nil {
return nil, err return nil, err
@ -788,19 +788,19 @@ func (p *Process) ConnectionsWithContext(ctx context.Context) ([]net.ConnectionS
return net.ConnectionsPidWithContext(ctx, "all", p.Pid) return net.ConnectionsPidWithContext(ctx, "all", p.Pid)
} }
func (p *Process) ConnectionsMaxWithContext(ctx context.Context, maxConn int) ([]net.ConnectionStat, error) { func (p *Process) ConnectionsMaxWithContext(_ context.Context, _ int) ([]net.ConnectionStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func (p *Process) MemoryMapsWithContext(ctx context.Context, grouped bool) (*[]MemoryMapsStat, error) { func (p *Process) MemoryMapsWithContext(_ context.Context, _ bool) (*[]MemoryMapsStat, error) {
return nil, common.ErrNotImplementedError return nil, common.ErrNotImplementedError
} }
func (p *Process) SendSignalWithContext(ctx context.Context, sig syscall.Signal) error { func (p *Process) SendSignalWithContext(_ context.Context, _ syscall.Signal) error {
return common.ErrNotImplementedError return common.ErrNotImplementedError
} }
func (p *Process) SuspendWithContext(ctx context.Context) error { func (p *Process) SuspendWithContext(_ context.Context) error {
c, err := windows.OpenProcess(windows.PROCESS_SUSPEND_RESUME, false, uint32(p.Pid)) c, err := windows.OpenProcess(windows.PROCESS_SUSPEND_RESUME, false, uint32(p.Pid))
if err != nil { if err != nil {
return err return err
@ -816,7 +816,7 @@ func (p *Process) SuspendWithContext(ctx context.Context) error {
return nil return nil
} }
func (p *Process) ResumeWithContext(ctx context.Context) error { func (p *Process) ResumeWithContext(_ context.Context) error {
c, err := windows.OpenProcess(windows.PROCESS_SUSPEND_RESUME, false, uint32(p.Pid)) c, err := windows.OpenProcess(windows.PROCESS_SUSPEND_RESUME, false, uint32(p.Pid))
if err != nil { if err != nil {
return err return err
@ -832,7 +832,7 @@ func (p *Process) ResumeWithContext(ctx context.Context) error {
return nil return nil
} }
func (p *Process) TerminateWithContext(ctx context.Context) error { func (p *Process) TerminateWithContext(_ context.Context) error {
proc, err := windows.OpenProcess(windows.PROCESS_TERMINATE, false, uint32(p.Pid)) proc, err := windows.OpenProcess(windows.PROCESS_TERMINATE, false, uint32(p.Pid))
if err != nil { if err != nil {
return err return err
@ -842,7 +842,7 @@ func (p *Process) TerminateWithContext(ctx context.Context) error {
return err return err
} }
func (p *Process) KillWithContext(ctx context.Context) error { func (p *Process) KillWithContext(_ context.Context) error {
process, err := os.FindProcess(int(p.Pid)) process, err := os.FindProcess(int(p.Pid))
if err != nil { if err != nil {
return err return err

@ -11,7 +11,7 @@ import (
"github.com/shirou/gopsutil/v4/internal/common" "github.com/shirou/gopsutil/v4/internal/common"
) )
func TemperaturesWithContext(ctx context.Context) ([]TemperatureStat, error) { func TemperaturesWithContext(_ context.Context) ([]TemperatureStat, error) {
ioKit, err := common.NewLibrary(common.IOKit) ioKit, err := common.NewLibrary(common.IOKit)
if err != nil { if err != nil {
return nil, err return nil, err

@ -15,7 +15,7 @@ func ReadTemperaturesArm() []TemperatureStat {
return temperatures return temperatures
} }
func TemperaturesWithContext(ctx context.Context) ([]TemperatureStat, error) { func TemperaturesWithContext(_ context.Context) ([]TemperatureStat, error) {
ioKit, err := common.NewLibrary(common.IOKit) ioKit, err := common.NewLibrary(common.IOKit)
if err != nil { if err != nil {
return nil, err return nil, err

@ -9,6 +9,6 @@ import (
"github.com/shirou/gopsutil/v4/internal/common" "github.com/shirou/gopsutil/v4/internal/common"
) )
func TemperaturesWithContext(ctx context.Context) ([]TemperatureStat, error) { func TemperaturesWithContext(_ context.Context) ([]TemperatureStat, error) {
return []TemperatureStat{}, common.ErrNotImplementedError return []TemperatureStat{}, common.ErrNotImplementedError
} }

@ -9,6 +9,6 @@ import (
"github.com/shirou/gopsutil/v4/internal/common" "github.com/shirou/gopsutil/v4/internal/common"
) )
func TemperaturesWithContext(ctx context.Context) ([]TemperatureStat, error) { func TemperaturesWithContext(_ context.Context) ([]TemperatureStat, error) {
return []TemperatureStat{}, common.ErrNotImplementedError return []TemperatureStat{}, common.ErrNotImplementedError
} }

@ -9,6 +9,6 @@ import (
"github.com/shirou/gopsutil/v4/internal/common" "github.com/shirou/gopsutil/v4/internal/common"
) )
func TemperaturesWithContext(ctx context.Context) ([]TemperatureStat, error) { func TemperaturesWithContext(_ context.Context) ([]TemperatureStat, error) {
return []TemperatureStat{}, common.ErrNotImplementedError return []TemperatureStat{}, common.ErrNotImplementedError
} }

@ -9,6 +9,6 @@ import (
"github.com/shirou/gopsutil/v4/internal/common" "github.com/shirou/gopsutil/v4/internal/common"
) )
func TemperaturesWithContext(ctx context.Context) ([]TemperatureStat, error) { func TemperaturesWithContext(_ context.Context) ([]TemperatureStat, error) {
return []TemperatureStat{}, common.ErrNotImplementedError return []TemperatureStat{}, common.ErrNotImplementedError
} }

@ -72,7 +72,7 @@ func (s *Service) QueryServiceConfig() (mgr.Config, error) {
// QueryServiceConfigWithContext call QueryServiceConfig() and QueryServiceConfig2() // QueryServiceConfigWithContext call QueryServiceConfig() and QueryServiceConfig2()
// implement windows https://msdn.microsoft.com/en-us/library/windows/desktop/ms684932(v=vs.85).aspx // implement windows https://msdn.microsoft.com/en-us/library/windows/desktop/ms684932(v=vs.85).aspx
func (s *Service) QueryServiceConfigWithContext(ctx context.Context) (mgr.Config, error) { func (s *Service) QueryServiceConfigWithContext(_ context.Context) (mgr.Config, error) {
return s.srv.Config() return s.srv.Config()
} }
@ -82,7 +82,7 @@ func (s *Service) QueryStatus() (ServiceStatus, error) {
} }
// QueryStatusWithContext return the specified name service currentState and ControlsAccepted // QueryStatusWithContext return the specified name service currentState and ControlsAccepted
func (s *Service) QueryStatusWithContext(ctx context.Context) (ServiceStatus, error) { func (s *Service) QueryStatusWithContext(_ context.Context) (ServiceStatus, error) {
var p *windows.SERVICE_STATUS_PROCESS var p *windows.SERVICE_STATUS_PROCESS
var bytesNeeded uint32 var bytesNeeded uint32
var buf []byte var buf []byte

Loading…
Cancel
Save