mirror of
https://github.com/containers/podman.git
synced 2025-10-20 12:43:58 +08:00
fix(deps): update module github.com/shirou/gopsutil/v4 to v4.25.6
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
This commit is contained in:
2
go.mod
2
go.mod
@ -60,7 +60,7 @@ require (
|
|||||||
github.com/opencontainers/selinux v1.12.0
|
github.com/opencontainers/selinux v1.12.0
|
||||||
github.com/openshift/imagebuilder v1.2.16
|
github.com/openshift/imagebuilder v1.2.16
|
||||||
github.com/rootless-containers/rootlesskit/v2 v2.3.5
|
github.com/rootless-containers/rootlesskit/v2 v2.3.5
|
||||||
github.com/shirou/gopsutil/v4 v4.25.5
|
github.com/shirou/gopsutil/v4 v4.25.6
|
||||||
github.com/sirupsen/logrus v1.9.3
|
github.com/sirupsen/logrus v1.9.3
|
||||||
github.com/spf13/cobra v1.9.1
|
github.com/spf13/cobra v1.9.1
|
||||||
github.com/spf13/pflag v1.0.6
|
github.com/spf13/pflag v1.0.6
|
||||||
|
4
go.sum
4
go.sum
@ -385,8 +385,8 @@ github.com/segmentio/ksuid v1.0.4 h1:sBo2BdShXjmcugAMwjugoGUdUV0pcxY5mW4xKRn3v4c
|
|||||||
github.com/segmentio/ksuid v1.0.4/go.mod h1:/XUiZBD3kVx5SmUOl55voK5yeAbBNNIed+2O73XgrPE=
|
github.com/segmentio/ksuid v1.0.4/go.mod h1:/XUiZBD3kVx5SmUOl55voK5yeAbBNNIed+2O73XgrPE=
|
||||||
github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8=
|
github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8=
|
||||||
github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I=
|
github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I=
|
||||||
github.com/shirou/gopsutil/v4 v4.25.5 h1:rtd9piuSMGeU8g1RMXjZs9y9luK5BwtnG7dZaQUJAsc=
|
github.com/shirou/gopsutil/v4 v4.25.6 h1:kLysI2JsKorfaFPcYmcJqbzROzsBWEOAtw6A7dIfqXs=
|
||||||
github.com/shirou/gopsutil/v4 v4.25.5/go.mod h1:PfybzyydfZcN+JMMjkF6Zb8Mq1A/VcogFFg7hj50W9c=
|
github.com/shirou/gopsutil/v4 v4.25.6/go.mod h1:PfybzyydfZcN+JMMjkF6Zb8Mq1A/VcogFFg7hj50W9c=
|
||||||
github.com/sigstore/fulcio v1.6.6 h1:XaMYX6TNT+8n7Npe8D94nyZ7/ERjEsNGFC+REdi/wzw=
|
github.com/sigstore/fulcio v1.6.6 h1:XaMYX6TNT+8n7Npe8D94nyZ7/ERjEsNGFC+REdi/wzw=
|
||||||
github.com/sigstore/fulcio v1.6.6/go.mod h1:BhQ22lwaebDgIxVBEYOOqLRcN5+xOV+C9bh/GUXRhOk=
|
github.com/sigstore/fulcio v1.6.6/go.mod h1:BhQ22lwaebDgIxVBEYOOqLRcN5+xOV+C9bh/GUXRhOk=
|
||||||
github.com/sigstore/protobuf-specs v0.4.1 h1:5SsMqZbdkcO/DNHudaxuCUEjj6x29tS2Xby1BxGU7Zc=
|
github.com/sigstore/protobuf-specs v0.4.1 h1:5SsMqZbdkcO/DNHudaxuCUEjj6x29tS2Xby1BxGU7Zc=
|
||||||
|
2
vendor/github.com/shirou/gopsutil/v4/cpu/cpu_linux.go
generated
vendored
2
vendor/github.com/shirou/gopsutil/v4/cpu/cpu_linux.go
generated
vendored
@ -135,7 +135,7 @@ func finishCPUInfo(ctx context.Context, c *InfoStat) {
|
|||||||
var err error
|
var err error
|
||||||
var value float64
|
var value float64
|
||||||
|
|
||||||
if len(c.CoreID) == 0 {
|
if c.CoreID == "" {
|
||||||
lines, err = common.ReadLines(sysCPUPath(ctx, c.CPU, "topology/core_id"))
|
lines, err = common.ReadLines(sysCPUPath(ctx, c.CPU, "topology/core_id"))
|
||||||
if err == nil {
|
if err == nil {
|
||||||
c.CoreID = lines[0]
|
c.CoreID = lines[0]
|
||||||
|
6
vendor/github.com/shirou/gopsutil/v4/cpu/cpu_solaris.go
generated
vendored
6
vendor/github.com/shirou/gopsutil/v4/cpu/cpu_solaris.go
generated
vendored
@ -140,8 +140,8 @@ func InfoWithContext(ctx context.Context) ([]InfoStat, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
result := make([]InfoStat, 0, len(flags))
|
result := make([]InfoStat, 0, len(flags))
|
||||||
for _, proc := range procs {
|
for i := range procs {
|
||||||
procWithFlags := proc
|
procWithFlags := procs[i]
|
||||||
procWithFlags.Flags = flags
|
procWithFlags.Flags = flags
|
||||||
result = append(result, procWithFlags)
|
result = append(result, procWithFlags)
|
||||||
}
|
}
|
||||||
@ -149,7 +149,7 @@ func InfoWithContext(ctx context.Context) ([]InfoStat, error) {
|
|||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var flagsMatch = regexp.MustCompile(`[\w\.]+`)
|
var flagsMatch = regexp.MustCompile(`[\w.]+`)
|
||||||
|
|
||||||
func parseISAInfo(cmdOutput string) ([]string, error) {
|
func parseISAInfo(cmdOutput string) ([]string, error) {
|
||||||
words := flagsMatch.FindAllString(cmdOutput, -1)
|
words := flagsMatch.FindAllString(cmdOutput, -1)
|
||||||
|
8
vendor/github.com/shirou/gopsutil/v4/internal/common/common.go
generated
vendored
8
vendor/github.com/shirou/gopsutil/v4/internal/common/common.go
generated
vendored
@ -115,7 +115,7 @@ func ReadLines(filename string) ([]string, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ReadLine reads a file and returns the first occurrence of a line that is prefixed with prefix.
|
// ReadLine reads a file and returns the first occurrence of a line that is prefixed with prefix.
|
||||||
func ReadLine(filename string, prefix string) (string, error) {
|
func ReadLine(filename, prefix string) (string, error) {
|
||||||
f, err := os.Open(filename)
|
f, err := os.Open(filename)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
@ -156,7 +156,7 @@ func ReadLinesOffsetN(filename string, offset uint, n int) ([]string, error) {
|
|||||||
for i := uint(0); i < uint(n)+offset || n < 0; i++ {
|
for i := uint(0); i < uint(n)+offset || n < 0; i++ {
|
||||||
line, err := r.ReadString('\n')
|
line, err := r.ReadString('\n')
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err == io.EOF && len(line) > 0 {
|
if err == io.EOF && line != "" {
|
||||||
ret = append(ret, strings.Trim(line, "\n"))
|
ret = append(ret, strings.Trim(line, "\n"))
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
@ -349,7 +349,7 @@ func PathExistsWithContents(filename string) bool {
|
|||||||
|
|
||||||
// GetEnvWithContext retrieves the environment variable key. If it does not exist it returns the default.
|
// GetEnvWithContext retrieves the environment variable key. If it does not exist it returns the default.
|
||||||
// The context may optionally contain a map superseding os.EnvKey.
|
// The context may optionally contain a map superseding os.EnvKey.
|
||||||
func GetEnvWithContext(ctx context.Context, key string, dfault string, combineWith ...string) string {
|
func GetEnvWithContext(ctx context.Context, key, dfault string, combineWith ...string) string {
|
||||||
var value string
|
var value string
|
||||||
if env, ok := ctx.Value(common.EnvKey).(common.EnvMap); ok {
|
if env, ok := ctx.Value(common.EnvKey).(common.EnvMap); ok {
|
||||||
value = env[common.EnvKeyType(key)]
|
value = env[common.EnvKeyType(key)]
|
||||||
@ -365,7 +365,7 @@ func GetEnvWithContext(ctx context.Context, key string, dfault string, combineWi
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetEnv retrieves the environment variable key. If it does not exist it returns the default.
|
// GetEnv retrieves the environment variable key. If it does not exist it returns the default.
|
||||||
func GetEnv(key string, dfault string, combineWith ...string) string {
|
func GetEnv(key, dfault string, combineWith ...string) string {
|
||||||
value := os.Getenv(key)
|
value := os.Getenv(key)
|
||||||
if value == "" {
|
if value == "" {
|
||||||
value = dfault
|
value = dfault
|
||||||
|
4
vendor/github.com/shirou/gopsutil/v4/internal/common/common_linux.go
generated
vendored
4
vendor/github.com/shirou/gopsutil/v4/internal/common/common_linux.go
generated
vendored
@ -317,11 +317,11 @@ func VirtualizationWithContext(ctx context.Context) (string, string, error) {
|
|||||||
return system, role, nil
|
return system, role, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetOSRelease() (platform string, version string, err error) {
|
func GetOSRelease() (platform, version string, err error) {
|
||||||
return GetOSReleaseWithContext(context.Background())
|
return GetOSReleaseWithContext(context.Background())
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetOSReleaseWithContext(ctx context.Context) (platform string, version string, err error) {
|
func GetOSReleaseWithContext(ctx context.Context) (platform, version string, err error) {
|
||||||
contents, err := ReadLines(HostEtcWithContext(ctx, "os-release"))
|
contents, err := ReadLines(HostEtcWithContext(ctx, "os-release"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", "", nil // return empty
|
return "", "", nil // return empty
|
||||||
|
2
vendor/github.com/shirou/gopsutil/v4/internal/common/common_unix.go
generated
vendored
2
vendor/github.com/shirou/gopsutil/v4/internal/common/common_unix.go
generated
vendored
@ -33,7 +33,7 @@ func CallLsofWithContext(ctx context.Context, invoke Invoker, pid int32, args ..
|
|||||||
|
|
||||||
var ret []string
|
var ret []string
|
||||||
for _, l := range lines[1:] {
|
for _, l := range lines[1:] {
|
||||||
if len(l) == 0 {
|
if l == "" {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
ret = append(ret, l)
|
ret = append(ret, l)
|
||||||
|
53
vendor/github.com/shirou/gopsutil/v4/internal/common/readlink_linux.go
generated
vendored
Normal file
53
vendor/github.com/shirou/gopsutil/v4/internal/common/readlink_linux.go
generated
vendored
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
package common
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
"os"
|
||||||
|
"sync"
|
||||||
|
"syscall"
|
||||||
|
)
|
||||||
|
|
||||||
|
var bufferPool = sync.Pool{
|
||||||
|
New: func() any {
|
||||||
|
b := make([]byte, syscall.PathMax)
|
||||||
|
return &b
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// The following three functions are copied from stdlib.
|
||||||
|
|
||||||
|
// ignoringEINTR2 is ignoringEINTR, but returning an additional value.
|
||||||
|
func ignoringEINTR2[T any](fn func() (T, error)) (T, error) {
|
||||||
|
for {
|
||||||
|
v, err := fn()
|
||||||
|
if !errors.Is(err, syscall.EINTR) {
|
||||||
|
return v, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Many functions in package syscall return a count of -1 instead of 0.
|
||||||
|
// Using fixCount(call()) instead of call() corrects the count.
|
||||||
|
func fixCount(n int, err error) (int, error) {
|
||||||
|
if n < 0 {
|
||||||
|
n = 0
|
||||||
|
}
|
||||||
|
return n, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Readlink behaves like os.Readlink but caches the buffer passed to syscall.Readlink.
|
||||||
|
func Readlink(name string) (string, error) {
|
||||||
|
b := bufferPool.Get().(*[]byte)
|
||||||
|
|
||||||
|
n, err := ignoringEINTR2(func() (int, error) {
|
||||||
|
return fixCount(syscall.Readlink(name, *b))
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
bufferPool.Put(b)
|
||||||
|
return "", &os.PathError{Op: "readlink", Path: name, Err: err}
|
||||||
|
}
|
||||||
|
|
||||||
|
result := string((*b)[:n])
|
||||||
|
bufferPool.Put(b)
|
||||||
|
return result, nil
|
||||||
|
}
|
24
vendor/github.com/shirou/gopsutil/v4/mem/ex_windows.go
generated
vendored
24
vendor/github.com/shirou/gopsutil/v4/mem/ex_windows.go
generated
vendored
@ -11,10 +11,14 @@ import (
|
|||||||
// https://learn.microsoft.com/en-us/windows/win32/api/sysinfoapi/ns-sysinfoapi-memorystatusex
|
// https://learn.microsoft.com/en-us/windows/win32/api/sysinfoapi/ns-sysinfoapi-memorystatusex
|
||||||
// https://learn.microsoft.com/en-us/windows/win32/api/psapi/ns-psapi-performance_information
|
// https://learn.microsoft.com/en-us/windows/win32/api/psapi/ns-psapi-performance_information
|
||||||
type ExVirtualMemory struct {
|
type ExVirtualMemory struct {
|
||||||
CommitLimit uint64 `json:"commitLimit"`
|
CommitLimit uint64 `json:"commitLimit"`
|
||||||
CommitTotal uint64 `json:"commitTotal"`
|
CommitTotal uint64 `json:"commitTotal"`
|
||||||
VirtualTotal uint64 `json:"virtualTotal"`
|
VirtualTotal uint64 `json:"virtualTotal"`
|
||||||
VirtualAvail uint64 `json:"virtualAvail"`
|
VirtualAvail uint64 `json:"virtualAvail"`
|
||||||
|
PhysTotal uint64 `json:"physTotal"`
|
||||||
|
PhysAvail uint64 `json:"physAvail"`
|
||||||
|
PageFileTotal uint64 `json:"pageFileTotal"`
|
||||||
|
PageFileAvail uint64 `json:"pageFileAvail"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ExWindows struct{}
|
type ExWindows struct{}
|
||||||
@ -44,10 +48,14 @@ func (e *ExWindows) VirtualMemory() (*ExVirtualMemory, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ret := &ExVirtualMemory{
|
ret := &ExVirtualMemory{
|
||||||
CommitLimit: perfInfo.commitLimit * perfInfo.pageSize,
|
CommitLimit: perfInfo.commitLimit * perfInfo.pageSize,
|
||||||
CommitTotal: perfInfo.commitTotal * perfInfo.pageSize,
|
CommitTotal: perfInfo.commitTotal * perfInfo.pageSize,
|
||||||
VirtualTotal: memInfo.ullTotalVirtual,
|
VirtualTotal: memInfo.ullTotalVirtual,
|
||||||
VirtualAvail: memInfo.ullAvailVirtual,
|
VirtualAvail: memInfo.ullAvailVirtual,
|
||||||
|
PhysTotal: memInfo.ullTotalPhys,
|
||||||
|
PhysAvail: memInfo.ullAvailPhys,
|
||||||
|
PageFileTotal: memInfo.ullTotalPageFile,
|
||||||
|
PageFileAvail: memInfo.ullAvailPageFile,
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret, nil
|
return ret, nil
|
||||||
|
8
vendor/github.com/shirou/gopsutil/v4/net/net.go
generated
vendored
8
vendor/github.com/shirou/gopsutil/v4/net/net.go
generated
vendored
@ -94,7 +94,7 @@ type ConntrackStat struct {
|
|||||||
SearchRestart uint32 `json:"searchRestart"` // Conntrack table lookups restarted due to hashtable resizes
|
SearchRestart uint32 `json:"searchRestart"` // Conntrack table lookups restarted due to hashtable resizes
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewConntrackStat(e uint32, s uint32, f uint32, n uint32, inv uint32, ign uint32, del uint32, dlst uint32, ins uint32, insfail uint32, drop uint32, edrop uint32, ie uint32, en uint32, ec uint32, ed uint32, sr uint32) *ConntrackStat {
|
func NewConntrackStat(e, s, f, n, inv, ign, del, dlst, ins, insfail, drop, edrop, ie, en, ec, ed, sr uint32) *ConntrackStat {
|
||||||
return &ConntrackStat{
|
return &ConntrackStat{
|
||||||
Entries: e,
|
Entries: e,
|
||||||
Searched: s,
|
Searched: s,
|
||||||
@ -273,7 +273,7 @@ func getIOCountersAll(n []IOCountersStat) []IOCountersStat {
|
|||||||
return []IOCountersStat{r}
|
return []IOCountersStat{r}
|
||||||
}
|
}
|
||||||
|
|
||||||
// NetIOCounters returns network I/O statistics for every network
|
// IOCounters returns network I/O statistics for every network
|
||||||
// interface installed on the system. If pernic argument is false,
|
// interface installed on the system. If pernic argument is false,
|
||||||
// return only sum of all information (which name is 'all'). If true,
|
// return only sum of all information (which name is 'all'). If true,
|
||||||
// every network interface installed on the system is returned
|
// every network interface installed on the system is returned
|
||||||
@ -296,7 +296,7 @@ func ProtoCounters(protocols []string) ([]ProtoCountersStat, error) {
|
|||||||
return ProtoCountersWithContext(context.Background(), protocols)
|
return ProtoCountersWithContext(context.Background(), protocols)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NetFilterCounters returns iptables conntrack statistics
|
// FilterCounters returns iptables conntrack statistics
|
||||||
// the currently in use conntrack count and the max.
|
// the currently in use conntrack count and the max.
|
||||||
// If the file does not exist or is invalid it will return nil.
|
// If the file does not exist or is invalid it will return nil.
|
||||||
func FilterCounters() ([]FilterStat, error) {
|
func FilterCounters() ([]FilterStat, error) {
|
||||||
@ -349,7 +349,7 @@ func ConnectionsPidMax(kind string, pid int32, maxConn int) ([]ConnectionStat, e
|
|||||||
|
|
||||||
// Pids retunres all pids.
|
// Pids retunres all pids.
|
||||||
// Note: this is a copy of process_linux.Pids()
|
// Note: this is a copy of process_linux.Pids()
|
||||||
// FIXME: Import process occures import cycle.
|
// FIXME: Import process occurs import cycle.
|
||||||
// move to common made other platform breaking. Need consider.
|
// move to common made other platform breaking. Need consider.
|
||||||
func Pids() ([]int32, error) {
|
func Pids() ([]int32, error) {
|
||||||
return PidsWithContext(context.Background())
|
return PidsWithContext(context.Background())
|
||||||
|
4
vendor/github.com/shirou/gopsutil/v4/net/net_aix.go
generated
vendored
4
vendor/github.com/shirou/gopsutil/v4/net/net_aix.go
generated
vendored
@ -83,7 +83,7 @@ var portMatch = regexp.MustCompile(`(.*)\.(\d+)$`)
|
|||||||
|
|
||||||
// This function only works for netstat returning addresses with a "."
|
// This function only works for netstat returning addresses with a "."
|
||||||
// before the port (0.0.0.0.22 instead of 0.0.0.0:22).
|
// before the port (0.0.0.0.22 instead of 0.0.0.0:22).
|
||||||
func parseNetstatAddr(local string, remote string, family uint32) (laddr Addr, raddr Addr, err error) {
|
func parseNetstatAddr(local, remote string, family uint32) (laddr, raddr Addr, err error) {
|
||||||
parse := func(l string) (Addr, error) {
|
parse := func(l string) (Addr, error) {
|
||||||
matches := portMatch.FindStringSubmatch(l)
|
matches := portMatch.FindStringSubmatch(l)
|
||||||
if matches == nil {
|
if matches == nil {
|
||||||
@ -183,7 +183,7 @@ func hasCorrectInetProto(kind, proto string) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func parseNetstatA(output string, kind string) ([]ConnectionStat, error) {
|
func parseNetstatA(output, kind string) ([]ConnectionStat, error) {
|
||||||
var ret []ConnectionStat
|
var ret []ConnectionStat
|
||||||
lines := strings.Split(string(output), "\n")
|
lines := strings.Split(string(output), "\n")
|
||||||
|
|
||||||
|
4
vendor/github.com/shirou/gopsutil/v4/net/net_linux.go
generated
vendored
4
vendor/github.com/shirou/gopsutil/v4/net/net_linux.go
generated
vendored
@ -540,7 +540,7 @@ func PidsWithContext(ctx context.Context) ([]int32, error) {
|
|||||||
|
|
||||||
// Note: the following is based off process_linux structs and methods
|
// Note: the following is based off process_linux structs and methods
|
||||||
// we need these to fetch the owner of a process ID
|
// we need these to fetch the owner of a process ID
|
||||||
// FIXME: Import process occures import cycle.
|
// FIXME: Import process occurs import cycle.
|
||||||
// see remarks on pids()
|
// see remarks on pids()
|
||||||
type process struct {
|
type process struct {
|
||||||
Pid int32 `json:"pid"`
|
Pid int32 `json:"pid"`
|
||||||
@ -793,7 +793,7 @@ func processUnix(file string, kind netConnectionKindType, inodes map[string][]in
|
|||||||
return ret, nil
|
return ret, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func updateMap(src map[string][]inodeMap, add map[string][]inodeMap) map[string][]inodeMap {
|
func updateMap(src, add map[string][]inodeMap) map[string][]inodeMap {
|
||||||
for key, value := range add {
|
for key, value := range add {
|
||||||
a, exists := src[key]
|
a, exists := src[key]
|
||||||
if !exists {
|
if !exists {
|
||||||
|
8
vendor/github.com/shirou/gopsutil/v4/net/net_openbsd.go
generated
vendored
8
vendor/github.com/shirou/gopsutil/v4/net/net_openbsd.go
generated
vendored
@ -217,7 +217,7 @@ func parseNetstatLine(line string) (ConnectionStat, error) {
|
|||||||
return n, nil
|
return n, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func parseNetstatAddr(local string, remote string, family uint32) (laddr Addr, raddr Addr, err error) {
|
func parseNetstatAddr(local, remote string, family uint32) (laddr, raddr Addr, err error) {
|
||||||
parse := func(l string) (Addr, error) {
|
parse := func(l string) (Addr, error) {
|
||||||
matches := portMatch.FindStringSubmatch(l)
|
matches := portMatch.FindStringSubmatch(l)
|
||||||
if matches == nil {
|
if matches == nil {
|
||||||
@ -260,11 +260,7 @@ func ConnectionsWithContext(ctx context.Context, kind string) ([]ConnectionStat,
|
|||||||
switch strings.ToLower(kind) {
|
switch strings.ToLower(kind) {
|
||||||
default:
|
default:
|
||||||
fallthrough
|
fallthrough
|
||||||
case "":
|
case "", "all", "inet":
|
||||||
fallthrough
|
|
||||||
case "all":
|
|
||||||
fallthrough
|
|
||||||
case "inet":
|
|
||||||
// nothing to add
|
// nothing to add
|
||||||
case "inet4":
|
case "inet4":
|
||||||
args = append(args, "-finet")
|
args = append(args, "-finet")
|
||||||
|
8
vendor/github.com/shirou/gopsutil/v4/net/net_unix.go
generated
vendored
8
vendor/github.com/shirou/gopsutil/v4/net/net_unix.go
generated
vendored
@ -29,11 +29,7 @@ func ConnectionsPidWithContext(ctx context.Context, kind string, pid int32) ([]C
|
|||||||
switch strings.ToLower(kind) {
|
switch strings.ToLower(kind) {
|
||||||
default:
|
default:
|
||||||
fallthrough
|
fallthrough
|
||||||
case "":
|
case "", "all", "inet":
|
||||||
fallthrough
|
|
||||||
case "all":
|
|
||||||
fallthrough
|
|
||||||
case "inet":
|
|
||||||
args = append(args, "tcp", "-i", "udp")
|
args = append(args, "tcp", "-i", "udp")
|
||||||
case "inet4":
|
case "inet4":
|
||||||
args = append(args, "4")
|
args = append(args, "4")
|
||||||
@ -135,7 +131,7 @@ func parseNetLine(line string) (ConnectionStat, error) {
|
|||||||
return n, nil
|
return n, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func parseNetAddr(line string) (laddr Addr, raddr Addr, err error) {
|
func parseNetAddr(line string) (laddr, raddr Addr, err error) {
|
||||||
parse := func(l string) (Addr, error) {
|
parse := func(l string) (Addr, error) {
|
||||||
host, port, err := net.SplitHostPort(l)
|
host, port, err := net.SplitHostPort(l)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
9
vendor/github.com/shirou/gopsutil/v4/process/process_darwin.go
generated
vendored
9
vendor/github.com/shirou/gopsutil/v4/process/process_darwin.go
generated
vendored
@ -45,7 +45,8 @@ func pidsWithContext(_ context.Context) ([]int32, error) {
|
|||||||
return ret, err
|
return ret, err
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, proc := range kprocs {
|
for i := range kprocs {
|
||||||
|
proc := &kprocs[i]
|
||||||
ret = append(ret, int32(proc.Proc.P_pid))
|
ret = append(ret, int32(proc.Proc.P_pid))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,7 +75,7 @@ func (p *Process) NameWithContext(ctx context.Context) (string, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
if len(cmdName) > 0 {
|
if cmdName != "" {
|
||||||
extendedName := filepath.Base(cmdName)
|
extendedName := filepath.Base(cmdName)
|
||||||
if strings.HasPrefix(extendedName, p.name) {
|
if strings.HasPrefix(extendedName, p.name) {
|
||||||
name = extendedName
|
name = extendedName
|
||||||
@ -238,7 +239,7 @@ func (p *Process) getKProc() (*unix.KinfoProc, error) {
|
|||||||
// Return value deletes Header line(you must not input wrong arg).
|
// Return value deletes Header line(you must not input wrong arg).
|
||||||
// And splited by Space. Caller have responsibility to manage.
|
// And splited by Space. Caller have responsibility to manage.
|
||||||
// If passed arg pid is 0, get information from all process.
|
// If passed arg pid is 0, get information from all process.
|
||||||
func callPsWithContext(ctx context.Context, arg string, pid int32, threadOption bool, nameOption bool) ([][]string, error) {
|
func callPsWithContext(ctx context.Context, arg string, pid int32, threadOption, nameOption bool) ([][]string, error) {
|
||||||
var cmd []string
|
var cmd []string
|
||||||
switch {
|
switch {
|
||||||
case pid == 0: // will get from all processes.
|
case pid == 0: // will get from all processes.
|
||||||
@ -396,7 +397,7 @@ func (p *Process) cmdlineSlice() ([]string, error) {
|
|||||||
// of the process.
|
// of the process.
|
||||||
for _, arg := range args[1:] {
|
for _, arg := range args[1:] {
|
||||||
argStr = string(arg)
|
argStr = string(arg)
|
||||||
if len(argStr) > 0 {
|
if argStr != "" {
|
||||||
if nargs > 0 {
|
if nargs > 0 {
|
||||||
argSlice = append(argSlice, argStr)
|
argSlice = append(argSlice, argStr)
|
||||||
nargs--
|
nargs--
|
||||||
|
22
vendor/github.com/shirou/gopsutil/v4/process/process_linux.go
generated
vendored
22
vendor/github.com/shirou/gopsutil/v4/process/process_linux.go
generated
vendored
@ -358,7 +358,7 @@ func (p *Process) ChildrenWithContext(ctx context.Context) ([]*Process, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if int32(ppid) == p.Pid {
|
if ppid == int64(p.Pid) {
|
||||||
np, err := NewProcessWithContext(ctx, int32(pid))
|
np, err := NewProcessWithContext(ctx, int32(pid))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
continue
|
continue
|
||||||
@ -372,15 +372,7 @@ func (p *Process) ChildrenWithContext(ctx context.Context) ([]*Process, error) {
|
|||||||
|
|
||||||
func (p *Process) OpenFilesWithContext(ctx context.Context) ([]OpenFilesStat, error) {
|
func (p *Process) OpenFilesWithContext(ctx context.Context) ([]OpenFilesStat, error) {
|
||||||
_, ofs, err := p.fillFromfdWithContext(ctx)
|
_, ofs, err := p.fillFromfdWithContext(ctx)
|
||||||
if err != nil {
|
return ofs, err
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
ret := make([]OpenFilesStat, len(ofs))
|
|
||||||
for i, o := range ofs {
|
|
||||||
ret[i] = *o
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Process) ConnectionsWithContext(ctx context.Context) ([]net.ConnectionStat, error) {
|
func (p *Process) ConnectionsWithContext(ctx context.Context) ([]net.ConnectionStat, error) {
|
||||||
@ -629,17 +621,17 @@ func (p *Process) fillFromfdListWithContext(ctx context.Context) (string, []stri
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get num_fds from /proc/(pid)/fd
|
// Get num_fds from /proc/(pid)/fd
|
||||||
func (p *Process) fillFromfdWithContext(ctx context.Context) (int32, []*OpenFilesStat, error) {
|
func (p *Process) fillFromfdWithContext(ctx context.Context) (int32, []OpenFilesStat, error) {
|
||||||
statPath, fnames, err := p.fillFromfdListWithContext(ctx)
|
statPath, fnames, err := p.fillFromfdListWithContext(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, nil, err
|
return 0, nil, err
|
||||||
}
|
}
|
||||||
numFDs := int32(len(fnames))
|
numFDs := int32(len(fnames))
|
||||||
|
|
||||||
var openfiles []*OpenFilesStat
|
openfiles := make([]OpenFilesStat, 0, numFDs)
|
||||||
for _, fd := range fnames {
|
for _, fd := range fnames {
|
||||||
fpath := filepath.Join(statPath, fd)
|
fpath := filepath.Join(statPath, fd)
|
||||||
filepath, err := os.Readlink(fpath)
|
path, err := common.Readlink(fpath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@ -647,8 +639,8 @@ func (p *Process) fillFromfdWithContext(ctx context.Context) (int32, []*OpenFile
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return numFDs, openfiles, err
|
return numFDs, openfiles, err
|
||||||
}
|
}
|
||||||
o := &OpenFilesStat{
|
o := OpenFilesStat{
|
||||||
Path: filepath,
|
Path: path,
|
||||||
Fd: t,
|
Fd: t,
|
||||||
}
|
}
|
||||||
openfiles = append(openfiles, o)
|
openfiles = append(openfiles, o)
|
||||||
|
2
vendor/github.com/shirou/gopsutil/v4/process/process_openbsd.go
generated
vendored
2
vendor/github.com/shirou/gopsutil/v4/process/process_openbsd.go
generated
vendored
@ -358,7 +358,7 @@ func (p *Process) getKProc() (*KinfoProc, error) {
|
|||||||
return &k, nil
|
return &k, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func callKernProcSyscall(op int32, arg int32) ([]byte, uint64, error) {
|
func callKernProcSyscall(op, arg int32) ([]byte, uint64, error) {
|
||||||
mib := []int32{CTLKern, KernProc, op, arg, sizeOfKinfoProc, 0}
|
mib := []int32{CTLKern, KernProc, op, arg, sizeOfKinfoProc, 0}
|
||||||
mibptr := unsafe.Pointer(&mib[0])
|
mibptr := unsafe.Pointer(&mib[0])
|
||||||
miblen := uint64(len(mib))
|
miblen := uint64(len(mib))
|
||||||
|
3
vendor/github.com/shirou/gopsutil/v4/process/process_posix.go
generated
vendored
3
vendor/github.com/shirou/gopsutil/v4/process/process_posix.go
generated
vendored
@ -67,7 +67,8 @@ func getTerminalMap() (map[uint64]string, error) {
|
|||||||
|
|
||||||
for _, name := range termfiles {
|
for _, name := range termfiles {
|
||||||
stat := unix.Stat_t{}
|
stat := unix.Stat_t{}
|
||||||
if err = unix.Stat(name, &stat); err != nil {
|
err = unix.Stat(name, &stat)
|
||||||
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
rdev := uint64(stat.Rdev)
|
rdev := uint64(stat.Rdev)
|
||||||
|
3
vendor/github.com/shirou/gopsutil/v4/process/process_windows.go
generated
vendored
3
vendor/github.com/shirou/gopsutil/v4/process/process_windows.go
generated
vendored
@ -882,7 +882,8 @@ func getFromSnapProcess(pid int32) (int32, int32, string, error) { //nolint:unpa
|
|||||||
defer windows.CloseHandle(snap)
|
defer windows.CloseHandle(snap)
|
||||||
var pe32 windows.ProcessEntry32
|
var pe32 windows.ProcessEntry32
|
||||||
pe32.Size = uint32(unsafe.Sizeof(pe32))
|
pe32.Size = uint32(unsafe.Sizeof(pe32))
|
||||||
if err = windows.Process32First(snap, &pe32); err != nil {
|
err = windows.Process32First(snap, &pe32)
|
||||||
|
if err != nil {
|
||||||
return 0, 0, "", err
|
return 0, 0, "", err
|
||||||
}
|
}
|
||||||
for {
|
for {
|
||||||
|
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
@ -829,7 +829,7 @@ github.com/secure-systems-lab/go-securesystemslib/encrypted
|
|||||||
# github.com/segmentio/ksuid v1.0.4
|
# github.com/segmentio/ksuid v1.0.4
|
||||||
## explicit; go 1.12
|
## explicit; go 1.12
|
||||||
github.com/segmentio/ksuid
|
github.com/segmentio/ksuid
|
||||||
# github.com/shirou/gopsutil/v4 v4.25.5
|
# github.com/shirou/gopsutil/v4 v4.25.6
|
||||||
## explicit; go 1.23
|
## explicit; go 1.23
|
||||||
github.com/shirou/gopsutil/v4/common
|
github.com/shirou/gopsutil/v4/common
|
||||||
github.com/shirou/gopsutil/v4/cpu
|
github.com/shirou/gopsutil/v4/cpu
|
||||||
|
Reference in New Issue
Block a user