summaryrefslogtreecommitdiff
path: root/vendor/github.com/tklauser
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/tklauser')
-rw-r--r--vendor/github.com/tklauser/go-sysconf/.cirrus.yml10
-rw-r--r--vendor/github.com/tklauser/go-sysconf/sysconf_bsd.go1
-rw-r--r--vendor/github.com/tklauser/go-sysconf/sysconf_darwin.go37
-rw-r--r--vendor/github.com/tklauser/go-sysconf/sysconf_generic.go1
-rw-r--r--vendor/github.com/tklauser/go-sysconf/sysconf_linux.go20
-rw-r--r--vendor/github.com/tklauser/go-sysconf/sysconf_netbsd.go18
-rw-r--r--vendor/github.com/tklauser/go-sysconf/sysconf_posix.go1
-rw-r--r--vendor/github.com/tklauser/go-sysconf/sysconf_unsupported.go1
-rw-r--r--vendor/github.com/tklauser/go-sysconf/zsysconf_defs_darwin.go2
-rw-r--r--vendor/github.com/tklauser/go-sysconf/zsysconf_defs_dragonfly.go1
-rw-r--r--vendor/github.com/tklauser/go-sysconf/zsysconf_defs_freebsd.go1
-rw-r--r--vendor/github.com/tklauser/go-sysconf/zsysconf_defs_linux.go1
-rw-r--r--vendor/github.com/tklauser/go-sysconf/zsysconf_defs_netbsd.go1
-rw-r--r--vendor/github.com/tklauser/go-sysconf/zsysconf_defs_openbsd.go1
-rw-r--r--vendor/github.com/tklauser/go-sysconf/zsysconf_defs_solaris.go1
-rw-r--r--vendor/github.com/tklauser/go-sysconf/zsysconf_values_freebsd_386.go1
-rw-r--r--vendor/github.com/tklauser/go-sysconf/zsysconf_values_freebsd_amd64.go1
-rw-r--r--vendor/github.com/tklauser/go-sysconf/zsysconf_values_freebsd_arm.go1
-rw-r--r--vendor/github.com/tklauser/go-sysconf/zsysconf_values_freebsd_arm64.go1
-rw-r--r--vendor/github.com/tklauser/go-sysconf/zsysconf_values_freebsd_riscv64.go1
-rw-r--r--vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_386.go1
-rw-r--r--vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_amd64.go1
-rw-r--r--vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_arm.go1
-rw-r--r--vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_arm64.go1
-rw-r--r--vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_loong64.go1
-rw-r--r--vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_mips.go1
-rw-r--r--vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_mips64.go1
-rw-r--r--vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_mips64le.go1
-rw-r--r--vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_mipsle.go1
-rw-r--r--vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_ppc64.go1
-rw-r--r--vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_ppc64le.go1
-rw-r--r--vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_riscv64.go1
-rw-r--r--vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_s390x.go1
-rw-r--r--vendor/github.com/tklauser/go-sysconf/zsysconf_values_netbsd_386.go1
-rw-r--r--vendor/github.com/tklauser/go-sysconf/zsysconf_values_netbsd_amd64.go1
-rw-r--r--vendor/github.com/tklauser/go-sysconf/zsysconf_values_netbsd_arm.go1
-rw-r--r--vendor/github.com/tklauser/go-sysconf/zsysconf_values_netbsd_arm64.go1
-rw-r--r--vendor/github.com/tklauser/numcpus/.cirrus.yml20
-rw-r--r--vendor/github.com/tklauser/numcpus/numcpus.go23
-rw-r--r--vendor/github.com/tklauser/numcpus/numcpus_bsd.go1
-rw-r--r--vendor/github.com/tklauser/numcpus/numcpus_linux.go104
-rw-r--r--vendor/github.com/tklauser/numcpus/numcpus_list_unsupported.go33
-rw-r--r--vendor/github.com/tklauser/numcpus/numcpus_solaris.go1
-rw-r--r--vendor/github.com/tklauser/numcpus/numcpus_unsupported.go1
44 files changed, 209 insertions, 93 deletions
diff --git a/vendor/github.com/tklauser/go-sysconf/.cirrus.yml b/vendor/github.com/tklauser/go-sysconf/.cirrus.yml
index 1b27f19..495e5e6 100644
--- a/vendor/github.com/tklauser/go-sysconf/.cirrus.yml
+++ b/vendor/github.com/tklauser/go-sysconf/.cirrus.yml
@@ -1,10 +1,10 @@
env:
CIRRUS_CLONE_DEPTH: 1
- GO_VERSION: go1.20
+ GO_VERSION: go1.24.0
-freebsd_12_task:
+freebsd_13_task:
freebsd_instance:
- image_family: freebsd-12-3
+ image_family: freebsd-13-5
install_script: |
pkg install -y go
GOBIN=$PWD/bin go install golang.org/dl/${GO_VERSION}@latest
@@ -12,9 +12,9 @@ freebsd_12_task:
build_script: bin/${GO_VERSION} build -v ./...
test_script: bin/${GO_VERSION} test -race ./...
-freebsd_13_task:
+freebsd_14_task:
freebsd_instance:
- image_family: freebsd-13-0
+ image_family: freebsd-14-2
install_script: |
pkg install -y go
GOBIN=$PWD/bin go install golang.org/dl/${GO_VERSION}@latest
diff --git a/vendor/github.com/tklauser/go-sysconf/sysconf_bsd.go b/vendor/github.com/tklauser/go-sysconf/sysconf_bsd.go
index 7c96157..ec81c02 100644
--- a/vendor/github.com/tklauser/go-sysconf/sysconf_bsd.go
+++ b/vendor/github.com/tklauser/go-sysconf/sysconf_bsd.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build darwin || dragonfly || freebsd || netbsd || openbsd
-// +build darwin dragonfly freebsd netbsd openbsd
package sysconf
diff --git a/vendor/github.com/tklauser/go-sysconf/sysconf_darwin.go b/vendor/github.com/tklauser/go-sysconf/sysconf_darwin.go
index 3f5d83f..b471ec1 100644
--- a/vendor/github.com/tklauser/go-sysconf/sysconf_darwin.go
+++ b/vendor/github.com/tklauser/go-sysconf/sysconf_darwin.go
@@ -16,6 +16,10 @@ const (
_HOST_NAME_MAX = _MAXHOSTNAMELEN - 1
_LOGIN_NAME_MAX = _MAXLOGNAME
_SYMLOOP_MAX = _MAXSYMLINKS
+
+ // _PTHREAD_STACK_MIN changed in macOS 14
+ _PTHREAD_STACK_MIN_LT_MACOS14 = 0x2000
+ _PTHREAD_STACK_MIN_GE_MACOS14 = 0x4000
)
var uname struct {
@@ -23,6 +27,21 @@ var uname struct {
macOSMajor int
}
+func getMacOSMajor() int {
+ uname.Once.Do(func() {
+ var u unix.Utsname
+ err := unix.Uname(&u)
+ if err != nil {
+ return
+ }
+ rel := unix.ByteSliceToString(u.Release[:])
+ ver := strings.Split(rel, ".")
+ maj, _ := strconv.Atoi(ver[0])
+ uname.macOSMajor = maj
+ })
+ return uname.macOSMajor
+}
+
// sysconf implements sysconf(4) as in the Darwin libc (derived from the FreeBSD
// libc), version 1534.81.1.
// See https://github.com/apple-oss-distributions/Libc/tree/Libc-1534.81.1.
@@ -91,7 +110,10 @@ func sysconf(name int) (int64, error) {
case SC_THREAD_PRIO_PROTECT:
return _POSIX_THREAD_PRIO_PROTECT, nil
case SC_THREAD_STACK_MIN:
- return _PTHREAD_STACK_MIN, nil
+ if getMacOSMajor() < 23 {
+ return _PTHREAD_STACK_MIN_LT_MACOS14, nil
+ }
+ return _PTHREAD_STACK_MIN_GE_MACOS14, nil
case SC_THREAD_THREADS_MAX:
return -1, nil
case SC_TIMER_MAX:
@@ -140,18 +162,7 @@ func sysconf(name int) (int64, error) {
}
return _POSIX_SEMAPHORES, nil
case SC_SPAWN:
- uname.Once.Do(func() {
- var u unix.Utsname
- err := unix.Uname(&u)
- if err != nil {
- return
- }
- rel := unix.ByteSliceToString(u.Release[:])
- ver := strings.Split(rel, ".")
- maj, _ := strconv.Atoi(ver[0])
- uname.macOSMajor = maj
- })
- if uname.macOSMajor < 22 {
+ if getMacOSMajor() < 22 {
return -1, nil
}
// macOS 13 (Ventura) and later
diff --git a/vendor/github.com/tklauser/go-sysconf/sysconf_generic.go b/vendor/github.com/tklauser/go-sysconf/sysconf_generic.go
index 248bdc9..7dcc6f4 100644
--- a/vendor/github.com/tklauser/go-sysconf/sysconf_generic.go
+++ b/vendor/github.com/tklauser/go-sysconf/sysconf_generic.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build darwin || dragonfly || freebsd || linux || netbsd || openbsd
-// +build darwin dragonfly freebsd linux netbsd openbsd
package sysconf
diff --git a/vendor/github.com/tklauser/go-sysconf/sysconf_linux.go b/vendor/github.com/tklauser/go-sysconf/sysconf_linux.go
index 5fb49ac..9af7007 100644
--- a/vendor/github.com/tklauser/go-sysconf/sysconf_linux.go
+++ b/vendor/github.com/tklauser/go-sysconf/sysconf_linux.go
@@ -6,7 +6,6 @@ package sysconf
import (
"bufio"
- "io/ioutil"
"os"
"runtime"
"strconv"
@@ -26,7 +25,7 @@ const (
)
func readProcFsInt64(path string, fallback int64) int64 {
- data, err := ioutil.ReadFile(path)
+ data, err := os.ReadFile(path)
if err != nil {
return fallback
}
@@ -86,10 +85,16 @@ func getNprocsProcStat() (int64, error) {
s := bufio.NewScanner(f)
for s.Scan() {
if line := strings.TrimSpace(s.Text()); strings.HasPrefix(line, "cpu") {
- l := strings.SplitN(line, " ", 2)
- _, err := strconv.ParseInt(l[0][3:], 10, 64)
- if err == nil {
- count++
+ cpu, _, found := strings.Cut(line, " ")
+ if found {
+ // skip first line with accumulated values
+ if cpu == "cpu" {
+ continue
+ }
+ _, err := strconv.ParseInt(cpu[len("cpu"):], 10, 64)
+ if err == nil {
+ count++
+ }
}
} else {
// The current format of /proc/stat has all the
@@ -98,6 +103,9 @@ func getNprocsProcStat() (int64, error) {
break
}
}
+ if err := s.Err(); err != nil {
+ return -1, err
+ }
return count, nil
}
diff --git a/vendor/github.com/tklauser/go-sysconf/sysconf_netbsd.go b/vendor/github.com/tklauser/go-sysconf/sysconf_netbsd.go
index 325d4a6..40f6c34 100644
--- a/vendor/github.com/tklauser/go-sysconf/sysconf_netbsd.go
+++ b/vendor/github.com/tklauser/go-sysconf/sysconf_netbsd.go
@@ -25,10 +25,10 @@ const (
_POSIX2_UPE = -1
)
-var (
- clktck int64
- clktckOnce sync.Once
-)
+var clktck struct {
+ sync.Once
+ v int64
+}
func sysconfPOSIX(name int) (int64, error) {
// NetBSD does not define all _POSIX_* values used in sysconf_posix.go
@@ -42,7 +42,6 @@ func sysconf(name int) (int64, error) {
// Duplicate the relevant values here.
switch name {
-
// 1003.1
case SC_ARG_MAX:
return sysctl32("kern.argmax"), nil
@@ -55,13 +54,14 @@ func sysconf(name int) (int64, error) {
}
return -1, nil
case SC_CLK_TCK:
- clktckOnce.Do(func() {
- clktck = -1
+ // 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 = int64(ci.Hz)
+ clktck.v = int64(ci.Hz)
}
})
- return clktck, nil
+ return clktck.v, nil
case SC_NGROUPS_MAX:
return sysctl32("kern.ngroups"), nil
case SC_JOB_CONTROL:
diff --git a/vendor/github.com/tklauser/go-sysconf/sysconf_posix.go b/vendor/github.com/tklauser/go-sysconf/sysconf_posix.go
index e61c0bc..830d822 100644
--- a/vendor/github.com/tklauser/go-sysconf/sysconf_posix.go
+++ b/vendor/github.com/tklauser/go-sysconf/sysconf_posix.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build darwin || dragonfly || freebsd || linux || openbsd
-// +build darwin dragonfly freebsd linux openbsd
package sysconf
diff --git a/vendor/github.com/tklauser/go-sysconf/sysconf_unsupported.go b/vendor/github.com/tklauser/go-sysconf/sysconf_unsupported.go
index 478d692..5aa9119 100644
--- a/vendor/github.com/tklauser/go-sysconf/sysconf_unsupported.go
+++ b/vendor/github.com/tklauser/go-sysconf/sysconf_unsupported.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !solaris
-// +build !darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris
package sysconf
diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_defs_darwin.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_defs_darwin.go
index 6fadf3d..80b6439 100644
--- a/vendor/github.com/tklauser/go-sysconf/zsysconf_defs_darwin.go
+++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_defs_darwin.go
@@ -2,7 +2,6 @@
// cgo -godefs sysconf_defs_darwin.go
//go:build darwin
-// +build darwin
package sysconf
@@ -235,7 +234,6 @@ const (
_PTHREAD_DESTRUCTOR_ITERATIONS = 0x4
_PTHREAD_KEYS_MAX = 0x200
- _PTHREAD_STACK_MIN = 0x2000
)
const (
diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_defs_dragonfly.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_defs_dragonfly.go
index 0864cd4..dae5657 100644
--- a/vendor/github.com/tklauser/go-sysconf/zsysconf_defs_dragonfly.go
+++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_defs_dragonfly.go
@@ -2,7 +2,6 @@
// cgo -godefs sysconf_defs_dragonfly.go
//go:build dragonfly
-// +build dragonfly
package sysconf
diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_defs_freebsd.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_defs_freebsd.go
index 9885411..068f8a7 100644
--- a/vendor/github.com/tklauser/go-sysconf/zsysconf_defs_freebsd.go
+++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_defs_freebsd.go
@@ -2,7 +2,6 @@
// cgo -godefs sysconf_defs_freebsd.go
//go:build freebsd
-// +build freebsd
package sysconf
diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_defs_linux.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_defs_linux.go
index 8545a34..12f289d 100644
--- a/vendor/github.com/tklauser/go-sysconf/zsysconf_defs_linux.go
+++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_defs_linux.go
@@ -2,7 +2,6 @@
// cgo -godefs sysconf_defs_linux.go
//go:build linux
-// +build linux
package sysconf
diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_defs_netbsd.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_defs_netbsd.go
index d2aaf07..772af47 100644
--- a/vendor/github.com/tklauser/go-sysconf/zsysconf_defs_netbsd.go
+++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_defs_netbsd.go
@@ -2,7 +2,6 @@
// cgo -godefs sysconf_defs_netbsd.go
//go:build netbsd
-// +build netbsd
package sysconf
diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_defs_openbsd.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_defs_openbsd.go
index badc66c..625b098 100644
--- a/vendor/github.com/tklauser/go-sysconf/zsysconf_defs_openbsd.go
+++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_defs_openbsd.go
@@ -2,7 +2,6 @@
// cgo -godefs sysconf_defs_openbsd.go
//go:build openbsd
-// +build openbsd
package sysconf
diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_defs_solaris.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_defs_solaris.go
index 29b6f87..c155cf5 100644
--- a/vendor/github.com/tklauser/go-sysconf/zsysconf_defs_solaris.go
+++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_defs_solaris.go
@@ -2,7 +2,6 @@
// cgo -godefs sysconf_defs_solaris.go
//go:build solaris
-// +build solaris
package sysconf
diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_freebsd_386.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_freebsd_386.go
index 478fe63..b5d4807 100644
--- a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_freebsd_386.go
+++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_freebsd_386.go
@@ -2,7 +2,6 @@
// cgo -godefs sysconf_values_freebsd.go
//go:build freebsd && 386
-// +build freebsd,386
package sysconf
diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_freebsd_amd64.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_freebsd_amd64.go
index 7f58a4d..89c880a 100644
--- a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_freebsd_amd64.go
+++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_freebsd_amd64.go
@@ -2,7 +2,6 @@
// cgo -godefs sysconf_values_freebsd.go
//go:build freebsd && amd64
-// +build freebsd,amd64
package sysconf
diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_freebsd_arm.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_freebsd_arm.go
index deb4759..7b65fdd 100644
--- a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_freebsd_arm.go
+++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_freebsd_arm.go
@@ -2,7 +2,6 @@
// cgo -godefs sysconf_values_freebsd.go
//go:build freebsd && arm
-// +build freebsd,arm
package sysconf
diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_freebsd_arm64.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_freebsd_arm64.go
index 556ba3d..a86cb32 100644
--- a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_freebsd_arm64.go
+++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_freebsd_arm64.go
@@ -2,7 +2,6 @@
// cgo -godefs sysconf_values_freebsd.go
//go:build freebsd && arm64
-// +build freebsd,arm64
package sysconf
diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_freebsd_riscv64.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_freebsd_riscv64.go
index b7cff76..6c847ae 100644
--- a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_freebsd_riscv64.go
+++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_freebsd_riscv64.go
@@ -2,7 +2,6 @@
// cgo -godefs sysconf_values_freebsd.go
//go:build freebsd && riscv64
-// +build freebsd,riscv64
package sysconf
diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_386.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_386.go
index 16ee7ea..90963eb 100644
--- a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_386.go
+++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_386.go
@@ -2,7 +2,6 @@
// cgo -godefs sysconf_values_linux.go
//go:build linux && 386
-// +build linux,386
package sysconf
diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_amd64.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_amd64.go
index 39aee34..28ad6f1 100644
--- a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_amd64.go
+++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_amd64.go
@@ -2,7 +2,6 @@
// cgo -godefs sysconf_values_linux.go
//go:build linux && amd64
-// +build linux,amd64
package sysconf
diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_arm.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_arm.go
index 2e40116..ffbcf37 100644
--- a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_arm.go
+++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_arm.go
@@ -2,7 +2,6 @@
// cgo -godefs sysconf_values_linux.go
//go:build linux && arm
-// +build linux,arm
package sysconf
diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_arm64.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_arm64.go
index 362403a..cc9f4d8 100644
--- a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_arm64.go
+++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_arm64.go
@@ -2,7 +2,6 @@
// cgo -godefs sysconf_values_linux.go
//go:build linux && arm64
-// +build linux,arm64
package sysconf
diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_loong64.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_loong64.go
index 95a71f4..f62b15a 100644
--- a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_loong64.go
+++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_loong64.go
@@ -2,7 +2,6 @@
// cgo -godefs sysconf_values_linux.go
//go:build linux && loong64
-// +build linux,loong64
package sysconf
diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_mips.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_mips.go
index 868b0ff..37f492a 100644
--- a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_mips.go
+++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_mips.go
@@ -2,7 +2,6 @@
// cgo -godefs sysconf_values_linux.go
//go:build linux && mips
-// +build linux,mips
package sysconf
diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_mips64.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_mips64.go
index 5949f3d..ae7b7f9 100644
--- a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_mips64.go
+++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_mips64.go
@@ -2,7 +2,6 @@
// cgo -godefs sysconf_values_linux.go
//go:build linux && mips64
-// +build linux,mips64
package sysconf
diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_mips64le.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_mips64le.go
index 1853419..fe14670 100644
--- a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_mips64le.go
+++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_mips64le.go
@@ -2,7 +2,6 @@
// cgo -godefs sysconf_values_linux.go
//go:build linux && mips64le
-// +build linux,mips64le
package sysconf
diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_mipsle.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_mipsle.go
index ff41b34..d204585 100644
--- a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_mipsle.go
+++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_mipsle.go
@@ -2,7 +2,6 @@
// cgo -godefs sysconf_values_linux.go
//go:build linux && mipsle
-// +build linux,mipsle
package sysconf
diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_ppc64.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_ppc64.go
index 3887437..9ec78d3 100644
--- a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_ppc64.go
+++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_ppc64.go
@@ -2,7 +2,6 @@
// cgo -godefs sysconf_values_linux.go
//go:build linux && ppc64
-// +build linux,ppc64
package sysconf
diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_ppc64le.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_ppc64le.go
index 6d76929..a542067 100644
--- a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_ppc64le.go
+++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_ppc64le.go
@@ -2,7 +2,6 @@
// cgo -godefs sysconf_values_linux.go
//go:build linux && ppc64le
-// +build linux,ppc64le
package sysconf
diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_riscv64.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_riscv64.go
index 3d7d71b..bfb9239 100644
--- a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_riscv64.go
+++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_riscv64.go
@@ -2,7 +2,6 @@
// cgo -godefs sysconf_values_linux.go
//go:build linux && riscv64
-// +build linux,riscv64
package sysconf
diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_s390x.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_s390x.go
index 9cf8529..6e935c8 100644
--- a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_s390x.go
+++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_s390x.go
@@ -2,7 +2,6 @@
// cgo -godefs sysconf_values_linux.go
//go:build linux && s390x
-// +build linux,s390x
package sysconf
diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_netbsd_386.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_netbsd_386.go
index 3cd64dd..ea0b24a 100644
--- a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_netbsd_386.go
+++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_netbsd_386.go
@@ -2,7 +2,6 @@
// cgo -godefs sysconf_values_netbsd.go
//go:build netbsd && 386
-// +build netbsd,386
package sysconf
diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_netbsd_amd64.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_netbsd_amd64.go
index 02fc1d0..2d377e2 100644
--- a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_netbsd_amd64.go
+++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_netbsd_amd64.go
@@ -2,7 +2,6 @@
// cgo -godefs sysconf_values_netbsd.go
//go:build netbsd && amd64
-// +build netbsd,amd64
package sysconf
diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_netbsd_arm.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_netbsd_arm.go
index 16f9b6e..4a6d836 100644
--- a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_netbsd_arm.go
+++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_netbsd_arm.go
@@ -2,7 +2,6 @@
// cgo -godefs sysconf_values_netbsd.go
//go:build netbsd && arm
-// +build netbsd,arm
package sysconf
diff --git a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_netbsd_arm64.go b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_netbsd_arm64.go
index e530339..49fb672 100644
--- a/vendor/github.com/tklauser/go-sysconf/zsysconf_values_netbsd_arm64.go
+++ b/vendor/github.com/tklauser/go-sysconf/zsysconf_values_netbsd_arm64.go
@@ -2,7 +2,6 @@
// cgo -godefs sysconf_values_netbsd.go
//go:build netbsd && arm64
-// +build netbsd,arm64
package sysconf
diff --git a/vendor/github.com/tklauser/numcpus/.cirrus.yml b/vendor/github.com/tklauser/numcpus/.cirrus.yml
index 69c6ced..495e5e6 100644
--- a/vendor/github.com/tklauser/numcpus/.cirrus.yml
+++ b/vendor/github.com/tklauser/numcpus/.cirrus.yml
@@ -1,13 +1,23 @@
env:
CIRRUS_CLONE_DEPTH: 1
- GO_VERSION: go1.20
+ GO_VERSION: go1.24.0
-freebsd_12_task:
+freebsd_13_task:
freebsd_instance:
- image_family: freebsd-12-3
+ image_family: freebsd-13-5
install_script: |
pkg install -y go
GOBIN=$PWD/bin go install golang.org/dl/${GO_VERSION}@latest
bin/${GO_VERSION} download
- build_script: bin/${GO_VERSION} build -buildvcs=false -v ./...
- test_script: bin/${GO_VERSION} test -buildvcs=false -race ./...
+ build_script: bin/${GO_VERSION} build -v ./...
+ test_script: bin/${GO_VERSION} test -race ./...
+
+freebsd_14_task:
+ freebsd_instance:
+ image_family: freebsd-14-2
+ install_script: |
+ pkg install -y go
+ GOBIN=$PWD/bin go install golang.org/dl/${GO_VERSION}@latest
+ bin/${GO_VERSION} download
+ build_script: bin/${GO_VERSION} build -v ./...
+ test_script: bin/${GO_VERSION} test -race ./...
diff --git a/vendor/github.com/tklauser/numcpus/numcpus.go b/vendor/github.com/tklauser/numcpus/numcpus.go
index af59983..de206f0 100644
--- a/vendor/github.com/tklauser/numcpus/numcpus.go
+++ b/vendor/github.com/tklauser/numcpus/numcpus.go
@@ -73,3 +73,26 @@ func GetPossible() (int, error) {
func GetPresent() (int, error) {
return getPresent()
}
+
+// ListOffline returns the list of offline CPUs. See [GetOffline] for details on
+// when a CPU is considered offline.
+func ListOffline() ([]int, error) {
+ return listOffline()
+}
+
+// ListOnline returns the list of CPUs that are online and being scheduled.
+func ListOnline() ([]int, error) {
+ return listOnline()
+}
+
+// ListPossible returns the list of possible CPUs. See [GetPossible] for
+// details on when a CPU is considered possible.
+func ListPossible() ([]int, error) {
+ return listPossible()
+}
+
+// ListPresent returns the list of present CPUs. See [GetPresent] for
+// details on when a CPU is considered present.
+func ListPresent() ([]int, error) {
+ return listPresent()
+}
diff --git a/vendor/github.com/tklauser/numcpus/numcpus_bsd.go b/vendor/github.com/tklauser/numcpus/numcpus_bsd.go
index 9e77e38..efd8db0 100644
--- a/vendor/github.com/tklauser/numcpus/numcpus_bsd.go
+++ b/vendor/github.com/tklauser/numcpus/numcpus_bsd.go
@@ -13,7 +13,6 @@
// limitations under the License.
//go:build darwin || dragonfly || freebsd || netbsd || openbsd
-// +build darwin dragonfly freebsd netbsd openbsd
package numcpus
diff --git a/vendor/github.com/tklauser/numcpus/numcpus_linux.go b/vendor/github.com/tklauser/numcpus/numcpus_linux.go
index 1a30525..7b991da 100644
--- a/vendor/github.com/tklauser/numcpus/numcpus_linux.go
+++ b/vendor/github.com/tklauser/numcpus/numcpus_linux.go
@@ -15,7 +15,7 @@
package numcpus
import (
- "io/ioutil"
+ "fmt"
"os"
"path/filepath"
"strconv"
@@ -24,7 +24,14 @@ import (
"golang.org/x/sys/unix"
)
-const sysfsCPUBasePath = "/sys/devices/system/cpu"
+const (
+ sysfsCPUBasePath = "/sys/devices/system/cpu"
+
+ offline = "offline"
+ online = "online"
+ possible = "possible"
+ present = "present"
+)
func getFromCPUAffinity() (int, error) {
var cpuSet unix.CPUSet
@@ -34,38 +41,83 @@ func getFromCPUAffinity() (int, error) {
return cpuSet.Count(), nil
}
-func readCPURange(file string) (int, error) {
- buf, err := ioutil.ReadFile(filepath.Join(sysfsCPUBasePath, file))
+func readCPURangeWith[T any](file string, f func(cpus string) (T, error)) (T, error) {
+ var zero T
+ buf, err := os.ReadFile(filepath.Join(sysfsCPUBasePath, file))
if err != nil {
- return 0, err
+ return zero, err
}
- return parseCPURange(strings.Trim(string(buf), "\n "))
+ return f(strings.Trim(string(buf), "\n "))
}
-func parseCPURange(cpus string) (int, error) {
+func countCPURange(cpus string) (int, error) {
+ // 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 == "" {
+ return 0, nil
+ }
+
n := int(0)
for _, cpuRange := range strings.Split(cpus, ",") {
- if len(cpuRange) == 0 {
- continue
+ if cpuRange == "" {
+ return 0, fmt.Errorf("empty CPU range in CPU string %q", cpus)
}
- rangeOp := strings.SplitN(cpuRange, "-", 2)
- first, err := strconv.ParseUint(rangeOp[0], 10, 32)
+ from, to, found := strings.Cut(cpuRange, "-")
+ first, err := strconv.ParseUint(from, 10, 32)
if err != nil {
return 0, err
}
- if len(rangeOp) == 1 {
+ if !found {
n++
continue
}
- last, err := strconv.ParseUint(rangeOp[1], 10, 32)
+ last, err := strconv.ParseUint(to, 10, 32)
if err != nil {
return 0, err
}
+ if last < first {
+ return 0, fmt.Errorf("last CPU in range (%d) less than first (%d)", last, first)
+ }
n += int(last - first + 1)
}
return n, nil
}
+func listCPURange(cpus string) ([]int, error) {
+ // See comment in countCPURange.
+ if cpus == "" {
+ return []int{}, nil
+ }
+
+ list := []int{}
+ for _, cpuRange := range strings.Split(cpus, ",") {
+ if cpuRange == "" {
+ return nil, fmt.Errorf("empty CPU range in CPU string %q", cpus)
+ }
+ from, to, found := strings.Cut(cpuRange, "-")
+ first, err := strconv.ParseUint(from, 10, 32)
+ if err != nil {
+ return nil, err
+ }
+ if !found {
+ // range containing a single element
+ list = append(list, int(first))
+ continue
+ }
+ last, err := strconv.ParseUint(to, 10, 32)
+ if err != nil {
+ return nil, err
+ }
+ if last < first {
+ return nil, fmt.Errorf("last CPU in range (%d) less than first (%d)", last, first)
+ }
+ for cpu := int(first); cpu <= int(last); cpu++ {
+ list = append(list, cpu)
+ }
+ }
+ return list, nil
+}
+
func getConfigured() (int, error) {
d, err := os.Open(sysfsCPUBasePath)
if err != nil {
@@ -89,7 +141,7 @@ func getConfigured() (int, error) {
}
func getKernelMax() (int, error) {
- buf, err := ioutil.ReadFile(filepath.Join(sysfsCPUBasePath, "kernel_max"))
+ buf, err := os.ReadFile(filepath.Join(sysfsCPUBasePath, "kernel_max"))
if err != nil {
return 0, err
}
@@ -101,20 +153,36 @@ func getKernelMax() (int, error) {
}
func getOffline() (int, error) {
- return readCPURange("offline")
+ return readCPURangeWith(offline, countCPURange)
}
func getOnline() (int, error) {
if n, err := getFromCPUAffinity(); err == nil {
return n, nil
}
- return readCPURange("online")
+ return readCPURangeWith(online, countCPURange)
}
func getPossible() (int, error) {
- return readCPURange("possible")
+ return readCPURangeWith(possible, countCPURange)
}
func getPresent() (int, error) {
- return readCPURange("present")
+ return readCPURangeWith(present, countCPURange)
+}
+
+func listOffline() ([]int, error) {
+ return readCPURangeWith(offline, listCPURange)
+}
+
+func listOnline() ([]int, error) {
+ return readCPURangeWith(online, listCPURange)
+}
+
+func listPossible() ([]int, error) {
+ return readCPURangeWith(possible, listCPURange)
+}
+
+func listPresent() ([]int, error) {
+ return readCPURangeWith(present, listCPURange)
}
diff --git a/vendor/github.com/tklauser/numcpus/numcpus_list_unsupported.go b/vendor/github.com/tklauser/numcpus/numcpus_list_unsupported.go
new file mode 100644
index 0000000..af4efea
--- /dev/null
+++ b/vendor/github.com/tklauser/numcpus/numcpus_list_unsupported.go
@@ -0,0 +1,33 @@
+// Copyright 2024 Tobias Klauser
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+//go:build !linux
+
+package numcpus
+
+func listOffline() ([]int, error) {
+ return nil, ErrNotSupported
+}
+
+func listOnline() ([]int, error) {
+ return nil, ErrNotSupported
+}
+
+func listPossible() ([]int, error) {
+ return nil, ErrNotSupported
+}
+
+func listPresent() ([]int, error) {
+ return nil, ErrNotSupported
+}
diff --git a/vendor/github.com/tklauser/numcpus/numcpus_solaris.go b/vendor/github.com/tklauser/numcpus/numcpus_solaris.go
index a264323..f3b632f 100644
--- a/vendor/github.com/tklauser/numcpus/numcpus_solaris.go
+++ b/vendor/github.com/tklauser/numcpus/numcpus_solaris.go
@@ -13,7 +13,6 @@
// limitations under the License.
//go:build solaris
-// +build solaris
package numcpus
diff --git a/vendor/github.com/tklauser/numcpus/numcpus_unsupported.go b/vendor/github.com/tklauser/numcpus/numcpus_unsupported.go
index 4a0b7c4..e72355e 100644
--- a/vendor/github.com/tklauser/numcpus/numcpus_unsupported.go
+++ b/vendor/github.com/tklauser/numcpus/numcpus_unsupported.go
@@ -13,7 +13,6 @@
// limitations under the License.
//go:build !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !solaris && !windows
-// +build !darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!windows
package numcpus