diff --git a/src/go.mod b/src/go.mod
index 98709eed..ecc7b6ed 100644
--- a/src/go.mod
+++ b/src/go.mod
@@ -13,12 +13,12 @@ require (
github.com/Benjamintf1/unmarshalledmatchers v0.0.0-20190408201839-bb1c1f34eaea
github.com/benbjohnson/jmphash v0.0.0-20141216154655-2d58f234cd86
github.com/cespare/xxhash v1.1.0 // indirect
- github.com/cloudfoundry/gosigar v1.3.82
+ github.com/cloudfoundry/gosigar v1.3.83
github.com/dvsekhvalnov/jose2go v1.8.0
github.com/emirpasic/gods v1.18.1
github.com/grpc-ecosystem/grpc-gateway/v2 v2.25.1
github.com/influxdata/go-syslog/v3 v3.0.1-0.20210608084020-ac565dc76ba6
- github.com/onsi/ginkgo/v2 v2.22.1
+ github.com/onsi/ginkgo/v2 v2.22.2
github.com/onsi/gomega v1.36.2
github.com/prometheus/client_golang v1.20.5
github.com/prometheus/client_model v0.6.1
@@ -34,7 +34,7 @@ require (
code.cloudfoundry.org/go-loggregator/v10 v10.0.1
github.com/cespare/xxhash/v2 v2.3.0
github.com/go-chi/chi/v5 v5.2.0
- github.com/shirou/gopsutil/v4 v4.24.11
+ github.com/shirou/gopsutil/v4 v4.24.12
)
require (
@@ -70,11 +70,11 @@ require (
go.step.sm/crypto v0.56.0 // indirect
golang.org/x/crypto v0.31.0 // indirect
golang.org/x/sync v0.10.0 // indirect
- golang.org/x/sys v0.28.0 // indirect
+ golang.org/x/sys v0.29.0 // indirect
golang.org/x/text v0.21.0 // indirect
golang.org/x/tools v0.28.0 // indirect
- google.golang.org/genproto/googleapis/api v0.0.0-20241223144023-3abc09e42ca8 // indirect
- google.golang.org/genproto/googleapis/rpc v0.0.0-20241223144023-3abc09e42ca8 // indirect
+ google.golang.org/genproto/googleapis/api v0.0.0-20250102185135-69823020774d // indirect
+ google.golang.org/genproto/googleapis/rpc v0.0.0-20250102185135-69823020774d // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
diff --git a/src/go.sum b/src/go.sum
index c9a836f8..9bef210d 100644
--- a/src/go.sum
+++ b/src/go.sum
@@ -72,8 +72,8 @@ github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XL
github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag=
github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
-github.com/cloudfoundry/gosigar v1.3.82 h1:d+6d6Kkc64dAu4G5eUR8UGxEir4RQLUiFrMsXoj4DcI=
-github.com/cloudfoundry/gosigar v1.3.82/go.mod h1:aN0In6DixDF1jvlKDZRx6oUrGNYLfIXCfm4wq9JGV+c=
+github.com/cloudfoundry/gosigar v1.3.83 h1:Q7M8b2NzenIVDyX8rP0X2b2aFkHx2MJgxT+zVqnhr3w=
+github.com/cloudfoundry/gosigar v1.3.83/go.mod h1:hVLu8UT3lk3LZ5j/B2IfNS/i+QAK54Pwl6jx+442S+c=
github.com/davecgh/go-spew v0.0.0-20151105211317-5215b55f46b2/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
@@ -331,8 +331,8 @@ github.com/onsi/ginkgo v0.0.0-20170829012221-11459a886d9c/go.mod h1:lLunBs/Ym6LB
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.8.0 h1:VkHVNpR4iVnU8XQR6DBm8BqYjN7CRzw+xKUbVVbbW9w=
github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
-github.com/onsi/ginkgo/v2 v2.22.1 h1:QW7tbJAUDyVDVOM5dFa7qaybo+CRfR7bemlQUN6Z8aM=
-github.com/onsi/ginkgo/v2 v2.22.1/go.mod h1:S6aTpoRsSq2cZOd+pssHAlKW/Q/jZt6cPrPlnj4a1xM=
+github.com/onsi/ginkgo/v2 v2.22.2 h1:/3X8Panh8/WwhU/3Ssa6rCKqPLuAkVY2I0RoyDLySlU=
+github.com/onsi/ginkgo/v2 v2.22.2/go.mod h1:oeMosUL+8LtarXBHu/c0bx2D/K9zyQ6uX3cTyztHwsk=
github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA=
github.com/onsi/gomega v0.0.0-20190113212917-5533ce8a0da3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
@@ -390,8 +390,8 @@ github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFo
github.com/samuel/go-zookeeper v0.0.0-20190810000440-0ceca61e4d75/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E=
github.com/satori/go.uuid v0.0.0-20160603004225-b111a074d5ef/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
-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/shurcooL/httpfs v0.0.0-20171119174359-809beceb2371/go.mod h1:ZY1cvUeJuFPAdZ/B6v7RHavJWZn2YPVFQ1OSXhCGOkg=
github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749/go.mod h1:ZY1cvUeJuFPAdZ/B6v7RHavJWZn2YPVFQ1OSXhCGOkg=
github.com/shurcooL/vfsgen v0.0.0-20180825020608-02ddb050ef6b/go.mod h1:TrYk7fJVaAttu97ZZKrO9UbRa8izdowaMIZcxYMbVaw=
@@ -531,8 +531,8 @@ golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20191010194322-b09406accb47/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
-golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA=
-golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
+golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU=
+golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.27.0 h1:WP60Sv1nlK1T6SupCHbXzSaN0b9wUmsPoRS9b61A23Q=
golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM=
golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
@@ -581,10 +581,10 @@ google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRn
google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
google.golang.org/genproto v0.0.0-20190716160619-c506a9f90610/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
-google.golang.org/genproto/googleapis/api v0.0.0-20241223144023-3abc09e42ca8 h1:st3LcW/BPi75W4q1jJTEor/QWwbNlPlDG0JTn6XhZu0=
-google.golang.org/genproto/googleapis/api v0.0.0-20241223144023-3abc09e42ca8/go.mod h1:klhJGKFyG8Tn50enBn7gizg4nXGXJ+jqEREdCWaPcV4=
-google.golang.org/genproto/googleapis/rpc v0.0.0-20241223144023-3abc09e42ca8 h1:TqExAhdPaB60Ux47Cn0oLV07rGnxZzIsaRhQaqS666A=
-google.golang.org/genproto/googleapis/rpc v0.0.0-20241223144023-3abc09e42ca8/go.mod h1:lcTa1sDdWEIHMWlITnIczmw5w60CF9ffkb8Z+DVmmjA=
+google.golang.org/genproto/googleapis/api v0.0.0-20250102185135-69823020774d h1:H8tOf8XM88HvKqLTxe755haY6r1fqqzLbEnfrmLXlSA=
+google.golang.org/genproto/googleapis/api v0.0.0-20250102185135-69823020774d/go.mod h1:2v7Z7gP2ZUOGsaFyxATQSRoBnKygqVq2Cwnvom7QiqY=
+google.golang.org/genproto/googleapis/rpc v0.0.0-20250102185135-69823020774d h1:xJJRGY7TJcvIlpSrN3K6LAWgNFUILlO+OMAqtg9aqnw=
+google.golang.org/genproto/googleapis/rpc v0.0.0-20250102185135-69823020774d/go.mod h1:3ENsm/5D1mzDyhpzeRi1NR784I0BcofWBoSc5QqqMK4=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
diff --git a/src/vendor/github.com/onsi/ginkgo/v2/CHANGELOG.md b/src/vendor/github.com/onsi/ginkgo/v2/CHANGELOG.md
index 0c29708d..f9d52e58 100644
--- a/src/vendor/github.com/onsi/ginkgo/v2/CHANGELOG.md
+++ b/src/vendor/github.com/onsi/ginkgo/v2/CHANGELOG.md
@@ -1,3 +1,10 @@
+## 2.22.2
+
+### Maintenance
+- Bump github.com/onsi/gomega from 1.36.1 to 1.36.2 (#1499) [cc553ce]
+- Bump golang.org/x/crypto (#1498) [2170370]
+- Bump golang.org/x/net from 0.32.0 to 0.33.0 (#1496) [a96c44f]
+
## 2.22.1
### Fixes
@@ -1035,7 +1042,7 @@ New Features:
- `ginkgo -tags=TAG_LIST` passes a list of tags down to the `go build` command.
- `ginkgo --failFast` aborts the test suite after the first failure.
- `ginkgo generate file_1 file_2` can take multiple file arguments.
-- Ginkgo now summarizes any spec failures that occurred at the end of the test run.
+- Ginkgo now summarizes any spec failures that occurred at the end of the test run.
- `ginkgo --randomizeSuites` will run tests *suites* in random order using the generated/passed-in seed.
Improvements:
@@ -1069,7 +1076,7 @@ Bug Fixes:
Breaking changes:
- `thirdparty/gomocktestreporter` is gone. Use `GinkgoT()` instead
-- Modified the Reporter interface
+- Modified the Reporter interface
- `watch` is now a subcommand, not a flag.
DSL changes:
diff --git a/src/vendor/github.com/onsi/ginkgo/v2/types/version.go b/src/vendor/github.com/onsi/ginkgo/v2/types/version.go
index 501af2fd..879e1d86 100644
--- a/src/vendor/github.com/onsi/ginkgo/v2/types/version.go
+++ b/src/vendor/github.com/onsi/ginkgo/v2/types/version.go
@@ -1,3 +1,3 @@
package types
-const VERSION = "2.22.1"
+const VERSION = "2.22.2"
diff --git a/src/vendor/github.com/shirou/gopsutil/v4/cpu/cpu.go b/src/vendor/github.com/shirou/gopsutil/v4/cpu/cpu.go
index 56f53c3a..9bc3dfb5 100644
--- a/src/vendor/github.com/shirou/gopsutil/v4/cpu/cpu.go
+++ b/src/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/src/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_darwin_arm64.go b/src/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_darwin_arm64.go
index 50318424..09427003 100644
--- a/src/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_darwin_arm64.go
+++ b/src/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/src/vendor/github.com/shirou/gopsutil/v4/internal/common/common_darwin.go b/src/vendor/github.com/shirou/gopsutil/v4/internal/common/common_darwin.go
index b473f886..2de3bb14 100644
--- a/src/vendor/github.com/shirou/gopsutil/v4/internal/common/common_darwin.go
+++ b/src/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/src/vendor/github.com/shirou/gopsutil/v4/internal/common/common_linux.go b/src/vendor/github.com/shirou/gopsutil/v4/internal/common/common_linux.go
index 541de93d..277034f3 100644
--- a/src/vendor/github.com/shirou/gopsutil/v4/internal/common/common_linux.go
+++ b/src/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/src/vendor/github.com/shirou/gopsutil/v4/net/net.go b/src/vendor/github.com/shirou/gopsutil/v4/net/net.go
index 3890eda5..74af54a4 100644
--- a/src/vendor/github.com/shirou/gopsutil/v4/net/net.go
+++ b/src/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/src/vendor/github.com/shirou/gopsutil/v4/net/net_aix.go b/src/vendor/github.com/shirou/gopsutil/v4/net/net_aix.go
index 08a100d8..9df01e31 100644
--- a/src/vendor/github.com/shirou/gopsutil/v4/net/net_aix.go
+++ b/src/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/src/vendor/github.com/shirou/gopsutil/v4/net/net_darwin.go b/src/vendor/github.com/shirou/gopsutil/v4/net/net_darwin.go
index 8f3f4d38..86c541e9 100644
--- a/src/vendor/github.com/shirou/gopsutil/v4/net/net_darwin.go
+++ b/src/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/src/vendor/github.com/shirou/gopsutil/v4/net/net_fallback.go b/src/vendor/github.com/shirou/gopsutil/v4/net/net_fallback.go
index a765e216..7d7596a8 100644
--- a/src/vendor/github.com/shirou/gopsutil/v4/net/net_fallback.go
+++ b/src/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/src/vendor/github.com/shirou/gopsutil/v4/net/net_freebsd.go b/src/vendor/github.com/shirou/gopsutil/v4/net/net_freebsd.go
index ccaab73e..655e1337 100644
--- a/src/vendor/github.com/shirou/gopsutil/v4/net/net_freebsd.go
+++ b/src/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/src/vendor/github.com/shirou/gopsutil/v4/net/net_linux.go b/src/vendor/github.com/shirou/gopsutil/v4/net/net_linux.go
index 2c79facb..23113fea 100644
--- a/src/vendor/github.com/shirou/gopsutil/v4/net/net_linux.go
+++ b/src/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/src/vendor/github.com/shirou/gopsutil/v4/net/net_openbsd.go b/src/vendor/github.com/shirou/gopsutil/v4/net/net_openbsd.go
index 7fae18b9..a90d5904 100644
--- a/src/vendor/github.com/shirou/gopsutil/v4/net/net_openbsd.go
+++ b/src/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/src/vendor/github.com/shirou/gopsutil/v4/net/net_solaris.go b/src/vendor/github.com/shirou/gopsutil/v4/net/net_solaris.go
index b886066e..83eb1d0f 100644
--- a/src/vendor/github.com/shirou/gopsutil/v4/net/net_solaris.go
+++ b/src/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/src/vendor/github.com/shirou/gopsutil/v4/net/net_unix.go b/src/vendor/github.com/shirou/gopsutil/v4/net/net_unix.go
index 62f8907a..6eb7e2fc 100644
--- a/src/vendor/github.com/shirou/gopsutil/v4/net/net_unix.go
+++ b/src/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/src/vendor/github.com/shirou/gopsutil/v4/net/net_windows.go b/src/vendor/github.com/shirou/gopsutil/v4/net/net_windows.go
index f1145fea..00ebf89e 100644
--- a/src/vendor/github.com/shirou/gopsutil/v4/net/net_windows.go
+++ b/src/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/src/vendor/github.com/shirou/gopsutil/v4/process/process_darwin.go b/src/vendor/github.com/shirou/gopsutil/v4/process/process_darwin.go
index 05c7562b..33abc10a 100644
--- a/src/vendor/github.com/shirou/gopsutil/v4/process/process_darwin.go
+++ b/src/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/src/vendor/github.com/shirou/gopsutil/v4/process/process_freebsd.go b/src/vendor/github.com/shirou/gopsutil/v4/process/process_freebsd.go
index 76373736..a67ac0ef 100644
--- a/src/vendor/github.com/shirou/gopsutil/v4/process/process_freebsd.go
+++ b/src/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/src/vendor/github.com/shirou/gopsutil/v4/process/process_freebsd_386.go b/src/vendor/github.com/shirou/gopsutil/v4/process/process_freebsd_386.go
index 279ba9fb..0193ba25 100644
--- a/src/vendor/github.com/shirou/gopsutil/v4/process/process_freebsd_386.go
+++ b/src/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/src/vendor/github.com/shirou/gopsutil/v4/process/process_freebsd_amd64.go b/src/vendor/github.com/shirou/gopsutil/v4/process/process_freebsd_amd64.go
index f3b70ec1..67970f64 100644
--- a/src/vendor/github.com/shirou/gopsutil/v4/process/process_freebsd_amd64.go
+++ b/src/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/src/vendor/github.com/shirou/gopsutil/v4/process/process_freebsd_arm.go b/src/vendor/github.com/shirou/gopsutil/v4/process/process_freebsd_arm.go
index 75ed3063..6c4fbf69 100644
--- a/src/vendor/github.com/shirou/gopsutil/v4/process/process_freebsd_arm.go
+++ b/src/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/src/vendor/github.com/shirou/gopsutil/v4/process/process_freebsd_arm64.go b/src/vendor/github.com/shirou/gopsutil/v4/process/process_freebsd_arm64.go
index 3dc301c0..dabdc3e3 100644
--- a/src/vendor/github.com/shirou/gopsutil/v4/process/process_freebsd_arm64.go
+++ b/src/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/src/vendor/github.com/shirou/gopsutil/v4/process/process_posix.go b/src/vendor/github.com/shirou/gopsutil/v4/process/process_posix.go
index caa9d3f7..96c5e065 100644
--- a/src/vendor/github.com/shirou/gopsutil/v4/process/process_posix.go
+++ b/src/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/src/vendor/github.com/shirou/gopsutil/v4/process/process_windows.go b/src/vendor/github.com/shirou/gopsutil/v4/process/process_windows.go
index b00c671e..012886d6 100644
--- a/src/vendor/github.com/shirou/gopsutil/v4/process/process_windows.go
+++ b/src/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/src/vendor/golang.org/x/sys/unix/syscall_dragonfly.go b/src/vendor/golang.org/x/sys/unix/syscall_dragonfly.go
index 97cb916f..be8c0020 100644
--- a/src/vendor/golang.org/x/sys/unix/syscall_dragonfly.go
+++ b/src/vendor/golang.org/x/sys/unix/syscall_dragonfly.go
@@ -246,6 +246,18 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
return sendfile(outfd, infd, offset, count)
}
+func Dup3(oldfd, newfd, flags int) error {
+ if oldfd == newfd || flags&^O_CLOEXEC != 0 {
+ return EINVAL
+ }
+ how := F_DUP2FD
+ if flags&O_CLOEXEC != 0 {
+ how = F_DUP2FD_CLOEXEC
+ }
+ _, err := fcntl(oldfd, how, newfd)
+ return err
+}
+
/*
* Exposed directly
*/
diff --git a/src/vendor/golang.org/x/sys/windows/dll_windows.go b/src/vendor/golang.org/x/sys/windows/dll_windows.go
index 4e613cf6..3ca814f5 100644
--- a/src/vendor/golang.org/x/sys/windows/dll_windows.go
+++ b/src/vendor/golang.org/x/sys/windows/dll_windows.go
@@ -43,8 +43,8 @@ type DLL struct {
// LoadDLL loads DLL file into memory.
//
// Warning: using LoadDLL without an absolute path name is subject to
-// DLL preloading attacks. To safely load a system DLL, use LazyDLL
-// with System set to true, or use LoadLibraryEx directly.
+// DLL preloading attacks. To safely load a system DLL, use [NewLazySystemDLL],
+// or use [LoadLibraryEx] directly.
func LoadDLL(name string) (dll *DLL, err error) {
namep, err := UTF16PtrFromString(name)
if err != nil {
@@ -271,6 +271,9 @@ func (d *LazyDLL) NewProc(name string) *LazyProc {
}
// NewLazyDLL creates new LazyDLL associated with DLL file.
+//
+// Warning: using NewLazyDLL without an absolute path name is subject to
+// DLL preloading attacks. To safely load a system DLL, use [NewLazySystemDLL].
func NewLazyDLL(name string) *LazyDLL {
return &LazyDLL{Name: name}
}
@@ -410,7 +413,3 @@ func loadLibraryEx(name string, system bool) (*DLL, error) {
}
return &DLL{Name: name, Handle: h}, nil
}
-
-type errString string
-
-func (s errString) Error() string { return string(s) }
diff --git a/src/vendor/modules.txt b/src/vendor/modules.txt
index 021c9214..e172541b 100644
--- a/src/vendor/modules.txt
+++ b/src/vendor/modules.txt
@@ -53,7 +53,7 @@ github.com/cespare/xxhash
# github.com/cespare/xxhash/v2 v2.3.0
## explicit; go 1.11
github.com/cespare/xxhash/v2
-# github.com/cloudfoundry/gosigar v1.3.82
+# github.com/cloudfoundry/gosigar v1.3.83
## explicit; go 1.22.0
github.com/cloudfoundry/gosigar
github.com/cloudfoundry/gosigar/sys/windows
@@ -149,7 +149,7 @@ github.com/munnerz/goautoneg
# github.com/oklog/ulid v1.3.1
## explicit
github.com/oklog/ulid
-# github.com/onsi/ginkgo/v2 v2.22.1
+# github.com/onsi/ginkgo/v2 v2.22.2
## explicit; go 1.22.0
github.com/onsi/ginkgo/v2
github.com/onsi/ginkgo/v2/config
@@ -240,7 +240,7 @@ github.com/prometheus/prometheus/util/stats
github.com/prometheus/prometheus/util/strutil
github.com/prometheus/prometheus/util/teststorage
github.com/prometheus/prometheus/util/testutil
-# 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
@@ -300,7 +300,7 @@ golang.org/x/net/trace
# golang.org/x/sync v0.10.0
## explicit; go 1.18
golang.org/x/sync/errgroup
-# golang.org/x/sys v0.28.0
+# golang.org/x/sys v0.29.0
## explicit; go 1.18
golang.org/x/sys/cpu
golang.org/x/sys/unix
@@ -331,13 +331,13 @@ golang.org/x/text/unicode/norm
## explicit; go 1.22.0
golang.org/x/tools/cover
golang.org/x/tools/go/ast/inspector
-# google.golang.org/genproto/googleapis/api v0.0.0-20241223144023-3abc09e42ca8
-## explicit; go 1.21
+# google.golang.org/genproto/googleapis/api v0.0.0-20250102185135-69823020774d
+## explicit; go 1.22
google.golang.org/genproto/googleapis/api
google.golang.org/genproto/googleapis/api/annotations
google.golang.org/genproto/googleapis/api/httpbody
-# google.golang.org/genproto/googleapis/rpc v0.0.0-20241223144023-3abc09e42ca8
-## explicit; go 1.21
+# google.golang.org/genproto/googleapis/rpc v0.0.0-20250102185135-69823020774d
+## explicit; go 1.22
google.golang.org/genproto/googleapis/rpc/status
# google.golang.org/grpc v1.69.2
## explicit; go 1.22