diff --git a/go.mod b/go.mod
index 49e2e563521..d1b3c4917c2 100644
--- a/go.mod
+++ b/go.mod
@@ -74,7 +74,7 @@ require (
github.com/okzk/sdnotify v0.0.0-20240725214427-1c1fdd37c5ac
github.com/pierrec/lz4/v4 v4.1.22
github.com/prometheus/procfs v0.15.1
- github.com/shirou/gopsutil/v4 v4.24.11
+ github.com/shirou/gopsutil/v4 v4.24.12
github.com/thanos-io/objstore v0.0.0-20241226233006-a14268e0e939
github.com/tjhop/slog-gokit v0.1.2
github.com/twmb/franz-go v1.18.0
diff --git a/go.sum b/go.sum
index 5a26457ed85..0acffd867c8 100644
--- a/go.sum
+++ b/go.sum
@@ -1664,8 +1664,8 @@ github.com/sercand/kuberesolver/v5 v5.1.1 h1:CYH+d67G0sGBj7q5wLK61yzqJJ8gLLC8aep
github.com/sercand/kuberesolver/v5 v5.1.1/go.mod h1:Fs1KbKhVRnB2aDWN12NjKCB+RgYMWZJ294T3BtmVCpQ=
github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ=
github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
-github.com/shirou/gopsutil/v4 v4.24.11 h1:WaU9xqGFKvFfsUv94SXcUPD7rCkU0vr/asVdQOBZNj8=
-github.com/shirou/gopsutil/v4 v4.24.11/go.mod h1:s4D/wg+ag4rG0WO7AiTj2BeYCRhym0vM7DHbZRxnIT8=
+github.com/shirou/gopsutil/v4 v4.24.12 h1:qvePBOk20e0IKA1QXrIIU+jmk+zEiYVVx06WjBRlZo4=
+github.com/shirou/gopsutil/v4 v4.24.12/go.mod h1:DCtMPAad2XceTeIAbGyVfycbYQNBGk2P8cvDi7/VN9o=
github.com/shopspring/decimal v1.2.0 h1:abSATXmQEYyShuxI4/vyW3tV1MrKAJzCZ/0zLUXYbsQ=
github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
github.com/shurcooL/httpfs v0.0.0-20230704072500-f1e31cf0ba5c h1:aqg5Vm5dwtvL+YgDpBcK1ITf3o96N/K7/wsRXQnUTEs=
diff --git a/vendor/github.com/shirou/gopsutil/v4/cpu/cpu.go b/vendor/github.com/shirou/gopsutil/v4/cpu/cpu.go
index 56f53c3a1ac..9bc3dfb51af 100644
--- a/vendor/github.com/shirou/gopsutil/v4/cpu/cpu.go
+++ b/vendor/github.com/shirou/gopsutil/v4/cpu/cpu.go
@@ -4,6 +4,7 @@ package cpu
import (
"context"
"encoding/json"
+ "errors"
"fmt"
"math"
"runtime"
@@ -195,7 +196,7 @@ func percentUsedFromLastCallWithContext(ctx context.Context, percpu bool) ([]flo
}
if lastTimes == nil {
- return nil, fmt.Errorf("error getting times for cpu percent. lastTimes was nil")
+ return nil, errors.New("error getting times for cpu percent. lastTimes was nil")
}
return calculateAllBusy(lastTimes, cpuTimes)
}
diff --git a/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_darwin_arm64.go b/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_darwin_arm64.go
index 50318424390..09427003403 100644
--- a/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_darwin_arm64.go
+++ b/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_darwin_arm64.go
@@ -55,10 +55,10 @@ func getFrequency() (float64, error) {
break
}
- buf := make([]byte, 512)
- ioRegistryEntryGetName(service, &buf[0])
+ buf := common.NewCStr(512)
+ ioRegistryEntryGetName(service, buf)
- if common.GoString(&buf[0]) == "pmgr" {
+ if buf.GoString() == "pmgr" {
pCoreRef := ioRegistryEntryCreateCFProperty(service, uintptr(pCorekey), common.KCFAllocatorDefault, common.KNilOptions)
length := cfDataGetLength(uintptr(pCoreRef))
data := cfDataGetBytePtr(uintptr(pCoreRef))
diff --git a/vendor/github.com/shirou/gopsutil/v4/internal/common/common_darwin.go b/vendor/github.com/shirou/gopsutil/v4/internal/common/common_darwin.go
index b473f88666e..2de3bb14568 100644
--- a/vendor/github.com/shirou/gopsutil/v4/internal/common/common_darwin.go
+++ b/vendor/github.com/shirou/gopsutil/v4/internal/common/common_darwin.go
@@ -125,7 +125,7 @@ type (
IOServiceOpenFunc func(service, owningTask, connType uint32, connect *uint32) int
IOServiceCloseFunc func(connect uint32) int
IOIteratorNextFunc func(iterator uint32) uint32
- IORegistryEntryGetNameFunc func(entry uint32, name *byte) int
+ IORegistryEntryGetNameFunc func(entry uint32, name CStr) int
IORegistryEntryGetParentEntryFunc func(entry uint32, plane string, parent *uint32) int
IORegistryEntryCreateCFPropertyFunc func(entry uint32, key, allocator uintptr, options uint32) unsafe.Pointer
IORegistryEntryCreateCFPropertiesFunc func(entry uint32, properties unsafe.Pointer, allocator uintptr, options uint32) int
@@ -191,7 +191,7 @@ type (
CFArrayGetValueAtIndexFunc func(theArray uintptr, index int32) unsafe.Pointer
CFStringCreateMutableFunc func(alloc uintptr, maxLength int32) unsafe.Pointer
CFStringGetLengthFunc func(theString uintptr) int32
- CFStringGetCStringFunc func(theString uintptr, buffer *byte, bufferSize int32, encoding uint32)
+ CFStringGetCStringFunc func(theString uintptr, buffer CStr, bufferSize int32, encoding uint32)
CFStringCreateWithCStringFunc func(alloc uintptr, cStr string, encoding uint32) unsafe.Pointer
CFDataGetLengthFunc func(theData uintptr) int32
CFDataGetBytePtrFunc func(theData uintptr) unsafe.Pointer
@@ -348,6 +348,44 @@ func (s *SMC) Close() error {
return nil
}
+type CStr []byte
+
+func NewCStr(length int32) CStr {
+ return make(CStr, length)
+}
+
+func (s CStr) Length() int32 {
+ // Include null terminator to make CFStringGetCString properly functions
+ return int32(len(s)) + 1
+}
+
+func (s CStr) Ptr() *byte {
+ if len(s) < 1 {
+ return nil
+ }
+
+ return &s[0]
+}
+
+func (c CStr) Addr() uintptr {
+ return uintptr(unsafe.Pointer(c.Ptr()))
+}
+
+func (s CStr) GoString() string {
+ if s == nil {
+ return ""
+ }
+
+ var length int
+ for _, char := range s {
+ if char == '\x00' {
+ break
+ }
+ length++
+ }
+ return string(s[:length])
+}
+
// https://github.com/ebitengine/purego/blob/main/internal/strings/strings.go#L26
func GoString(cStr *byte) string {
if cStr == nil {
diff --git a/vendor/github.com/shirou/gopsutil/v4/internal/common/common_linux.go b/vendor/github.com/shirou/gopsutil/v4/internal/common/common_linux.go
index 541de93d357..277034f3728 100644
--- a/vendor/github.com/shirou/gopsutil/v4/internal/common/common_linux.go
+++ b/vendor/github.com/shirou/gopsutil/v4/internal/common/common_linux.go
@@ -5,7 +5,7 @@ package common
import (
"context"
- "fmt"
+ "errors"
"os"
"os/exec"
"path/filepath"
@@ -102,7 +102,7 @@ func BootTimeWithContext(ctx context.Context, enableCache bool) (uint64, error)
currentTime := float64(time.Now().UnixNano()) / float64(time.Second)
if len(lines) != 1 {
- return 0, fmt.Errorf("wrong uptime format")
+ return 0, errors.New("wrong uptime format")
}
f := strings.Fields(lines[0])
b, err := strconv.ParseFloat(f[0], 64)
@@ -142,7 +142,7 @@ func readBootTimeStat(ctx context.Context) (uint64, error) {
if strings.HasPrefix(line, "btime") {
f := strings.Fields(line)
if len(f) != 2 {
- return 0, fmt.Errorf("wrong btime format")
+ return 0, errors.New("wrong btime format")
}
b, err := strconv.ParseInt(f[1], 10, 64)
if err != nil {
@@ -151,7 +151,7 @@ func readBootTimeStat(ctx context.Context) (uint64, error) {
t := uint64(b)
return t, nil
}
- return 0, fmt.Errorf("could not find btime")
+ return 0, errors.New("could not find btime")
}
func Virtualization() (string, string, error) {
diff --git a/vendor/github.com/shirou/gopsutil/v4/net/net.go b/vendor/github.com/shirou/gopsutil/v4/net/net.go
index 3890eda5308..74af54a45d8 100644
--- a/vendor/github.com/shirou/gopsutil/v4/net/net.go
+++ b/vendor/github.com/shirou/gopsutil/v4/net/net.go
@@ -272,3 +272,85 @@ func getIOCountersAll(n []IOCountersStat) ([]IOCountersStat, error) {
return []IOCountersStat{r}, nil
}
+
+// NetIOCounters returns network I/O statistics for every network
+// interface installed on the system. If pernic argument is false,
+// return only sum of all information (which name is 'all'). If true,
+// every network interface installed on the system is returned
+// separately.
+func IOCounters(pernic bool) ([]IOCountersStat, error) {
+ return IOCountersWithContext(context.Background(), pernic)
+}
+
+func IOCountersByFile(pernic bool, filename string) ([]IOCountersStat, error) {
+ return IOCountersByFileWithContext(context.Background(), pernic, filename)
+}
+
+// ProtoCounters returns network statistics for the entire system
+// If protocols is empty then all protocols are returned, otherwise
+// just the protocols in the list are returned.
+// Available protocols:
+// [ip,icmp,icmpmsg,tcp,udp,udplite]
+// Not Implemented for FreeBSD, Windows, OpenBSD, Darwin
+func ProtoCounters(protocols []string) ([]ProtoCountersStat, error) {
+ return ProtoCountersWithContext(context.Background(), protocols)
+}
+
+// NetFilterCounters returns iptables conntrack statistics
+// the currently in use conntrack count and the max.
+// If the file does not exist or is invalid it will return nil.
+func FilterCounters() ([]FilterStat, error) {
+ return FilterCountersWithContext(context.Background())
+}
+
+// ConntrackStats returns more detailed info about the conntrack table
+func ConntrackStats(percpu bool) ([]ConntrackStat, error) {
+ return ConntrackStatsWithContext(context.Background(), percpu)
+}
+
+// Return a list of network connections opened.
+func Connections(kind string) ([]ConnectionStat, error) {
+ return ConnectionsWithContext(context.Background(), kind)
+}
+
+// Return a list of network connections opened returning at most `max`
+// connections for each running process.
+func ConnectionsMax(kind string, maxConn int) ([]ConnectionStat, error) {
+ return ConnectionsMaxWithContext(context.Background(), kind, maxConn)
+}
+
+// Return a list of network connections opened, omitting `Uids`.
+// WithoutUids functions are reliant on implementation details. They may be altered to be an alias for Connections or be
+// removed from the API in the future.
+func ConnectionsWithoutUids(kind string) ([]ConnectionStat, error) {
+ return ConnectionsWithoutUidsWithContext(context.Background(), kind)
+}
+
+// Return a list of network connections opened by a process.
+func ConnectionsPid(kind string, pid int32) ([]ConnectionStat, error) {
+ return ConnectionsPidWithContext(context.Background(), kind, pid)
+}
+
+// Return a list of network connections opened, omitting `Uids`.
+// WithoutUids functions are reliant on implementation details. They may be altered to be an alias for Connections or be
+// removed from the API in the future.
+func ConnectionsPidWithoutUids(kind string, pid int32) ([]ConnectionStat, error) {
+ return ConnectionsPidWithoutUidsWithContext(context.Background(), kind, pid)
+}
+
+func ConnectionsPidMaxWithoutUids(kind string, pid int32, maxConn int) ([]ConnectionStat, error) {
+ return ConnectionsPidMaxWithoutUidsWithContext(context.Background(), kind, pid, maxConn)
+}
+
+// Return up to `max` network connections opened by a process.
+func ConnectionsPidMax(kind string, pid int32, maxConn int) ([]ConnectionStat, error) {
+ return ConnectionsPidMaxWithContext(context.Background(), kind, pid, maxConn)
+}
+
+// Pids retunres all pids.
+// Note: this is a copy of process_linux.Pids()
+// FIXME: Import process occures import cycle.
+// move to common made other platform breaking. Need consider.
+func Pids() ([]int32, error) {
+ return PidsWithContext(context.Background())
+}
diff --git a/vendor/github.com/shirou/gopsutil/v4/net/net_aix.go b/vendor/github.com/shirou/gopsutil/v4/net/net_aix.go
index 08a100d811a..9df01e31800 100644
--- a/vendor/github.com/shirou/gopsutil/v4/net/net_aix.go
+++ b/vendor/github.com/shirou/gopsutil/v4/net/net_aix.go
@@ -14,39 +14,23 @@ import (
"github.com/shirou/gopsutil/v4/internal/common"
)
-func IOCounters(pernic bool) ([]IOCountersStat, error) {
- return IOCountersWithContext(context.Background(), pernic)
-}
-
-// IOCountersByFile exists just for compatibility with Linux.
-func IOCountersByFile(pernic bool, filename string) ([]IOCountersStat, error) {
- return IOCountersByFileWithContext(context.Background(), pernic, filename)
+// Deprecated: use process.PidsWithContext instead
+func PidsWithContext(ctx context.Context) ([]int32, error) {
+ return nil, common.ErrNotImplementedError
}
func IOCountersByFileWithContext(ctx context.Context, pernic bool, filename string) ([]IOCountersStat, error) {
return IOCounters(pernic)
}
-func FilterCounters() ([]FilterStat, error) {
- return FilterCountersWithContext(context.Background())
-}
-
func FilterCountersWithContext(ctx context.Context) ([]FilterStat, error) {
return nil, common.ErrNotImplementedError
}
-func ConntrackStats(percpu bool) ([]ConntrackStat, error) {
- return ConntrackStatsWithContext(context.Background(), percpu)
-}
-
func ConntrackStatsWithContext(ctx context.Context, percpu bool) ([]ConntrackStat, error) {
return nil, common.ErrNotImplementedError
}
-func ProtoCounters(protocols []string) ([]ProtoCountersStat, error) {
- return ProtoCountersWithContext(context.Background(), protocols)
-}
-
func ProtoCountersWithContext(ctx context.Context, protocols []string) ([]ProtoCountersStat, error) {
return nil, common.ErrNotImplementedError
}
@@ -250,10 +234,6 @@ func parseNetstatA(output string, kind string) ([]ConnectionStat, error) {
return ret, nil
}
-func Connections(kind string) ([]ConnectionStat, error) {
- return ConnectionsWithContext(context.Background(), kind)
-}
-
func ConnectionsWithContext(ctx context.Context, kind string) ([]ConnectionStat, error) {
args := []string{"-na"}
switch strings.ToLower(kind) {
@@ -286,19 +266,8 @@ func ConnectionsWithContext(ctx context.Context, kind string) ([]ConnectionStat,
return ret, nil
}
-func ConnectionsMax(kind string, maxConn int) ([]ConnectionStat, error) {
- return ConnectionsMaxWithContext(context.Background(), kind, maxConn)
-}
-
func ConnectionsMaxWithContext(ctx context.Context, kind string, maxConn int) ([]ConnectionStat, error) {
- return []ConnectionStat{}, common.ErrNotImplementedError
-}
-
-// Return a list of network connections opened, omitting `Uids`.
-// WithoutUids functions are reliant on implementation details. They may be altered to be an alias for Connections or be
-// removed from the API in the future.
-func ConnectionsWithoutUids(kind string) ([]ConnectionStat, error) {
- return ConnectionsWithoutUidsWithContext(context.Background(), kind)
+ return ConnectionsPidMaxWithContext(ctx, kind, 0, maxConn)
}
func ConnectionsWithoutUidsWithContext(ctx context.Context, kind string) ([]ConnectionStat, error) {
@@ -309,22 +278,22 @@ func ConnectionsMaxWithoutUidsWithContext(ctx context.Context, kind string, maxC
return ConnectionsPidMaxWithoutUidsWithContext(ctx, kind, 0, maxConn)
}
-func ConnectionsPidWithoutUids(kind string, pid int32) ([]ConnectionStat, error) {
- return ConnectionsPidWithoutUidsWithContext(context.Background(), kind, pid)
+func ConnectionsPidWithContext(ctx context.Context, kind string, pid int32) ([]ConnectionStat, error) {
+ return ConnectionsPidMaxWithContext(ctx, kind, pid, 0)
}
func ConnectionsPidWithoutUidsWithContext(ctx context.Context, kind string, pid int32) ([]ConnectionStat, error) {
return ConnectionsPidMaxWithoutUidsWithContext(ctx, kind, pid, 0)
}
-func ConnectionsPidMaxWithoutUids(kind string, pid int32, maxConn int) ([]ConnectionStat, error) {
- return ConnectionsPidMaxWithoutUidsWithContext(context.Background(), kind, pid, maxConn)
+func ConnectionsPidMaxWithContext(ctx context.Context, kind string, pid int32, maxConn int) ([]ConnectionStat, error) {
+ return connectionsPidMaxWithoutUidsWithContext(ctx, kind, pid, maxConn, false)
}
func ConnectionsPidMaxWithoutUidsWithContext(ctx context.Context, kind string, pid int32, maxConn int) ([]ConnectionStat, error) {
- return connectionsPidMaxWithoutUidsWithContext(ctx, kind, pid, maxConn)
+ return connectionsPidMaxWithoutUidsWithContext(ctx, kind, pid, maxConn, true)
}
-func connectionsPidMaxWithoutUidsWithContext(ctx context.Context, kind string, pid int32, maxConn int) ([]ConnectionStat, error) {
+func connectionsPidMaxWithoutUidsWithContext(ctx context.Context, kind string, pid int32, maxConn int, skipUids bool) ([]ConnectionStat, error) {
return []ConnectionStat{}, common.ErrNotImplementedError
}
diff --git a/vendor/github.com/shirou/gopsutil/v4/net/net_darwin.go b/vendor/github.com/shirou/gopsutil/v4/net/net_darwin.go
index 8f3f4d386dd..86c541e93e0 100644
--- a/vendor/github.com/shirou/gopsutil/v4/net/net_darwin.go
+++ b/vendor/github.com/shirou/gopsutil/v4/net/net_darwin.go
@@ -162,15 +162,16 @@ func (mapi mapInterfaceNameUsage) notTruncated() []string {
return output
}
+// Deprecated: use process.PidsWithContext instead
+func PidsWithContext(ctx context.Context) ([]int32, error) {
+ return nil, common.ErrNotImplementedError
+}
+
// example of `netstat -ibdnW` output on yosemite
// Name Mtu Network Address Ipkts Ierrs Ibytes Opkts Oerrs Obytes Coll Drop
// lo0 16384 869107 0 169411755 869107 0 169411755 0 0
// lo0 16384 ::1/128 ::1 869107 - 169411755 869107 - 169411755 - -
// lo0 16384 127 127.0.0.1 869107 - 169411755 869107 - 169411755 - -
-func IOCounters(pernic bool) ([]IOCountersStat, error) {
- return IOCountersWithContext(context.Background(), pernic)
-}
-
func IOCountersWithContext(ctx context.Context, pernic bool) ([]IOCountersStat, error) {
var (
ret []IOCountersStat
@@ -253,39 +254,18 @@ func IOCountersWithContext(ctx context.Context, pernic bool) ([]IOCountersStat,
return ret, nil
}
-// IOCountersByFile exists just for compatibility with Linux.
-func IOCountersByFile(pernic bool, filename string) ([]IOCountersStat, error) {
- return IOCountersByFileWithContext(context.Background(), pernic, filename)
-}
-
func IOCountersByFileWithContext(ctx context.Context, pernic bool, filename string) ([]IOCountersStat, error) {
return IOCountersWithContext(ctx, pernic)
}
-func FilterCounters() ([]FilterStat, error) {
- return FilterCountersWithContext(context.Background())
-}
-
func FilterCountersWithContext(ctx context.Context) ([]FilterStat, error) {
return nil, common.ErrNotImplementedError
}
-func ConntrackStats(percpu bool) ([]ConntrackStat, error) {
- return ConntrackStatsWithContext(context.Background(), percpu)
-}
-
func ConntrackStatsWithContext(ctx context.Context, percpu bool) ([]ConntrackStat, error) {
return nil, common.ErrNotImplementedError
}
-// ProtoCounters returns network statistics for the entire system
-// If protocols is empty then all protocols are returned, otherwise
-// just the protocols in the list are returned.
-// Not Implemented for Darwin
-func ProtoCounters(protocols []string) ([]ProtoCountersStat, error) {
- return ProtoCountersWithContext(context.Background(), protocols)
-}
-
func ProtoCountersWithContext(ctx context.Context, protocols []string) ([]ProtoCountersStat, error) {
return nil, common.ErrNotImplementedError
}
diff --git a/vendor/github.com/shirou/gopsutil/v4/net/net_fallback.go b/vendor/github.com/shirou/gopsutil/v4/net/net_fallback.go
index a765e216b88..7d7596a86c3 100644
--- a/vendor/github.com/shirou/gopsutil/v4/net/net_fallback.go
+++ b/vendor/github.com/shirou/gopsutil/v4/net/net_fallback.go
@@ -9,59 +9,37 @@ import (
"github.com/shirou/gopsutil/v4/internal/common"
)
-func IOCounters(pernic bool) ([]IOCountersStat, error) {
- return IOCountersWithContext(context.Background(), pernic)
-}
-
func IOCountersWithContext(ctx context.Context, pernic bool) ([]IOCountersStat, error) {
return []IOCountersStat{}, common.ErrNotImplementedError
}
-func FilterCounters() ([]FilterStat, error) {
- return FilterCountersWithContext(context.Background())
+func IOCountersByFileWithContext(ctx context.Context, pernic bool, filename string) ([]IOCountersStat, error) {
+ return IOCountersWithContext(ctx, pernic)
}
func FilterCountersWithContext(ctx context.Context) ([]FilterStat, error) {
- return []FilterStat{}, common.ErrNotImplementedError
-}
-
-func ConntrackStats(percpu bool) ([]ConntrackStat, error) {
- return ConntrackStatsWithContext(context.Background(), percpu)
+ return nil, common.ErrNotImplementedError
}
func ConntrackStatsWithContext(ctx context.Context, percpu bool) ([]ConntrackStat, error) {
return nil, common.ErrNotImplementedError
}
-func ProtoCounters(protocols []string) ([]ProtoCountersStat, error) {
- return ProtoCountersWithContext(context.Background(), protocols)
-}
-
func ProtoCountersWithContext(ctx context.Context, protocols []string) ([]ProtoCountersStat, error) {
- return []ProtoCountersStat{}, common.ErrNotImplementedError
+ return nil, common.ErrNotImplementedError
}
-func Connections(kind string) ([]ConnectionStat, error) {
- return ConnectionsWithContext(context.Background(), kind)
+// Deprecated: use process.PidsWithContext instead
+func PidsWithContext(ctx context.Context) ([]int32, error) {
+ return nil, common.ErrNotImplementedError
}
func ConnectionsWithContext(ctx context.Context, kind string) ([]ConnectionStat, error) {
return []ConnectionStat{}, common.ErrNotImplementedError
}
-func ConnectionsMax(kind string, maxConn int) ([]ConnectionStat, error) {
- return ConnectionsMaxWithContext(context.Background(), kind, maxConn)
-}
-
func ConnectionsMaxWithContext(ctx context.Context, kind string, maxConn int) ([]ConnectionStat, error) {
- return []ConnectionStat{}, common.ErrNotImplementedError
-}
-
-// Return a list of network connections opened, omitting `Uids`.
-// WithoutUids functions are reliant on implementation details. They may be altered to be an alias for Connections or be
-// removed from the API in the future.
-func ConnectionsWithoutUids(kind string) ([]ConnectionStat, error) {
- return ConnectionsWithoutUidsWithContext(context.Background(), kind)
+ return ConnectionsPidMaxWithContext(ctx, kind, 0, maxConn)
}
func ConnectionsWithoutUidsWithContext(ctx context.Context, kind string) ([]ConnectionStat, error) {
@@ -72,22 +50,22 @@ func ConnectionsMaxWithoutUidsWithContext(ctx context.Context, kind string, maxC
return ConnectionsPidMaxWithoutUidsWithContext(ctx, kind, 0, maxConn)
}
-func ConnectionsPidWithoutUids(kind string, pid int32) ([]ConnectionStat, error) {
- return ConnectionsPidWithoutUidsWithContext(context.Background(), kind, pid)
-}
-
func ConnectionsPidWithoutUidsWithContext(ctx context.Context, kind string, pid int32) ([]ConnectionStat, error) {
return ConnectionsPidMaxWithoutUidsWithContext(ctx, kind, pid, 0)
}
-func ConnectionsPidMaxWithoutUids(kind string, pid int32, maxConn int) ([]ConnectionStat, error) {
- return ConnectionsPidMaxWithoutUidsWithContext(context.Background(), kind, pid, maxConn)
+func ConnectionsPidWithContext(ctx context.Context, kind string, pid int32) ([]ConnectionStat, error) {
+ return ConnectionsPidMaxWithContext(ctx, kind, pid, 0)
+}
+
+func ConnectionsPidMaxWithContext(ctx context.Context, kind string, pid int32, maxConn int) ([]ConnectionStat, error) {
+ return connectionsPidMaxWithoutUidsWithContext(ctx, kind, pid, maxConn, false)
}
func ConnectionsPidMaxWithoutUidsWithContext(ctx context.Context, kind string, pid int32, maxConn int) ([]ConnectionStat, error) {
- return connectionsPidMaxWithoutUidsWithContext(ctx, kind, pid, maxConn)
+ return connectionsPidMaxWithoutUidsWithContext(ctx, kind, pid, maxConn, true)
}
-func connectionsPidMaxWithoutUidsWithContext(ctx context.Context, kind string, pid int32, maxConn int) ([]ConnectionStat, error) {
+func connectionsPidMaxWithoutUidsWithContext(_ context.Context, _ string, _ int32, _ int, _ bool) ([]ConnectionStat, error) {
return []ConnectionStat{}, common.ErrNotImplementedError
}
diff --git a/vendor/github.com/shirou/gopsutil/v4/net/net_freebsd.go b/vendor/github.com/shirou/gopsutil/v4/net/net_freebsd.go
index ccaab73e0b3..655e13373d9 100644
--- a/vendor/github.com/shirou/gopsutil/v4/net/net_freebsd.go
+++ b/vendor/github.com/shirou/gopsutil/v4/net/net_freebsd.go
@@ -11,8 +11,9 @@ import (
"github.com/shirou/gopsutil/v4/internal/common"
)
-func IOCounters(pernic bool) ([]IOCountersStat, error) {
- return IOCountersWithContext(context.Background(), pernic)
+// Deprecated: use process.PidsWithContext instead
+func PidsWithContext(ctx context.Context) ([]int32, error) {
+ return nil, common.ErrNotImplementedError
}
func IOCountersWithContext(ctx context.Context, pernic bool) ([]IOCountersStat, error) {
@@ -90,39 +91,18 @@ func IOCountersWithContext(ctx context.Context, pernic bool) ([]IOCountersStat,
return ret, nil
}
-// IOCountersByFile exists just for compatibility with Linux.
-func IOCountersByFile(pernic bool, filename string) ([]IOCountersStat, error) {
- return IOCountersByFileWithContext(context.Background(), pernic, filename)
-}
-
func IOCountersByFileWithContext(ctx context.Context, pernic bool, filename string) ([]IOCountersStat, error) {
return IOCountersWithContext(ctx, pernic)
}
-func FilterCounters() ([]FilterStat, error) {
- return FilterCountersWithContext(context.Background())
-}
-
func FilterCountersWithContext(ctx context.Context) ([]FilterStat, error) {
return nil, common.ErrNotImplementedError
}
-func ConntrackStats(percpu bool) ([]ConntrackStat, error) {
- return ConntrackStatsWithContext(context.Background(), percpu)
-}
-
func ConntrackStatsWithContext(ctx context.Context, percpu bool) ([]ConntrackStat, error) {
return nil, common.ErrNotImplementedError
}
-// ProtoCounters returns network statistics for the entire system
-// If protocols is empty then all protocols are returned, otherwise
-// just the protocols in the list are returned.
-// Not Implemented for FreeBSD
-func ProtoCounters(protocols []string) ([]ProtoCountersStat, error) {
- return ProtoCountersWithContext(context.Background(), protocols)
-}
-
func ProtoCountersWithContext(ctx context.Context, protocols []string) ([]ProtoCountersStat, error) {
return nil, common.ErrNotImplementedError
}
diff --git a/vendor/github.com/shirou/gopsutil/v4/net/net_linux.go b/vendor/github.com/shirou/gopsutil/v4/net/net_linux.go
index 2c79facb057..23113fea774 100644
--- a/vendor/github.com/shirou/gopsutil/v4/net/net_linux.go
+++ b/vendor/github.com/shirou/gopsutil/v4/net/net_linux.go
@@ -39,24 +39,11 @@ const ( // Conntrack Column numbers
ctSEARCH_RESTART
)
-// NetIOCounters returns network I/O statistics for every network
-// interface installed on the system. If pernic argument is false,
-// return only sum of all information (which name is 'all'). If true,
-// every network interface installed on the system is returned
-// separately.
-func IOCounters(pernic bool) ([]IOCountersStat, error) {
- return IOCountersWithContext(context.Background(), pernic)
-}
-
func IOCountersWithContext(ctx context.Context, pernic bool) ([]IOCountersStat, error) {
filename := common.HostProcWithContext(ctx, "net/dev")
return IOCountersByFileWithContext(ctx, pernic, filename)
}
-func IOCountersByFile(pernic bool, filename string) ([]IOCountersStat, error) {
- return IOCountersByFileWithContext(context.Background(), pernic, filename)
-}
-
func IOCountersByFileWithContext(ctx context.Context, pernic bool, filename string) ([]IOCountersStat, error) {
lines, err := common.ReadLines(filename)
if err != nil {
@@ -156,15 +143,6 @@ var netProtocols = []string{
"udplite",
}
-// ProtoCounters returns network statistics for the entire system
-// If protocols is empty then all protocols are returned, otherwise
-// just the protocols in the list are returned.
-// Available protocols:
-// [ip,icmp,icmpmsg,tcp,udp,udplite]
-func ProtoCounters(protocols []string) ([]ProtoCountersStat, error) {
- return ProtoCountersWithContext(context.Background(), protocols)
-}
-
func ProtoCountersWithContext(ctx context.Context, protocols []string) ([]ProtoCountersStat, error) {
if len(protocols) == 0 {
protocols = netProtocols
@@ -221,13 +199,6 @@ func ProtoCountersWithContext(ctx context.Context, protocols []string) ([]ProtoC
return stats, nil
}
-// NetFilterCounters returns iptables conntrack statistics
-// the currently in use conntrack count and the max.
-// If the file does not exist or is invalid it will return nil.
-func FilterCounters() ([]FilterStat, error) {
- return FilterCountersWithContext(context.Background())
-}
-
func FilterCountersWithContext(ctx context.Context) ([]FilterStat, error) {
countfile := common.HostProcWithContext(ctx, "sys/net/netfilter/nf_conntrack_count")
maxfile := common.HostProcWithContext(ctx, "sys/net/netfilter/nf_conntrack_max")
@@ -252,11 +223,6 @@ func FilterCountersWithContext(ctx context.Context) ([]FilterStat, error) {
return stats, nil
}
-// ConntrackStats returns more detailed info about the conntrack table
-func ConntrackStats(percpu bool) ([]ConntrackStat, error) {
- return ConntrackStatsWithContext(context.Background(), percpu)
-}
-
// ConntrackStatsWithContext returns more detailed info about the conntrack table
func ConntrackStatsWithContext(ctx context.Context, percpu bool) ([]ConntrackStat, error) {
return conntrackStatsFromFile(common.HostProcWithContext(ctx, "net/stat/nf_conntrack"), percpu)
@@ -385,32 +351,14 @@ type connTmp struct {
path string
}
-// Return a list of network connections opened.
-func Connections(kind string) ([]ConnectionStat, error) {
- return ConnectionsWithContext(context.Background(), kind)
-}
-
func ConnectionsWithContext(ctx context.Context, kind string) ([]ConnectionStat, error) {
return ConnectionsPidWithContext(ctx, kind, 0)
}
-// Return a list of network connections opened returning at most `max`
-// connections for each running process.
-func ConnectionsMax(kind string, maxConn int) ([]ConnectionStat, error) {
- return ConnectionsMaxWithContext(context.Background(), kind, maxConn)
-}
-
func ConnectionsMaxWithContext(ctx context.Context, kind string, maxConn int) ([]ConnectionStat, error) {
return ConnectionsPidMaxWithContext(ctx, kind, 0, maxConn)
}
-// Return a list of network connections opened, omitting `Uids`.
-// WithoutUids functions are reliant on implementation details. They may be altered to be an alias for Connections or be
-// removed from the API in the future.
-func ConnectionsWithoutUids(kind string) ([]ConnectionStat, error) {
- return ConnectionsWithoutUidsWithContext(context.Background(), kind)
-}
-
func ConnectionsWithoutUidsWithContext(ctx context.Context, kind string) ([]ConnectionStat, error) {
return ConnectionsMaxWithoutUidsWithContext(ctx, kind, 0)
}
@@ -419,15 +367,6 @@ func ConnectionsMaxWithoutUidsWithContext(ctx context.Context, kind string, maxC
return ConnectionsPidMaxWithoutUidsWithContext(ctx, kind, 0, maxConn)
}
-// Return a list of network connections opened by a process.
-func ConnectionsPid(kind string, pid int32) ([]ConnectionStat, error) {
- return ConnectionsPidWithContext(context.Background(), kind, pid)
-}
-
-func ConnectionsPidWithoutUids(kind string, pid int32) ([]ConnectionStat, error) {
- return ConnectionsPidWithoutUidsWithContext(context.Background(), kind, pid)
-}
-
func ConnectionsPidWithContext(ctx context.Context, kind string, pid int32) ([]ConnectionStat, error) {
return ConnectionsPidMaxWithContext(ctx, kind, pid, 0)
}
@@ -436,15 +375,6 @@ func ConnectionsPidWithoutUidsWithContext(ctx context.Context, kind string, pid
return ConnectionsPidMaxWithoutUidsWithContext(ctx, kind, pid, 0)
}
-// Return up to `max` network connections opened by a process.
-func ConnectionsPidMax(kind string, pid int32, maxConn int) ([]ConnectionStat, error) {
- return ConnectionsPidMaxWithContext(context.Background(), kind, pid, maxConn)
-}
-
-func ConnectionsPidMaxWithoutUids(kind string, pid int32, maxConn int) ([]ConnectionStat, error) {
- return ConnectionsPidMaxWithoutUidsWithContext(context.Background(), kind, pid, maxConn)
-}
-
func ConnectionsPidMaxWithContext(ctx context.Context, kind string, pid int32, maxConn int) ([]ConnectionStat, error) {
return connectionsPidMaxWithoutUidsWithContext(ctx, kind, pid, maxConn, false)
}
@@ -476,10 +406,6 @@ func connectionsPidMaxWithoutUidsWithContext(ctx context.Context, kind string, p
return statsFromInodesWithContext(ctx, root, pid, tmap, inodes, skipUids)
}
-func statsFromInodes(root string, pid int32, tmap []netConnectionKindType, inodes map[string][]inodeMap, skipUids bool) ([]ConnectionStat, error) {
- return statsFromInodesWithContext(context.Background(), root, pid, tmap, inodes, skipUids)
-}
-
func statsFromInodesWithContext(ctx context.Context, root string, pid int32, tmap []netConnectionKindType, inodes map[string][]inodeMap, skipUids bool) ([]ConnectionStat, error) {
dupCheckMap := make(map[string]struct{})
var ret []ConnectionStat
@@ -496,7 +422,7 @@ func statsFromInodesWithContext(ctx context.Context, root string, pid int32, tma
}
switch t.family {
case syscall.AF_INET, syscall.AF_INET6:
- ls, err = processInetWithContext(ctx, path, t, inodes, pid)
+ ls, err = processInet(path, t, inodes, pid)
case syscall.AF_UNIX:
ls, err = processUnix(path, t, inodes, pid)
}
@@ -587,14 +513,6 @@ func getProcInodes(root string, pid int32, maxConn int) (map[string][]inodeMap,
return ret, nil
}
-// Pids retunres all pids.
-// Note: this is a copy of process_linux.Pids()
-// FIXME: Import process occures import cycle.
-// move to common made other platform breaking. Need consider.
-func Pids() ([]int32, error) {
- return PidsWithContext(context.Background())
-}
-
func PidsWithContext(ctx context.Context) ([]int32, error) {
var ret []int32
@@ -668,10 +586,6 @@ func (p *process) fillFromStatus(ctx context.Context) error {
return nil
}
-func getProcInodesAll(root string, maxConn int) (map[string][]inodeMap, error) {
- return getProcInodesAllWithContext(context.Background(), root, maxConn)
-}
-
func getProcInodesAllWithContext(ctx context.Context, root string, maxConn int) (map[string][]inodeMap, error) {
pids, err := PidsWithContext(ctx)
if err != nil {
@@ -702,10 +616,6 @@ func getProcInodesAllWithContext(ctx context.Context, root string, maxConn int)
// "0500000A:0016" -> "10.0.0.5", 22
// "0085002452100113070057A13F025401:0035" -> "2400:8500:1301:1052:a157:7:154:23f", 53
func decodeAddress(family uint32, src string) (Addr, error) {
- return decodeAddressWithContext(context.Background(), family, src)
-}
-
-func decodeAddressWithContext(ctx context.Context, family uint32, src string) (Addr, error) {
t := strings.Split(src, ":")
if len(t) != 2 {
return Addr{}, fmt.Errorf("does not contain port, %s", src)
@@ -723,12 +633,12 @@ func decodeAddressWithContext(ctx context.Context, family uint32, src string) (A
if family == syscall.AF_INET {
if common.IsLittleEndian() {
- ip = net.IP(ReverseWithContext(ctx, decoded))
+ ip = net.IP(Reverse(decoded))
} else {
ip = net.IP(decoded)
}
} else { // IPv6
- ip, err = parseIPv6HexStringWithContext(ctx, decoded)
+ ip, err = parseIPv6HexString(decoded)
if err != nil {
return Addr{}, err
}
@@ -739,12 +649,7 @@ func decodeAddressWithContext(ctx context.Context, family uint32, src string) (A
}, nil
}
-// Reverse reverses array of bytes.
func Reverse(s []byte) []byte {
- return ReverseWithContext(context.Background(), s)
-}
-
-func ReverseWithContext(ctx context.Context, s []byte) []byte {
for i, j := 0, len(s)-1; i < j; i, j = i+1, j-1 {
s[i], s[j] = s[j], s[i]
}
@@ -753,27 +658,19 @@ func ReverseWithContext(ctx context.Context, s []byte) []byte {
// parseIPv6HexString parse array of bytes to IPv6 string
func parseIPv6HexString(src []byte) (net.IP, error) {
- return parseIPv6HexStringWithContext(context.Background(), src)
-}
-
-func parseIPv6HexStringWithContext(ctx context.Context, src []byte) (net.IP, error) {
if len(src) != 16 {
- return nil, fmt.Errorf("invalid IPv6 string")
+ return nil, errors.New("invalid IPv6 string")
}
buf := make([]byte, 0, 16)
for i := 0; i < len(src); i += 4 {
- r := ReverseWithContext(ctx, src[i:i+4])
+ r := Reverse(src[i : i+4])
buf = append(buf, r...)
}
return net.IP(buf), nil
}
func processInet(file string, kind netConnectionKindType, inodes map[string][]inodeMap, filterPid int32) ([]connTmp, error) {
- return processInetWithContext(context.Background(), file, kind, inodes, filterPid)
-}
-
-func processInetWithContext(ctx context.Context, file string, kind netConnectionKindType, inodes map[string][]inodeMap, filterPid int32) ([]connTmp, error) {
if strings.HasSuffix(file, "6") && !common.PathExists(file) {
// IPv6 not supported, return empty.
return []connTmp{}, nil
@@ -816,11 +713,11 @@ func processInetWithContext(ctx context.Context, file string, kind netConnection
} else {
status = "NONE"
}
- la, err := decodeAddressWithContext(ctx, kind.family, laddr)
+ la, err := decodeAddress(kind.family, laddr)
if err != nil {
continue
}
- ra, err := decodeAddressWithContext(ctx, kind.family, raddr)
+ ra, err := decodeAddress(kind.family, raddr)
if err != nil {
continue
}
diff --git a/vendor/github.com/shirou/gopsutil/v4/net/net_openbsd.go b/vendor/github.com/shirou/gopsutil/v4/net/net_openbsd.go
index 7fae18b936c..a90d5904ab2 100644
--- a/vendor/github.com/shirou/gopsutil/v4/net/net_openbsd.go
+++ b/vendor/github.com/shirou/gopsutil/v4/net/net_openbsd.go
@@ -106,8 +106,9 @@ func ParseNetstat(output string, mode string,
return nil
}
-func IOCounters(pernic bool) ([]IOCountersStat, error) {
- return IOCountersWithContext(context.Background(), pernic)
+// Deprecated: use process.PidsWithContext instead
+func PidsWithContext(ctx context.Context) ([]int32, error) {
+ return nil, common.ErrNotImplementedError
}
func IOCountersWithContext(ctx context.Context, pernic bool) ([]IOCountersStat, error) {
@@ -156,39 +157,18 @@ func IOCountersWithContext(ctx context.Context, pernic bool) ([]IOCountersStat,
return ret, nil
}
-// IOCountersByFile exists just for compatibility with Linux.
-func IOCountersByFile(pernic bool, filename string) ([]IOCountersStat, error) {
- return IOCountersByFileWithContext(context.Background(), pernic, filename)
-}
-
func IOCountersByFileWithContext(ctx context.Context, pernic bool, filename string) ([]IOCountersStat, error) {
return IOCounters(pernic)
}
-func FilterCounters() ([]FilterStat, error) {
- return FilterCountersWithContext(context.Background())
-}
-
func FilterCountersWithContext(ctx context.Context) ([]FilterStat, error) {
return nil, common.ErrNotImplementedError
}
-func ConntrackStats(percpu bool) ([]ConntrackStat, error) {
- return ConntrackStatsWithContext(context.Background(), percpu)
-}
-
func ConntrackStatsWithContext(ctx context.Context, percpu bool) ([]ConntrackStat, error) {
return nil, common.ErrNotImplementedError
}
-// ProtoCounters returns network statistics for the entire system
-// If protocols is empty then all protocols are returned, otherwise
-// just the protocols in the list are returned.
-// Not Implemented for OpenBSD
-func ProtoCounters(protocols []string) ([]ProtoCountersStat, error) {
- return ProtoCountersWithContext(context.Background(), protocols)
-}
-
func ProtoCountersWithContext(ctx context.Context, protocols []string) ([]ProtoCountersStat, error) {
return nil, common.ErrNotImplementedError
}
@@ -273,11 +253,6 @@ func parseNetstatAddr(local string, remote string, family uint32) (laddr Addr, r
return laddr, raddr, err
}
-// Return a list of network connections opened.
-func Connections(kind string) ([]ConnectionStat, error) {
- return ConnectionsWithContext(context.Background(), kind)
-}
-
func ConnectionsWithContext(ctx context.Context, kind string) ([]ConnectionStat, error) {
var ret []ConnectionStat
@@ -334,3 +309,35 @@ func ConnectionsWithContext(ctx context.Context, kind string) ([]ConnectionStat,
return ret, nil
}
+
+func ConnectionsPidWithContext(ctx context.Context, kind string, pid int32) ([]ConnectionStat, error) {
+ return nil, common.ErrNotImplementedError
+}
+
+func ConnectionsMaxWithContext(ctx context.Context, kind string, maxConn int) ([]ConnectionStat, error) {
+ return nil, common.ErrNotImplementedError
+}
+
+func ConnectionsPidMaxWithContext(ctx context.Context, kind string, pid int32, maxConn int) ([]ConnectionStat, error) {
+ return nil, common.ErrNotImplementedError
+}
+
+func ConnectionsWithoutUidsWithContext(ctx context.Context, kind string) ([]ConnectionStat, error) {
+ return ConnectionsMaxWithoutUidsWithContext(ctx, kind, 0)
+}
+
+func ConnectionsMaxWithoutUidsWithContext(ctx context.Context, kind string, maxConn int) ([]ConnectionStat, error) {
+ return ConnectionsPidMaxWithoutUidsWithContext(ctx, kind, 0, maxConn)
+}
+
+func ConnectionsPidWithoutUidsWithContext(ctx context.Context, kind string, pid int32) ([]ConnectionStat, error) {
+ return ConnectionsPidMaxWithoutUidsWithContext(ctx, kind, pid, 0)
+}
+
+func ConnectionsPidMaxWithoutUidsWithContext(ctx context.Context, kind string, pid int32, maxConn int) ([]ConnectionStat, error) {
+ return connectionsPidMaxWithoutUidsWithContext(ctx, kind, pid, maxConn)
+}
+
+func connectionsPidMaxWithoutUidsWithContext(ctx context.Context, kind string, pid int32, maxConn int) ([]ConnectionStat, error) {
+ return nil, common.ErrNotImplementedError
+}
diff --git a/vendor/github.com/shirou/gopsutil/v4/net/net_solaris.go b/vendor/github.com/shirou/gopsutil/v4/net/net_solaris.go
index b886066e82e..83eb1d0f771 100644
--- a/vendor/github.com/shirou/gopsutil/v4/net/net_solaris.go
+++ b/vendor/github.com/shirou/gopsutil/v4/net/net_solaris.go
@@ -14,15 +14,6 @@ import (
"github.com/shirou/gopsutil/v4/internal/common"
)
-// NetIOCounters returnes network I/O statistics for every network
-// interface installed on the system. If pernic argument is false,
-// return only sum of all information (which name is 'all'). If true,
-// every network interface installed on the system is returned
-// separately.
-func IOCounters(pernic bool) ([]IOCountersStat, error) {
- return IOCountersWithContext(context.Background(), pernic)
-}
-
var kstatSplit = regexp.MustCompile(`[:\s]+`)
func IOCountersWithContext(ctx context.Context, pernic bool) ([]IOCountersStat, error) {
@@ -119,26 +110,59 @@ func IOCountersWithContext(ctx context.Context, pernic bool) ([]IOCountersStat,
return ret, nil
}
-func Connections(kind string) ([]ConnectionStat, error) {
- return ConnectionsWithContext(context.Background(), kind)
+func IOCountersByFileWithContext(ctx context.Context, pernic bool, filename string) ([]IOCountersStat, error) {
+ return IOCountersWithContext(ctx, pernic)
+}
+
+func FilterCountersWithContext(ctx context.Context) ([]FilterStat, error) {
+ return nil, common.ErrNotImplementedError
+}
+
+func ConntrackStatsWithContext(ctx context.Context, percpu bool) ([]ConntrackStat, error) {
+ return nil, common.ErrNotImplementedError
+}
+
+func ProtoCountersWithContext(ctx context.Context, protocols []string) ([]ProtoCountersStat, error) {
+ return nil, common.ErrNotImplementedError
+}
+
+// Deprecated: use process.PidsWithContext instead
+func PidsWithContext(ctx context.Context) ([]int32, error) {
+ return nil, common.ErrNotImplementedError
}
func ConnectionsWithContext(ctx context.Context, kind string) ([]ConnectionStat, error) {
return []ConnectionStat{}, common.ErrNotImplementedError
}
-func FilterCounters() ([]FilterStat, error) {
- return FilterCountersWithContext(context.Background())
+func ConnectionsMaxWithContext(ctx context.Context, kind string, maxConn int) ([]ConnectionStat, error) {
+ return ConnectionsPidMaxWithContext(ctx, kind, 0, maxConn)
}
-func FilterCountersWithContext(ctx context.Context) ([]FilterStat, error) {
- return []FilterStat{}, common.ErrNotImplementedError
+func ConnectionsWithoutUidsWithContext(ctx context.Context, kind string) ([]ConnectionStat, error) {
+ return ConnectionsMaxWithoutUidsWithContext(ctx, kind, 0)
}
-func ProtoCounters(protocols []string) ([]ProtoCountersStat, error) {
- return ProtoCountersWithContext(context.Background(), protocols)
+func ConnectionsMaxWithoutUidsWithContext(ctx context.Context, kind string, maxConn int) ([]ConnectionStat, error) {
+ return ConnectionsPidMaxWithoutUidsWithContext(ctx, kind, 0, maxConn)
}
-func ProtoCountersWithContext(ctx context.Context, protocols []string) ([]ProtoCountersStat, error) {
- return []ProtoCountersStat{}, common.ErrNotImplementedError
+func ConnectionsPidWithoutUidsWithContext(ctx context.Context, kind string, pid int32) ([]ConnectionStat, error) {
+ return ConnectionsPidMaxWithoutUidsWithContext(ctx, kind, pid, 0)
+}
+
+func ConnectionsPidWithContext(ctx context.Context, kind string, pid int32) ([]ConnectionStat, error) {
+ return ConnectionsPidMaxWithContext(ctx, kind, pid, 0)
+}
+
+func ConnectionsPidMaxWithContext(ctx context.Context, kind string, pid int32, maxConn int) ([]ConnectionStat, error) {
+ return connectionsPidMaxWithoutUidsWithContext(ctx, kind, pid, maxConn, false)
+}
+
+func ConnectionsPidMaxWithoutUidsWithContext(ctx context.Context, kind string, pid int32, maxConn int) ([]ConnectionStat, error) {
+ return connectionsPidMaxWithoutUidsWithContext(ctx, kind, pid, maxConn, true)
+}
+
+func connectionsPidMaxWithoutUidsWithContext(_ context.Context, _ string, _ int32, _ int, _ bool) ([]ConnectionStat, error) {
+ return []ConnectionStat{}, common.ErrNotImplementedError
}
diff --git a/vendor/github.com/shirou/gopsutil/v4/net/net_unix.go b/vendor/github.com/shirou/gopsutil/v4/net/net_unix.go
index 62f8907abf5..6eb7e2fc521 100644
--- a/vendor/github.com/shirou/gopsutil/v4/net/net_unix.go
+++ b/vendor/github.com/shirou/gopsutil/v4/net/net_unix.go
@@ -14,30 +14,14 @@ import (
"github.com/shirou/gopsutil/v4/internal/common"
)
-// Return a list of network connections opened.
-func Connections(kind string) ([]ConnectionStat, error) {
- return ConnectionsWithContext(context.Background(), kind)
-}
-
func ConnectionsWithContext(ctx context.Context, kind string) ([]ConnectionStat, error) {
return ConnectionsPidWithContext(ctx, kind, 0)
}
-// Return a list of network connections opened returning at most `max`
-// connections for each running process.
-func ConnectionsMax(kind string, maxConn int) ([]ConnectionStat, error) {
- return ConnectionsMaxWithContext(context.Background(), kind, maxConn)
-}
-
func ConnectionsMaxWithContext(ctx context.Context, kind string, maxConn int) ([]ConnectionStat, error) {
return []ConnectionStat{}, common.ErrNotImplementedError
}
-// Return a list of network connections opened by a process.
-func ConnectionsPid(kind string, pid int32) ([]ConnectionStat, error) {
- return ConnectionsPidWithContext(context.Background(), kind, pid)
-}
-
func ConnectionsPidWithContext(ctx context.Context, kind string, pid int32) ([]ConnectionStat, error) {
var ret []ConnectionStat
@@ -179,22 +163,10 @@ func parseNetAddr(line string) (laddr Addr, raddr Addr, err error) {
return laddr, raddr, err
}
-// Return up to `max` network connections opened by a process.
-func ConnectionsPidMax(kind string, pid int32, maxConn int) ([]ConnectionStat, error) {
- return ConnectionsPidMaxWithContext(context.Background(), kind, pid, maxConn)
-}
-
func ConnectionsPidMaxWithContext(ctx context.Context, kind string, pid int32, maxConn int) ([]ConnectionStat, error) {
return []ConnectionStat{}, common.ErrNotImplementedError
}
-// Return a list of network connections opened, omitting `Uids`.
-// WithoutUids functions are reliant on implementation details. They may be altered to be an alias for Connections or be
-// removed from the API in the future.
-func ConnectionsWithoutUids(kind string) ([]ConnectionStat, error) {
- return ConnectionsWithoutUidsWithContext(context.Background(), kind)
-}
-
func ConnectionsWithoutUidsWithContext(ctx context.Context, kind string) ([]ConnectionStat, error) {
return ConnectionsMaxWithoutUidsWithContext(ctx, kind, 0)
}
@@ -203,18 +175,10 @@ func ConnectionsMaxWithoutUidsWithContext(ctx context.Context, kind string, maxC
return ConnectionsPidMaxWithoutUidsWithContext(ctx, kind, 0, maxConn)
}
-func ConnectionsPidWithoutUids(kind string, pid int32) ([]ConnectionStat, error) {
- return ConnectionsPidWithoutUidsWithContext(context.Background(), kind, pid)
-}
-
func ConnectionsPidWithoutUidsWithContext(ctx context.Context, kind string, pid int32) ([]ConnectionStat, error) {
return ConnectionsPidMaxWithoutUidsWithContext(ctx, kind, pid, 0)
}
-func ConnectionsPidMaxWithoutUids(kind string, pid int32, maxConn int) ([]ConnectionStat, error) {
- return ConnectionsPidMaxWithoutUidsWithContext(context.Background(), kind, pid, maxConn)
-}
-
func ConnectionsPidMaxWithoutUidsWithContext(ctx context.Context, kind string, pid int32, maxConn int) ([]ConnectionStat, error) {
return connectionsPidMaxWithoutUidsWithContext(ctx, kind, pid, maxConn)
}
diff --git a/vendor/github.com/shirou/gopsutil/v4/net/net_windows.go b/vendor/github.com/shirou/gopsutil/v4/net/net_windows.go
index f1145feab29..00ebf89ef1a 100644
--- a/vendor/github.com/shirou/gopsutil/v4/net/net_windows.go
+++ b/vendor/github.com/shirou/gopsutil/v4/net/net_windows.go
@@ -136,10 +136,6 @@ type mibIfRow2 struct {
OutQLen uint64
}
-func IOCounters(pernic bool) ([]IOCountersStat, error) {
- return IOCountersWithContext(context.Background(), pernic)
-}
-
func IOCountersWithContext(ctx context.Context, pernic bool) ([]IOCountersStat, error) {
ifs, err := net.Interfaces()
if err != nil {
@@ -200,32 +196,14 @@ func IOCountersWithContext(ctx context.Context, pernic bool) ([]IOCountersStat,
return counters, nil
}
-// IOCountersByFile exists just for compatibility with Linux.
-func IOCountersByFile(pernic bool, filename string) ([]IOCountersStat, error) {
- return IOCountersByFileWithContext(context.Background(), pernic, filename)
-}
-
func IOCountersByFileWithContext(ctx context.Context, pernic bool, filename string) ([]IOCountersStat, error) {
return IOCounters(pernic)
}
-// Return a list of network connections
-// Available kind:
-//
-// reference to netConnectionKindMap
-func Connections(kind string) ([]ConnectionStat, error) {
- return ConnectionsWithContext(context.Background(), kind)
-}
-
func ConnectionsWithContext(ctx context.Context, kind string) ([]ConnectionStat, error) {
return ConnectionsPidWithContext(ctx, kind, 0)
}
-// ConnectionsPid Return a list of network connections opened by a process
-func ConnectionsPid(kind string, pid int32) ([]ConnectionStat, error) {
- return ConnectionsPidWithContext(context.Background(), kind, pid)
-}
-
func ConnectionsPidWithContext(ctx context.Context, kind string, pid int32) ([]ConnectionStat, error) {
tmap, ok := netConnectionKindMap[kind]
if !ok {
@@ -277,21 +255,13 @@ func getNetStatWithKind(kindType netConnectionKindType) ([]ConnectionStat, error
return nil, fmt.Errorf("invalid kind filename, %s", kindType.filename)
}
-// Return a list of network connections opened returning at most `max`
-// connections for each running process.
-func ConnectionsMax(kind string, maxConn int) ([]ConnectionStat, error) {
- return ConnectionsMaxWithContext(context.Background(), kind, maxConn)
+// Deprecated: use process.PidsWithContext instead
+func PidsWithContext(ctx context.Context) ([]int32, error) {
+ return nil, common.ErrNotImplementedError
}
func ConnectionsMaxWithContext(ctx context.Context, kind string, maxConn int) ([]ConnectionStat, error) {
- return []ConnectionStat{}, common.ErrNotImplementedError
-}
-
-// Return a list of network connections opened, omitting `Uids`.
-// WithoutUids functions are reliant on implementation details. They may be altered to be an alias for Connections or be
-// removed from the API in the future.
-func ConnectionsWithoutUids(kind string) ([]ConnectionStat, error) {
- return ConnectionsWithoutUidsWithContext(context.Background(), kind)
+ return ConnectionsPidMaxWithContext(ctx, kind, 0, maxConn)
}
func ConnectionsWithoutUidsWithContext(ctx context.Context, kind string) ([]ConnectionStat, error) {
@@ -302,50 +272,30 @@ func ConnectionsMaxWithoutUidsWithContext(ctx context.Context, kind string, maxC
return ConnectionsPidMaxWithoutUidsWithContext(ctx, kind, 0, maxConn)
}
-func ConnectionsPidWithoutUids(kind string, pid int32) ([]ConnectionStat, error) {
- return ConnectionsPidWithoutUidsWithContext(context.Background(), kind, pid)
-}
-
func ConnectionsPidWithoutUidsWithContext(ctx context.Context, kind string, pid int32) ([]ConnectionStat, error) {
return ConnectionsPidMaxWithoutUidsWithContext(ctx, kind, pid, 0)
}
-func ConnectionsPidMaxWithoutUids(kind string, pid int32, maxConn int) ([]ConnectionStat, error) {
- return ConnectionsPidMaxWithoutUidsWithContext(context.Background(), kind, pid, maxConn)
+func ConnectionsPidMaxWithContext(ctx context.Context, kind string, pid int32, maxConn int) ([]ConnectionStat, error) {
+ return connectionsPidMaxWithoutUidsWithContext(ctx, kind, pid, maxConn, false)
}
func ConnectionsPidMaxWithoutUidsWithContext(ctx context.Context, kind string, pid int32, maxConn int) ([]ConnectionStat, error) {
- return connectionsPidMaxWithoutUidsWithContext(ctx, kind, pid, maxConn)
+ return connectionsPidMaxWithoutUidsWithContext(ctx, kind, pid, maxConn, true)
}
-func connectionsPidMaxWithoutUidsWithContext(ctx context.Context, kind string, pid int32, maxConn int) ([]ConnectionStat, error) {
+func connectionsPidMaxWithoutUidsWithContext(_ context.Context, _ string, _ int32, _ int, _ bool) ([]ConnectionStat, error) {
return []ConnectionStat{}, common.ErrNotImplementedError
}
-func FilterCounters() ([]FilterStat, error) {
- return FilterCountersWithContext(context.Background())
-}
-
func FilterCountersWithContext(ctx context.Context) ([]FilterStat, error) {
return nil, common.ErrNotImplementedError
}
-func ConntrackStats(percpu bool) ([]ConntrackStat, error) {
- return ConntrackStatsWithContext(context.Background(), percpu)
-}
-
func ConntrackStatsWithContext(ctx context.Context, percpu bool) ([]ConntrackStat, error) {
return nil, common.ErrNotImplementedError
}
-// ProtoCounters returns network statistics for the entire system
-// If protocols is empty then all protocols are returned, otherwise
-// just the protocols in the list are returned.
-// Not Implemented for Windows
-func ProtoCounters(protocols []string) ([]ProtoCountersStat, error) {
- return ProtoCountersWithContext(context.Background(), protocols)
-}
-
func ProtoCountersWithContext(ctx context.Context, protocols []string) ([]ProtoCountersStat, error) {
return nil, common.ErrNotImplementedError
}
diff --git a/vendor/github.com/shirou/gopsutil/v4/process/process_darwin.go b/vendor/github.com/shirou/gopsutil/v4/process/process_darwin.go
index 05c7562b767..33abc10ac35 100644
--- a/vendor/github.com/shirou/gopsutil/v4/process/process_darwin.go
+++ b/vendor/github.com/shirou/gopsutil/v4/process/process_darwin.go
@@ -310,14 +310,14 @@ func (p *Process) ExeWithContext(ctx context.Context) (string, error) {
}
defer lib.Close()
- buf := make([]byte, common.PROC_PIDPATHINFO_MAXSIZE)
- ret := procPidPath(p.Pid, uintptr(unsafe.Pointer(&buf[0])), common.PROC_PIDPATHINFO_MAXSIZE)
+ buf := common.NewCStr(common.PROC_PIDPATHINFO_MAXSIZE)
+ ret := procPidPath(p.Pid, buf.Addr(), common.PROC_PIDPATHINFO_MAXSIZE)
if ret <= 0 {
return "", fmt.Errorf("unknown error: proc_pidpath returned %d", ret)
}
- return common.GoString(&buf[0]), nil
+ return buf.GoString(), nil
}
// sys/proc_info.h
@@ -339,6 +339,7 @@ func (p *Process) CwdWithContext(ctx context.Context) (string, error) {
}
defer lib.Close()
+ // Lock OS thread to ensure the errno does not change
runtime.LockOSThread()
defer runtime.UnlockOSThread()
@@ -366,6 +367,8 @@ func procArgs(pid int32) ([]byte, int, error) {
if err != nil {
return nil, 0, err
}
+
+ // The first 4 bytes indicate the number of arguments.
nargs := procargs[:4]
return procargs, int(binary.LittleEndian.Uint32(nargs)), nil
}
@@ -434,8 +437,7 @@ func (p *Process) NumThreadsWithContext(ctx context.Context) (int32, error) {
defer lib.Close()
var ti ProcTaskInfo
- const tiSize = int32(unsafe.Sizeof(ti))
- procPidInfo(p.Pid, common.PROC_PIDTASKINFO, 0, uintptr(unsafe.Pointer(&ti)), tiSize)
+ procPidInfo(p.Pid, common.PROC_PIDTASKINFO, 0, uintptr(unsafe.Pointer(&ti)), int32(unsafe.Sizeof(ti)))
return int32(ti.Threadnum), nil
}
@@ -448,8 +450,7 @@ func (p *Process) TimesWithContext(ctx context.Context) (*cpu.TimesStat, error)
defer lib.Close()
var ti ProcTaskInfo
- const tiSize = int32(unsafe.Sizeof(ti))
- procPidInfo(p.Pid, common.PROC_PIDTASKINFO, 0, uintptr(unsafe.Pointer(&ti)), tiSize)
+ procPidInfo(p.Pid, common.PROC_PIDTASKINFO, 0, uintptr(unsafe.Pointer(&ti)), int32(unsafe.Sizeof(ti)))
timescaleToNanoSeconds := getTimeScaleToNanoSeconds()
ret := &cpu.TimesStat{
@@ -468,8 +469,7 @@ func (p *Process) MemoryInfoWithContext(ctx context.Context) (*MemoryInfoStat, e
defer lib.Close()
var ti ProcTaskInfo
- const tiSize = int32(unsafe.Sizeof(ti))
- procPidInfo(p.Pid, common.PROC_PIDTASKINFO, 0, uintptr(unsafe.Pointer(&ti)), tiSize)
+ procPidInfo(p.Pid, common.PROC_PIDTASKINFO, 0, uintptr(unsafe.Pointer(&ti)), int32(unsafe.Sizeof(ti)))
ret := &MemoryInfoStat{
RSS: uint64(ti.Resident_size),
diff --git a/vendor/github.com/shirou/gopsutil/v4/process/process_freebsd.go b/vendor/github.com/shirou/gopsutil/v4/process/process_freebsd.go
index 76373736bfc..a67ac0ef0c0 100644
--- a/vendor/github.com/shirou/gopsutil/v4/process/process_freebsd.go
+++ b/vendor/github.com/shirou/gopsutil/v4/process/process_freebsd.go
@@ -6,6 +6,7 @@ package process
import (
"bytes"
"context"
+ "encoding/binary"
"errors"
"path/filepath"
"sort"
@@ -14,9 +15,9 @@ import (
"golang.org/x/sys/unix"
- cpu "github.com/shirou/gopsutil/v4/cpu"
+ "github.com/shirou/gopsutil/v4/cpu"
"github.com/shirou/gopsutil/v4/internal/common"
- net "github.com/shirou/gopsutil/v4/net"
+ "github.com/shirou/gopsutil/v4/net"
)
func pidsWithContext(ctx context.Context) ([]int32, error) {
@@ -66,7 +67,24 @@ func (p *Process) NameWithContext(ctx context.Context) (string, error) {
}
func (p *Process) CwdWithContext(ctx context.Context) (string, error) {
- return "", common.ErrNotImplementedError
+ mib := []int32{CTLKern, KernProc, KernProcCwd, p.Pid}
+ buf, length, err := common.CallSyscall(mib)
+ if err != nil {
+ return "", err
+ }
+
+ if length != sizeOfKinfoFile {
+ return "", errors.New("unexpected size of KinfoFile")
+ }
+
+ var k kinfoFile
+ br := bytes.NewReader(buf)
+ if err := common.Read(br, binary.LittleEndian, &k); err != nil {
+ return "", err
+ }
+ cwd := common.IntToString(k.Path[:])
+
+ return cwd, nil
}
func (p *Process) ExeWithContext(ctx context.Context) (string, error) {
diff --git a/vendor/github.com/shirou/gopsutil/v4/process/process_freebsd_386.go b/vendor/github.com/shirou/gopsutil/v4/process/process_freebsd_386.go
index 279ba9fbb40..0193ba25b0b 100644
--- a/vendor/github.com/shirou/gopsutil/v4/process/process_freebsd_386.go
+++ b/vendor/github.com/shirou/gopsutil/v4/process/process_freebsd_386.go
@@ -11,6 +11,7 @@ const (
KernProcProc = 8
KernProcPathname = 12
KernProcArgs = 7
+ KernProcCwd = 42
)
const (
@@ -24,6 +25,7 @@ const (
const (
sizeOfKinfoVmentry = 0x488
sizeOfKinfoProc = 0x300
+ sizeOfKinfoFile = 0x570 // TODO: should be changed by running on the target machine
)
const (
@@ -191,3 +193,26 @@ type KinfoVmentry struct {
X_kve_ispare [12]int32
Path [1024]int8
}
+
+// TODO: should be changed by running on the target machine
+type kinfoFile struct {
+ Structsize int32
+ Type int32
+ Fd int32
+ Ref_count int32
+ Flags int32
+ Pad0 int32
+ Offset int64
+ Anon0 [304]byte
+ Status uint16
+ Pad1 uint16
+ X_kf_ispare0 int32
+ Cap_rights capRights
+ X_kf_cap_spare uint64
+ Path [1024]int8 // changed from uint8 by hand
+}
+
+// TODO: should be changed by running on the target machine
+type capRights struct {
+ Rights [2]uint64
+}
diff --git a/vendor/github.com/shirou/gopsutil/v4/process/process_freebsd_amd64.go b/vendor/github.com/shirou/gopsutil/v4/process/process_freebsd_amd64.go
index f3b70ec1bec..67970f64f55 100644
--- a/vendor/github.com/shirou/gopsutil/v4/process/process_freebsd_amd64.go
+++ b/vendor/github.com/shirou/gopsutil/v4/process/process_freebsd_amd64.go
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSD-3-Clause
-// Created by cgo -godefs - DO NOT EDIT
+// Code generated by cmd/cgo -godefs; DO NOT EDIT.
// cgo -godefs types_freebsd.go
package process
@@ -11,6 +11,7 @@ const (
KernProcProc = 8
KernProcPathname = 12
KernProcArgs = 7
+ KernProcCwd = 42
)
const (
@@ -24,6 +25,7 @@ const (
const (
sizeOfKinfoVmentry = 0x488
sizeOfKinfoProc = 0x440
+ sizeOfKinfoFile = 0x570
)
const (
@@ -78,88 +80,94 @@ type Rlimit struct {
}
type KinfoProc struct {
- Structsize int32
- Layout int32
- Args int64 /* pargs */
- Paddr int64 /* proc */
- Addr int64 /* user */
- Tracep int64 /* vnode */
- Textvp int64 /* vnode */
- Fd int64 /* filedesc */
- Vmspace int64 /* vmspace */
- Wchan int64
- Pid int32
- Ppid int32
- Pgid int32
- Tpgid int32
- Sid int32
- Tsid int32
- Jobc int16
- Spare_short1 int16
- Tdev uint32
- Siglist [16]byte /* sigset */
- Sigmask [16]byte /* sigset */
- Sigignore [16]byte /* sigset */
- Sigcatch [16]byte /* sigset */
- Uid uint32
- Ruid uint32
- Svuid uint32
- Rgid uint32
- Svgid uint32
- Ngroups int16
- Spare_short2 int16
- Groups [16]uint32
- Size uint64
- Rssize int64
- Swrss int64
- Tsize int64
- Dsize int64
- Ssize int64
- Xstat uint16
- Acflag uint16
- Pctcpu uint32
- Estcpu uint32
- Slptime uint32
- Swtime uint32
- Cow uint32
- Runtime uint64
- Start Timeval
- Childtime Timeval
- Flag int64
- Kiflag int64
- Traceflag int32
- Stat int8
- Nice int8
- Lock int8
- Rqindex int8
- Oncpu uint8
- Lastcpu uint8
- Tdname [17]int8
- Wmesg [9]int8
- Login [18]int8
- Lockname [9]int8
- Comm [20]int8
- Emul [17]int8
- Loginclass [18]int8
- Sparestrings [50]int8
- Spareints [7]int32
- Flag2 int32
- Fibnum int32
- Cr_flags uint32
- Jid int32
- Numthreads int32
- Tid int32
- Pri Priority
- Rusage Rusage
- Rusage_ch Rusage
- Pcb int64 /* pcb */
- Kstack int64
- Udata int64
- Tdaddr int64 /* thread */
- Spareptrs [6]int64
- Sparelongs [12]int64
- Sflag int64
- Tdflags int64
+ Structsize int32
+ Layout int32
+ Args int64 /* pargs */
+ Paddr int64 /* proc */
+ Addr int64 /* user */
+ Tracep int64 /* vnode */
+ Textvp int64 /* vnode */
+ Fd int64 /* filedesc */
+ Vmspace int64 /* vmspace */
+ Wchan int64
+ Pid int32
+ Ppid int32
+ Pgid int32
+ Tpgid int32
+ Sid int32
+ Tsid int32
+ Jobc int16
+ Spare_short1 int16
+ Tdev_freebsd11 uint32
+ Siglist [16]byte /* sigset */
+ Sigmask [16]byte /* sigset */
+ Sigignore [16]byte /* sigset */
+ Sigcatch [16]byte /* sigset */
+ Uid uint32
+ Ruid uint32
+ Svuid uint32
+ Rgid uint32
+ Svgid uint32
+ Ngroups int16
+ Spare_short2 int16
+ Groups [16]uint32
+ Size uint64
+ Rssize int64
+ Swrss int64
+ Tsize int64
+ Dsize int64
+ Ssize int64
+ Xstat uint16
+ Acflag uint16
+ Pctcpu uint32
+ Estcpu uint32
+ Slptime uint32
+ Swtime uint32
+ Cow uint32
+ Runtime uint64
+ Start Timeval
+ Childtime Timeval
+ Flag int64
+ Kiflag int64
+ Traceflag int32
+ Stat int8
+ Nice int8
+ Lock int8
+ Rqindex int8
+ Oncpu_old uint8
+ Lastcpu_old uint8
+ Tdname [17]int8
+ Wmesg [9]int8
+ Login [18]int8
+ Lockname [9]int8
+ Comm [20]int8
+ Emul [17]int8
+ Loginclass [18]int8
+ Moretdname [4]int8
+ Sparestrings [46]int8
+ Spareints [2]int32
+ Tdev uint64
+ Oncpu int32
+ Lastcpu int32
+ Tracer int32
+ Flag2 int32
+ Fibnum int32
+ Cr_flags uint32
+ Jid int32
+ Numthreads int32
+ Tid int32
+ Pri Priority
+ Rusage Rusage
+ Rusage_ch Rusage
+ Pcb int64 /* pcb */
+ Kstack int64
+ Udata int64
+ Tdaddr int64 /* thread */
+ Pd int64 /* pwddesc, not accurate */
+ Spareptrs [5]int64
+ Sparelongs [12]int64
+ Sflag int64
+ Tdflags int64
}
type Priority struct {
@@ -170,24 +178,47 @@ type Priority struct {
}
type KinfoVmentry struct {
- Structsize int32
- Type int32
- Start uint64
- End uint64
- Offset uint64
- Vn_fileid uint64
- Vn_fsid uint32
- Flags int32
- Resident int32
- Private_resident int32
- Protection int32
- Ref_count int32
- Shadow_count int32
- Vn_type int32
- Vn_size uint64
- Vn_rdev uint32
- Vn_mode uint16
- Status uint16
- X_kve_ispare [12]int32
- Path [1024]int8
+ Structsize int32
+ Type int32
+ Start uint64
+ End uint64
+ Offset uint64
+ Vn_fileid uint64
+ Vn_fsid_freebsd11 uint32
+ Flags int32
+ Resident int32
+ Private_resident int32
+ Protection int32
+ Ref_count int32
+ Shadow_count int32
+ Vn_type int32
+ Vn_size uint64
+ Vn_rdev_freebsd11 uint32
+ Vn_mode uint16
+ Status uint16
+ Type_spec [8]byte
+ Vn_rdev uint64
+ X_kve_ispare [8]int32
+ Path [1024]int8
+}
+
+type kinfoFile struct {
+ Structsize int32
+ Type int32
+ Fd int32
+ Ref_count int32
+ Flags int32
+ Pad0 int32
+ Offset int64
+ Anon0 [304]byte
+ Status uint16
+ Pad1 uint16
+ X_kf_ispare0 int32
+ Cap_rights capRights
+ X_kf_cap_spare uint64
+ Path [1024]int8
+}
+
+type capRights struct {
+ Rights [2]uint64
}
diff --git a/vendor/github.com/shirou/gopsutil/v4/process/process_freebsd_arm.go b/vendor/github.com/shirou/gopsutil/v4/process/process_freebsd_arm.go
index 75ed3063050..6c4fbf69889 100644
--- a/vendor/github.com/shirou/gopsutil/v4/process/process_freebsd_arm.go
+++ b/vendor/github.com/shirou/gopsutil/v4/process/process_freebsd_arm.go
@@ -11,6 +11,7 @@ const (
KernProcProc = 8
KernProcPathname = 12
KernProcArgs = 7
+ KernProcCwd = 42
)
const (
@@ -24,6 +25,7 @@ const (
const (
sizeOfKinfoVmentry = 0x488
sizeOfKinfoProc = 0x440
+ sizeOfKinfoFile = 0x570 // TODO: should be changed by running on the target machine
)
const (
@@ -191,3 +193,26 @@ type KinfoVmentry struct {
X_kve_ispare [12]int32
Path [1024]int8
}
+
+// TODO: should be changed by running on the target machine
+type kinfoFile struct {
+ Structsize int32
+ Type int32
+ Fd int32
+ Ref_count int32
+ Flags int32
+ Pad0 int32
+ Offset int64
+ Anon0 [304]byte
+ Status uint16
+ Pad1 uint16
+ X_kf_ispare0 int32
+ Cap_rights capRights
+ X_kf_cap_spare uint64
+ Path [1024]int8 // changed from uint8 by hand
+}
+
+// TODO: should be changed by running on the target machine
+type capRights struct {
+ Rights [2]uint64
+}
diff --git a/vendor/github.com/shirou/gopsutil/v4/process/process_freebsd_arm64.go b/vendor/github.com/shirou/gopsutil/v4/process/process_freebsd_arm64.go
index 3dc301c027f..dabdc3e3098 100644
--- a/vendor/github.com/shirou/gopsutil/v4/process/process_freebsd_arm64.go
+++ b/vendor/github.com/shirou/gopsutil/v4/process/process_freebsd_arm64.go
@@ -13,6 +13,7 @@ const (
KernProcProc = 8
KernProcPathname = 12
KernProcArgs = 7
+ KernProcCwd = 42
)
const (
@@ -26,6 +27,7 @@ const (
const (
sizeOfKinfoVmentry = 0x488
sizeOfKinfoProc = 0x440
+ sizeOfKinfoFile = 0x570
)
const (
@@ -201,3 +203,24 @@ type KinfoVmentry struct {
X_kve_ispare [8]int32
Path [1024]uint8
}
+
+type kinfoFile struct {
+ Structsize int32
+ Type int32
+ Fd int32
+ Ref_count int32
+ Flags int32
+ Pad0 int32
+ Offset int64
+ Anon0 [304]byte
+ Status uint16
+ Pad1 uint16
+ X_kf_ispare0 int32
+ Cap_rights capRights
+ X_kf_cap_spare uint64
+ Path [1024]int8 // changed from uint8 by hand
+}
+
+type capRights struct {
+ Rights [2]uint64
+}
diff --git a/vendor/github.com/shirou/gopsutil/v4/process/process_posix.go b/vendor/github.com/shirou/gopsutil/v4/process/process_posix.go
index caa9d3f7c03..96c5e065c08 100644
--- a/vendor/github.com/shirou/gopsutil/v4/process/process_posix.go
+++ b/vendor/github.com/shirou/gopsutil/v4/process/process_posix.go
@@ -108,6 +108,7 @@ func PidExistsWithContext(ctx context.Context, pid int32) (bool, error) {
if err != nil {
return false, err
}
+ defer proc.Release()
if isMount(common.HostProcWithContext(ctx)) { // if //proc exists and is mounted, check if //proc/ folder exists
_, err := os.Stat(common.HostProcWithContext(ctx, strconv.Itoa(int(pid))))
@@ -144,6 +145,7 @@ func (p *Process) SendSignalWithContext(ctx context.Context, sig syscall.Signal)
if err != nil {
return err
}
+ defer process.Release()
err = process.Signal(sig)
if err != nil {
diff --git a/vendor/github.com/shirou/gopsutil/v4/process/process_windows.go b/vendor/github.com/shirou/gopsutil/v4/process/process_windows.go
index b00c671e9f3..012886d6cdb 100644
--- a/vendor/github.com/shirou/gopsutil/v4/process/process_windows.go
+++ b/vendor/github.com/shirou/gopsutil/v4/process/process_windows.go
@@ -817,6 +817,7 @@ func (p *Process) KillWithContext(ctx context.Context) error {
if err != nil {
return err
}
+ defer process.Release()
return process.Kill()
}
diff --git a/vendor/modules.txt b/vendor/modules.txt
index a829d157b99..ecc33ff390c 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -1125,7 +1125,7 @@ github.com/segmentio/fasthash/fnv1a
# github.com/sercand/kuberesolver/v5 v5.1.1
## explicit; go 1.18
github.com/sercand/kuberesolver/v5
-# github.com/shirou/gopsutil/v4 v4.24.11
+# github.com/shirou/gopsutil/v4 v4.24.12
## explicit; go 1.18
github.com/shirou/gopsutil/v4/common
github.com/shirou/gopsutil/v4/cpu