Merge pull request #27645 from containers/renovate/github.com-shirou-gopsutil-v4-4.x

Update module github.com/shirou/gopsutil/v4 to v4.25.11
This commit is contained in:
openshift-merge-bot[bot]
2025-12-04 15:35:39 +00:00
committed by GitHub
16 changed files with 51 additions and 40 deletions

8
go.mod
View File

@@ -57,7 +57,7 @@ require (
github.com/opencontainers/selinux v1.13.1
github.com/openshift/imagebuilder v1.2.19
github.com/rootless-containers/rootlesskit/v2 v2.3.5
github.com/shirou/gopsutil/v4 v4.25.10
github.com/shirou/gopsutil/v4 v4.25.11
github.com/sirupsen/logrus v1.9.4-0.20251023124752-b61f268f75b6
github.com/spf13/cobra v1.10.1
github.com/spf13/pflag v1.0.10
@@ -110,7 +110,7 @@ require (
github.com/disiqueira/gotree/v3 v3.0.2 // indirect
github.com/distribution/reference v0.6.0 // indirect
github.com/docker/docker-credential-helpers v0.9.4 // indirect
github.com/ebitengine/purego v0.9.0 // indirect
github.com/ebitengine/purego v0.9.1 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/fsnotify/fsnotify v1.9.0 // indirect
github.com/fsouza/go-dockerclient v1.12.2 // indirect
@@ -167,8 +167,8 @@ require (
github.com/stefanberger/go-pkcs11uri v0.0.0-20230803200340-78284954bff6 // indirect
github.com/sylabs/sif/v2 v2.22.0 // indirect
github.com/tchap/go-patricia/v2 v2.3.3 // indirect
github.com/tklauser/go-sysconf v0.3.15 // indirect
github.com/tklauser/numcpus v0.10.0 // indirect
github.com/tklauser/go-sysconf v0.3.16 // indirect
github.com/tklauser/numcpus v0.11.0 // indirect
github.com/u-root/uio v0.0.0-20240224005618-d2acac8f3701 // indirect
github.com/ulikunitz/xz v0.5.15 // indirect
github.com/vbatts/tar-split v0.12.2 // indirect

16
go.sum
View File

@@ -120,8 +120,8 @@ github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4
github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
github.com/ebitengine/purego v0.9.0 h1:mh0zpKBIXDceC63hpvPuGLiJ8ZAa3DfrFTudmfi8A4k=
github.com/ebitengine/purego v0.9.0/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ=
github.com/ebitengine/purego v0.9.1 h1:a/k2f2HQU3Pi399RPW1MOaZyhKJL9w/xFpKAg4q1s0A=
github.com/ebitengine/purego v0.9.1/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ=
github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM=
github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU=
github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=
@@ -345,8 +345,8 @@ github.com/secure-systems-lab/go-securesystemslib v0.9.1 h1:nZZaNz4DiERIQguNy0cL
github.com/secure-systems-lab/go-securesystemslib v0.9.1/go.mod h1:np53YzT0zXGMv6x4iEWc9Z59uR+x+ndLwCLqPYpLXVU=
github.com/sergi/go-diff v1.4.0 h1:n/SP9D5ad1fORl+llWyN+D6qoUETXNZARKjyY2/KVCw=
github.com/sergi/go-diff v1.4.0/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4=
github.com/shirou/gopsutil/v4 v4.25.10 h1:at8lk/5T1OgtuCp+AwrDofFRjnvosn0nkN2OLQ6g8tA=
github.com/shirou/gopsutil/v4 v4.25.10/go.mod h1:+kSwyC8DRUD9XXEHCAFjK+0nuArFJM0lva+StQAcskM=
github.com/shirou/gopsutil/v4 v4.25.11 h1:X53gB7muL9Gnwwo2evPSE+SfOrltMoR6V3xJAXZILTY=
github.com/shirou/gopsutil/v4 v4.25.11/go.mod h1:EivAfP5x2EhLp2ovdpKSozecVXn1TmuG7SMzs/Wh4PU=
github.com/sigstore/fulcio v1.8.1 h1:PmoQv3XmhjR2BWFWw5LcMUXJPmhyizOIL7HeYnpio58=
github.com/sigstore/fulcio v1.8.1/go.mod h1:7tP3KW9eCGlPYRj5N4MSuUOat7CkeIHuXZ2jAUQ+Rwc=
github.com/sigstore/protobuf-specs v0.5.0 h1:F8YTI65xOHw70NrvPwJ5PhAzsvTnuJMGLkA4FIkofAY=
@@ -383,10 +383,10 @@ github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4=
github.com/tidwall/pretty v1.2.1/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
github.com/tidwall/sjson v1.2.5 h1:kLy8mja+1c9jlljvWTlSazM7cKDRfJuR/bOJhcY5NcY=
github.com/tidwall/sjson v1.2.5/go.mod h1:Fvgq9kS/6ociJEDnK0Fk1cpYF4FIW6ZF7LAe+6jwd28=
github.com/tklauser/go-sysconf v0.3.15 h1:VE89k0criAymJ/Os65CSn1IXaol+1wrsFHEB8Ol49K4=
github.com/tklauser/go-sysconf v0.3.15/go.mod h1:Dmjwr6tYFIseJw7a3dRLJfsHAMXZ3nEnL/aZY+0IuI4=
github.com/tklauser/numcpus v0.10.0 h1:18njr6LDBk1zuna922MgdjQuJFjrdppsZG60sHGfjso=
github.com/tklauser/numcpus v0.10.0/go.mod h1:BiTKazU708GQTYF4mB+cmlpT2Is1gLk7XVuEeem8LsQ=
github.com/tklauser/go-sysconf v0.3.16 h1:frioLaCQSsF5Cy1jgRBrzr6t502KIIwQ0MArYICU0nA=
github.com/tklauser/go-sysconf v0.3.16/go.mod h1:/qNL9xxDhc7tx3HSRsLWNnuzbVfh3e7gh/BmM179nYI=
github.com/tklauser/numcpus v0.11.0 h1:nSTwhKH5e1dMNsCdVBukSZrURJRoHbSEQjdEbY+9RXw=
github.com/tklauser/numcpus v0.11.0/go.mod h1:z+LwcLq54uWZTX0u/bGobaV34u6V7KNlTZejzM6/3MQ=
github.com/u-root/gobusybox/src v0.0.0-20231228173702-b69f654846aa h1:unMPGGK/CRzfg923allsikmvk2l7beBeFPUNC4RVX/8=
github.com/u-root/gobusybox/src v0.0.0-20231228173702-b69f654846aa/go.mod h1:Zj4Tt22fJVn/nz/y6Ergm1SahR9dio1Zm/D2/S0TmXM=
github.com/u-root/u-root v0.12.1-0.20240114161452-ab3534910ced h1:G0F7Hmwph1OjozbAUBLKJ94CmY1OlH1cGMydXgB24j0=

View File

@@ -286,7 +286,7 @@ func RegisterFunc(fptr any, cfn uintptr) {
for j, val := range args[i:] {
if val.Kind() == reflect.String {
ptr := strings.CString(v.String())
ptr := strings.CString(val.String())
keepAlive = append(keepAlive, ptr)
val = reflect.ValueOf(ptr)
args[i+j] = val

View File

@@ -165,7 +165,7 @@ func tryPlaceRegister(v reflect.Value, addFloat func(uintptr), addInt func(uintp
place(f)
case reflect.Bool:
if f.Bool() {
val |= 1
val |= 1 << shift
}
shift += 8
class |= _INTEGER

View File

@@ -117,13 +117,15 @@ func placeRegisters(v reflect.Value, addFloat func(uintptr), addInt func(uintptr
} else {
addInt(uintptr(val))
}
val = 0
class = _NO_CLASS
}
switch f.Type().Kind() {
case reflect.Struct:
place(f)
case reflect.Bool:
if f.Bool() {
val |= 1
val |= 1 << shift
}
shift += 8
class |= _INT

View File

@@ -104,7 +104,7 @@ func placeRegisters(v reflect.Value, addFloat func(uintptr), addInt func(uintptr
place(f)
case reflect.Bool:
if f.Bool() {
val |= 1
val |= 1 << shift
}
shift += 8
class |= _INT

View File

@@ -190,7 +190,7 @@ func InfoWithContext(ctx context.Context) ([]InfoStat, error) {
ppis, powerInformationErr := getProcessorPowerInformation(ctx)
if powerInformationErr != nil {
return ret, fmt.Errorf("failed to get processor power information: %w", err)
return ret, fmt.Errorf("failed to get processor power information: %w", powerInformationErr)
}
family, processorId, smBIOSErr := getSMBIOSProcessorInfo()

View File

@@ -5,6 +5,7 @@ import (
"context"
"encoding/json"
"errors"
"regexp"
"runtime"
"sort"
"sync"
@@ -18,6 +19,7 @@ import (
var (
invoke common.Invoker = common.Invoke{}
strictIntPtrn = regexp.MustCompile(`^\d+$`)
ErrorNoChildren = errors.New("process does not have children") // Deprecated: ErrorNoChildren is never returned by process.Children(), check its returned []*Process slice length instead
ErrorProcessNotRunning = errors.New("process does not exist")
ErrorNotPermitted = errors.New("operation not permitted")

View File

@@ -1173,6 +1173,9 @@ func readPidsFromDir(path string) ([]int32, error) {
return nil, err
}
for _, fname := range fnames {
if !strictIntPtrn.MatchString(fname) {
continue
}
pid, err := strconv.ParseInt(fname, 10, 32)
if err != nil {
// if not numeric name, just skip

View File

@@ -289,6 +289,9 @@ func readPidsFromDir(path string) ([]int32, error) {
return nil, err
}
for _, fname := range fnames {
if !strictIntPtrn.MatchString(fname) {
continue
}
pid, err := strconv.ParseInt(fname, 10, 32)
if err != nil {
// if not numeric name, just skip

View File

@@ -699,6 +699,7 @@ func (p *Process) OpenFilesWithContext(ctx context.Context) ([]OpenFilesStat, er
if err != nil {
return nil, err
}
defer windows.CloseHandle(process)
buffer := make([]byte, 1024)
var size uint32

View File

@@ -1,6 +1,6 @@
env:
CIRRUS_CLONE_DEPTH: 1
GO_VERSION: go1.24.0
GO_VERSION: go1.25.0
freebsd_13_task:
freebsd_instance:

View File

@@ -25,10 +25,13 @@ const (
_POSIX2_UPE = -1
)
var clktck struct {
sync.Once
v int64
}
var clktck = sync.OnceValue(func() int64 {
ci, err := unix.SysctlClockinfo("kern.clockrate")
if err != nil {
return -1
}
return int64(ci.Hz)
})
func sysconfPOSIX(name int) (int64, error) {
// NetBSD does not define all _POSIX_* values used in sysconf_posix.go
@@ -54,14 +57,7 @@ func sysconf(name int) (int64, error) {
}
return -1, nil
case SC_CLK_TCK:
// TODO: use sync.OnceValue once Go 1.21 is the minimal supported version
clktck.Do(func() {
clktck.v = -1
if ci, err := unix.SysctlClockinfo("kern.clockrate"); err == nil {
clktck.v = int64(ci.Hz)
}
})
return clktck.v, nil
return clktck(), nil
case SC_NGROUPS_MAX:
return sysctl32("kern.ngroups"), nil
case SC_JOB_CONTROL:

View File

@@ -1,6 +1,6 @@
env:
CIRRUS_CLONE_DEPTH: 1
GO_VERSION: go1.24.0
GO_VERSION: go1.25.0
freebsd_13_task:
freebsd_instance:

View File

@@ -47,10 +47,12 @@ func readCPURangeWith[T any](file string, f func(cpus string) (T, error)) (T, er
if err != nil {
return zero, err
}
return f(strings.Trim(string(buf), "\n "))
return f(string(buf))
}
func countCPURange(cpus string) (int, error) {
cpus = strings.Trim(cpus, "\n ")
// Treat empty file as valid. This might be the case if there are no offline CPUs in which
// case /sys/devices/system/cpu/offline is empty.
if cpus == "" {
@@ -58,7 +60,7 @@ func countCPURange(cpus string) (int, error) {
}
n := int(0)
for _, cpuRange := range strings.Split(cpus, ",") {
for cpuRange := range strings.SplitSeq(cpus, ",") {
if cpuRange == "" {
return 0, fmt.Errorf("empty CPU range in CPU string %q", cpus)
}
@@ -84,13 +86,15 @@ func countCPURange(cpus string) (int, error) {
}
func listCPURange(cpus string) ([]int, error) {
cpus = strings.Trim(cpus, "\n ")
// See comment in countCPURange.
if cpus == "" {
return []int{}, nil
}
list := []int{}
for _, cpuRange := range strings.Split(cpus, ",") {
for cpuRange := range strings.SplitSeq(cpus, ",") {
if cpuRange == "" {
return nil, fmt.Errorf("empty CPU range in CPU string %q", cpus)
}

12
vendor/modules.txt vendored
View File

@@ -283,7 +283,7 @@ github.com/docker/go-plugins-helpers/volume
# github.com/docker/go-units v0.5.0
## explicit
github.com/docker/go-units
# github.com/ebitengine/purego v0.9.0
# github.com/ebitengine/purego v0.9.1
## explicit; go 1.18
github.com/ebitengine/purego
github.com/ebitengine/purego/internal/cgo
@@ -644,7 +644,7 @@ github.com/seccomp/libseccomp-golang
# github.com/secure-systems-lab/go-securesystemslib v0.9.1
## explicit; go 1.23.0
github.com/secure-systems-lab/go-securesystemslib/encrypted
# github.com/shirou/gopsutil/v4 v4.25.10
# github.com/shirou/gopsutil/v4 v4.25.11
## explicit; go 1.24.0
github.com/shirou/gopsutil/v4/common
github.com/shirou/gopsutil/v4/cpu
@@ -698,11 +698,11 @@ github.com/sylabs/sif/v2/pkg/sif
# github.com/tchap/go-patricia/v2 v2.3.3
## explicit; go 1.16
github.com/tchap/go-patricia/v2/patricia
# github.com/tklauser/go-sysconf v0.3.15
## explicit; go 1.23.0
# github.com/tklauser/go-sysconf v0.3.16
## explicit; go 1.24.0
github.com/tklauser/go-sysconf
# github.com/tklauser/numcpus v0.10.0
## explicit; go 1.23.0
# github.com/tklauser/numcpus v0.11.0
## explicit; go 1.24.0
github.com/tklauser/numcpus
# github.com/u-root/uio v0.0.0-20240224005618-d2acac8f3701
## explicit; go 1.21