mirror of
https://github.com/containers/podman.git
synced 2025-08-06 19:44:14 +08:00
fix(deps): update module github.com/crc-org/vfkit to v0.6.1
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
This commit is contained in:
10
go.mod
10
go.mod
@ -23,7 +23,7 @@ require (
|
||||
github.com/containers/storage v1.58.0
|
||||
github.com/containers/winquit v1.1.0
|
||||
github.com/coreos/go-systemd/v22 v22.5.1-0.20231103132048-7d375ecc2b09
|
||||
github.com/crc-org/vfkit v0.6.0
|
||||
github.com/crc-org/vfkit v0.6.1
|
||||
github.com/cyphar/filepath-securejoin v0.4.1
|
||||
github.com/digitalocean/go-qemu v0.0.0-20250212194115-ee9b0668d242
|
||||
github.com/docker/distribution v2.8.3+incompatible
|
||||
@ -143,7 +143,7 @@ require (
|
||||
github.com/klauspost/compress v1.18.0 // indirect
|
||||
github.com/kr/fs v0.1.0 // indirect
|
||||
github.com/letsencrypt/boulder v0.0.0-20240620165639-de9c06129bec // indirect
|
||||
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
|
||||
github.com/lufia/plan9stats v0.0.0-20240909124753-873cd0166683 // indirect
|
||||
github.com/mailru/easyjson v0.9.0 // indirect
|
||||
github.com/manifoldco/promptui v0.9.0 // indirect
|
||||
github.com/mattn/go-runewidth v0.0.16 // indirect
|
||||
@ -169,7 +169,7 @@ require (
|
||||
github.com/pkg/sftp v1.13.9 // indirect
|
||||
github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
|
||||
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
|
||||
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect
|
||||
github.com/proglottis/gpgme v0.1.4 // indirect
|
||||
github.com/rivo/uniseg v0.4.7 // indirect
|
||||
github.com/seccomp/libseccomp-golang v0.10.0 // indirect
|
||||
@ -187,8 +187,8 @@ require (
|
||||
github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635 // indirect
|
||||
github.com/tchap/go-patricia/v2 v2.3.2 // indirect
|
||||
github.com/titanous/rocacheck v0.0.0-20171023193734-afe73141d399 // indirect
|
||||
github.com/tklauser/go-sysconf v0.3.12 // indirect
|
||||
github.com/tklauser/numcpus v0.6.1 // indirect
|
||||
github.com/tklauser/go-sysconf v0.3.14 // indirect
|
||||
github.com/tklauser/numcpus v0.9.0 // indirect
|
||||
github.com/u-root/uio v0.0.0-20240224005618-d2acac8f3701 // indirect
|
||||
github.com/ulikunitz/xz v0.5.12 // indirect
|
||||
github.com/vbatts/tar-split v0.12.1 // indirect
|
||||
|
30
go.sum
30
go.sum
@ -97,8 +97,8 @@ github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7
|
||||
github.com/coreos/go-systemd/v22 v22.5.1-0.20231103132048-7d375ecc2b09 h1:OoRAFlvDGCUqDLampLQjk0yeeSGdF9zzst/3G9IkBbc=
|
||||
github.com/coreos/go-systemd/v22 v22.5.1-0.20231103132048-7d375ecc2b09/go.mod h1:m2r/smMKsKwgMSAoFKHaa68ImdCSNuKE1MxvQ64xuCQ=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
|
||||
github.com/crc-org/vfkit v0.6.0 h1:gUasCX2QqY9pUPebFhYsuINB8XSS/iz0qy4v18CUyB4=
|
||||
github.com/crc-org/vfkit v0.6.0/go.mod h1:i+fGyDMg5MpuUYCFXc2VXw+5R7MBD6A/8xU9UxWv/9s=
|
||||
github.com/crc-org/vfkit v0.6.1 h1:JepqPrgzKBuM/jximOcwA5ZnQPMcdarPRCrF4jHFau8=
|
||||
github.com/crc-org/vfkit v0.6.1/go.mod h1:M3UMhDHg4d9/KzcslwG4Zay8EUMe7Pv6vxG/++vJ//4=
|
||||
github.com/creack/pty v1.1.21 h1:1/QdRyBaHHJP61QkWMXlOIBfsgdDeeKfK8SYVUWJKf0=
|
||||
github.com/creack/pty v1.1.21/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4=
|
||||
github.com/cyberphone/json-canonicalization v0.0.0-20241213102144-19d51d7fe467 h1:uX1JmpONuD549D73r6cgnxyUu18Zb7yHAy5AYU0Pm4Q=
|
||||
@ -141,8 +141,8 @@ github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymF
|
||||
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
|
||||
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
|
||||
github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM=
|
||||
github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE=
|
||||
github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM=
|
||||
github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU=
|
||||
github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=
|
||||
github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
|
||||
github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw=
|
||||
@ -213,7 +213,6 @@ github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw
|
||||
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
|
||||
@ -290,14 +289,14 @@ github.com/letsencrypt/boulder v0.0.0-20240620165639-de9c06129bec h1:2tTW6cDth2T
|
||||
github.com/letsencrypt/boulder v0.0.0-20240620165639-de9c06129bec/go.mod h1:TmwEoGCwIti7BCeJ9hescZgRtatxRE+A72pCoPfmcfk=
|
||||
github.com/linuxkit/virtsock v0.0.0-20241009230534-cb6a20cc0422 h1:XvRuyDDRvi+UDxHN/M4MW4HxjmNVMmUKQj/+AbgsYgk=
|
||||
github.com/linuxkit/virtsock v0.0.0-20241009230534-cb6a20cc0422/go.mod h1:JLgfq4XMVbvfNlAXla/41lZnp21O72a/wWHGJefAvgQ=
|
||||
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4=
|
||||
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I=
|
||||
github.com/lufia/plan9stats v0.0.0-20240909124753-873cd0166683 h1:7UMa6KCCMjZEMDtTVdcGu0B1GmmC7QJKiCCjyTAWQy0=
|
||||
github.com/lufia/plan9stats v0.0.0-20240909124753-873cd0166683/go.mod h1:ilwx/Dta8jXAgpFYFvSWEMwxmbWXyiUHkd5FwyKhb5k=
|
||||
github.com/mailru/easyjson v0.9.0 h1:PrnmzHw7262yW8sTBwxi1PdJA3Iw/EKBa8psRf7d9a4=
|
||||
github.com/mailru/easyjson v0.9.0/go.mod h1:1+xMtQp2MRNVL/V1bOzuP3aP8VNwRW55fQUto+XFtTU=
|
||||
github.com/manifoldco/promptui v0.9.0 h1:3V4HzJk1TtXW1MTZMP7mdlwbBpIinw3HztaIlYthEiA=
|
||||
github.com/manifoldco/promptui v0.9.0/go.mod h1:ka04sppxSGFAtxX0qhlYQjISsg9mR4GWtQEhdbn6Pgg=
|
||||
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
|
||||
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
|
||||
github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE=
|
||||
github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8=
|
||||
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
||||
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||
github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc=
|
||||
@ -388,8 +387,8 @@ github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10/go.mod h1
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c h1:ncq/mPwQF4JjgDlrVEn3C11VoGHZN7m8qihwgMEtzYw=
|
||||
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE=
|
||||
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU=
|
||||
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE=
|
||||
github.com/prashantv/gostub v1.1.0 h1:BTyx3RfQjRHnUWaGF9oQos79AlQ5k8WNktv7VGvVH4g=
|
||||
github.com/prashantv/gostub v1.1.0/go.mod h1:A5zLQHz7ieHGG7is6LLXLz7I8+3LZzsrV0P1IAHhP5U=
|
||||
github.com/proglottis/gpgme v0.1.4 h1:3nE7YNA70o2aLjcg63tXMOhPD7bplfE5CBdV+hLAm2M=
|
||||
@ -466,10 +465,10 @@ github.com/tchap/go-patricia/v2 v2.3.2 h1:xTHFutuitO2zqKAQ5rCROYgUb7Or/+IC3fts9/
|
||||
github.com/tchap/go-patricia/v2 v2.3.2/go.mod h1:VZRHKAb53DLaG+nA9EaYYiaEx6YztwDlLElMsnSHD4k=
|
||||
github.com/titanous/rocacheck v0.0.0-20171023193734-afe73141d399 h1:e/5i7d4oYZ+C1wj2THlRK+oAhjeS/TRQwMfkIuet3w0=
|
||||
github.com/titanous/rocacheck v0.0.0-20171023193734-afe73141d399/go.mod h1:LdwHTNJT99C5fTAzDz0ud328OgXz+gierycbcIx2fRs=
|
||||
github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU=
|
||||
github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI=
|
||||
github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk=
|
||||
github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY=
|
||||
github.com/tklauser/go-sysconf v0.3.14 h1:g5vzr9iPFFz24v2KZXs/pvpvh8/V9Fw6vQK5ZZb78yU=
|
||||
github.com/tklauser/go-sysconf v0.3.14/go.mod h1:1ym4lWMLUOhuBOPGtRcJm7tEGX4SCYNEEEtghGG/8uY=
|
||||
github.com/tklauser/numcpus v0.9.0 h1:lmyCHtANi8aRUgkckBgoDk1nHCux3n2cgkJLXdQGPDo=
|
||||
github.com/tklauser/numcpus v0.9.0/go.mod h1:SN6Nq1O3VychhC1npsWostA+oW+VOQTxZrS604NSRyI=
|
||||
github.com/u-root/gobusybox/src v0.0.0-20231228173702-b69f654846aa h1:unMPGGK/CRzfg923allsikmvk2l7beBeFPUNC4RVX/8=
|
||||
github.com/u-root/gobusybox/src v0.0.0-20231228173702-b69f654846aa/go.mod h1:Zj4Tt22fJVn/nz/y6Ergm1SahR9dio1Zm/D2/S0TmXM=
|
||||
github.com/u-root/u-root v0.12.1-0.20240114161452-ab3534910ced h1:G0F7Hmwph1OjozbAUBLKJ94CmY1OlH1cGMydXgB24j0=
|
||||
@ -623,7 +622,6 @@ golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
|
16
vendor/github.com/crc-org/vfkit/pkg/config/json.go
generated
vendored
16
vendor/github.com/crc-org/vfkit/pkg/config/json.go
generated
vendored
@ -22,6 +22,7 @@ const (
|
||||
vfBlk vmComponentKind = "virtioblk"
|
||||
vfFs vmComponentKind = "virtiofs"
|
||||
vfRng vmComponentKind = "virtiorng"
|
||||
vfBalloon vmComponentKind = "virtioballoon"
|
||||
vfSerial vmComponentKind = "virtioserial"
|
||||
vfGpu vmComponentKind = "virtiogpu"
|
||||
vfInput vmComponentKind = "virtioinput"
|
||||
@ -159,6 +160,10 @@ func unmarshalDevice(rawMsg json.RawMessage) (VirtioDevice, error) {
|
||||
var newDevice VirtioRng
|
||||
err = json.Unmarshal(rawMsg, &newDevice)
|
||||
dev = &newDevice
|
||||
case vfBalloon:
|
||||
var newDevice VirtioBalloon
|
||||
err = json.Unmarshal(rawMsg, &newDevice)
|
||||
dev = &newDevice
|
||||
case vfSerial:
|
||||
var newDevice VirtioSerial
|
||||
err = json.Unmarshal(rawMsg, &newDevice)
|
||||
@ -346,6 +351,17 @@ func (dev *VirtioRng) MarshalJSON() ([]byte, error) {
|
||||
})
|
||||
}
|
||||
|
||||
func (dev *VirtioBalloon) MarshalJSON() ([]byte, error) {
|
||||
type devWithKind struct {
|
||||
jsonKind
|
||||
VirtioBalloon
|
||||
}
|
||||
return json.Marshal(devWithKind{
|
||||
jsonKind: kind(vfBalloon),
|
||||
VirtioBalloon: *dev,
|
||||
})
|
||||
}
|
||||
|
||||
func (dev *VirtioSerial) MarshalJSON() ([]byte, error) {
|
||||
type devWithKind struct {
|
||||
jsonKind
|
||||
|
110
vendor/github.com/crc-org/vfkit/pkg/config/virtio.go
generated
vendored
110
vendor/github.com/crc-org/vfkit/pkg/config/virtio.go
generated
vendored
@ -59,7 +59,7 @@ type VirtioVsock struct {
|
||||
|
||||
// VirtioBlk configures a disk device.
|
||||
type VirtioBlk struct {
|
||||
StorageConfig
|
||||
DiskStorageConfig
|
||||
DeviceIdentifier string `json:"deviceIdentifier,omitempty"`
|
||||
}
|
||||
|
||||
@ -82,7 +82,7 @@ type RosettaShare struct {
|
||||
|
||||
// NVMExpressController configures a NVMe controller in the guest
|
||||
type NVMExpressController struct {
|
||||
StorageConfig
|
||||
DiskStorageConfig
|
||||
}
|
||||
|
||||
// VirtioRng configures a random number generator (RNG) device.
|
||||
@ -117,13 +117,28 @@ const (
|
||||
)
|
||||
|
||||
type NetworkBlockDevice struct {
|
||||
VirtioBlk
|
||||
NetworkBlockStorageConfig
|
||||
DeviceIdentifier string
|
||||
Timeout time.Duration
|
||||
SynchronizationMode NBDSynchronizationMode
|
||||
}
|
||||
|
||||
// TODO: Add VirtioBalloon
|
||||
// https://github.com/Code-Hex/vz/blob/master/memory_balloon.go
|
||||
type VirtioBalloon struct{}
|
||||
|
||||
func VirtioBalloonNew() (VirtioDevice, error) {
|
||||
return &VirtioBalloon{}, nil
|
||||
}
|
||||
|
||||
func (v *VirtioBalloon) FromOptions(options []option) error {
|
||||
if len(options) != 0 {
|
||||
return fmt.Errorf("unknown options for virtio-balloon devices: %s", options)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (v *VirtioBalloon) ToCmdLine() ([]string, error) {
|
||||
return []string{"--device", "virtio-balloon"}, nil
|
||||
}
|
||||
|
||||
type option struct {
|
||||
key string
|
||||
@ -184,6 +199,8 @@ func deviceFromCmdLine(deviceOpts string) (VirtioDevice, error) {
|
||||
dev = &VirtioInput{}
|
||||
case "virtio-gpu":
|
||||
dev = &VirtioGPU{}
|
||||
case "virtio-balloon":
|
||||
dev = &VirtioBalloon{}
|
||||
case "nbd":
|
||||
dev = networkBlockDeviceNewEmpty()
|
||||
default:
|
||||
@ -479,9 +496,11 @@ func (dev *VirtioRng) FromOptions(options []option) error {
|
||||
|
||||
func nvmExpressControllerNewEmpty() *NVMExpressController {
|
||||
return &NVMExpressController{
|
||||
DiskStorageConfig: DiskStorageConfig{
|
||||
StorageConfig: StorageConfig{
|
||||
DevName: "nvme",
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@ -496,9 +515,11 @@ func NVMExpressControllerNew(imagePath string) (*NVMExpressController, error) {
|
||||
|
||||
func virtioBlkNewEmpty() *VirtioBlk {
|
||||
return &VirtioBlk{
|
||||
DiskStorageConfig: DiskStorageConfig{
|
||||
StorageConfig: StorageConfig{
|
||||
DevName: "virtio-blk",
|
||||
},
|
||||
},
|
||||
DeviceIdentifier: "",
|
||||
}
|
||||
}
|
||||
@ -527,11 +548,11 @@ func (dev *VirtioBlk) FromOptions(options []option) error {
|
||||
}
|
||||
}
|
||||
|
||||
return dev.StorageConfig.FromOptions(unhandledOpts)
|
||||
return dev.DiskStorageConfig.FromOptions(unhandledOpts)
|
||||
}
|
||||
|
||||
func (dev *VirtioBlk) ToCmdLine() ([]string, error) {
|
||||
cmdLine, err := dev.StorageConfig.ToCmdLine()
|
||||
cmdLine, err := dev.DiskStorageConfig.ToCmdLine()
|
||||
if err != nil {
|
||||
return []string{}, err
|
||||
}
|
||||
@ -681,12 +702,12 @@ func (dev *RosettaShare) FromOptions(options []option) error {
|
||||
|
||||
func networkBlockDeviceNewEmpty() *NetworkBlockDevice {
|
||||
return &NetworkBlockDevice{
|
||||
VirtioBlk: VirtioBlk{
|
||||
NetworkBlockStorageConfig: NetworkBlockStorageConfig{
|
||||
StorageConfig: StorageConfig{
|
||||
DevName: "nbd",
|
||||
},
|
||||
DeviceIdentifier: "",
|
||||
},
|
||||
DeviceIdentifier: "",
|
||||
Timeout: time.Duration(15000 * time.Millisecond), // set a default timeout to 15s
|
||||
SynchronizationMode: SynchronizationFullMode, // default mode to full
|
||||
}
|
||||
@ -707,7 +728,7 @@ func NetworkBlockDeviceNew(uri string, timeout uint32, synchronization NBDSynchr
|
||||
}
|
||||
|
||||
func (nbd *NetworkBlockDevice) ToCmdLine() ([]string, error) {
|
||||
cmdLine, err := nbd.VirtioBlk.ToCmdLine()
|
||||
cmdLine, err := nbd.NetworkBlockStorageConfig.ToCmdLine()
|
||||
if err != nil {
|
||||
return []string{}, err
|
||||
}
|
||||
@ -715,6 +736,9 @@ func (nbd *NetworkBlockDevice) ToCmdLine() ([]string, error) {
|
||||
return []string{}, fmt.Errorf("unexpected storage config commandline")
|
||||
}
|
||||
|
||||
if nbd.DeviceIdentifier != "" {
|
||||
cmdLine[1] = fmt.Sprintf("%s,deviceId=%s", cmdLine[1], nbd.DeviceIdentifier)
|
||||
}
|
||||
if nbd.Timeout.Milliseconds() > 0 {
|
||||
cmdLine[1] = fmt.Sprintf("%s,timeout=%d", cmdLine[1], nbd.Timeout.Milliseconds())
|
||||
}
|
||||
@ -729,6 +753,8 @@ func (nbd *NetworkBlockDevice) FromOptions(options []option) error {
|
||||
unhandledOpts := []option{}
|
||||
for _, option := range options {
|
||||
switch option.key {
|
||||
case "deviceId":
|
||||
nbd.DeviceIdentifier = option.value
|
||||
case "timeout":
|
||||
timeoutMS, err := strconv.ParseInt(option.value, 10, 32)
|
||||
if err != nil {
|
||||
@ -749,18 +775,20 @@ func (nbd *NetworkBlockDevice) FromOptions(options []option) error {
|
||||
}
|
||||
}
|
||||
|
||||
return nbd.VirtioBlk.FromOptions(unhandledOpts)
|
||||
return nbd.NetworkBlockStorageConfig.FromOptions(unhandledOpts)
|
||||
}
|
||||
|
||||
type USBMassStorage struct {
|
||||
StorageConfig
|
||||
DiskStorageConfig
|
||||
}
|
||||
|
||||
func usbMassStorageNewEmpty() *USBMassStorage {
|
||||
return &USBMassStorage{
|
||||
StorageConfig{
|
||||
DiskStorageConfig: DiskStorageConfig{
|
||||
StorageConfig: StorageConfig{
|
||||
DevName: "usb-mass-storage",
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@ -780,37 +808,65 @@ func (dev *USBMassStorage) SetReadOnly(readOnly bool) {
|
||||
// StorageConfig configures a disk device.
|
||||
type StorageConfig struct {
|
||||
DevName string `json:"devName"`
|
||||
ImagePath string `json:"imagePath,omitempty"`
|
||||
URI string `json:"uri,omitempty"`
|
||||
ReadOnly bool `json:"readOnly,omitempty"`
|
||||
}
|
||||
|
||||
func (config *StorageConfig) ToCmdLine() ([]string, error) {
|
||||
if config.ImagePath != "" && config.URI != "" {
|
||||
return nil, fmt.Errorf("%s devices cannot have both path to a disk image and a uri to a remote block device", config.DevName)
|
||||
type DiskStorageConfig struct {
|
||||
StorageConfig
|
||||
ImagePath string `json:"imagePath,omitempty"`
|
||||
}
|
||||
if config.ImagePath == "" && config.URI == "" {
|
||||
return nil, fmt.Errorf("%s devices need a path to a disk image or a uri to a remote block device", config.DevName)
|
||||
|
||||
type NetworkBlockStorageConfig struct {
|
||||
StorageConfig
|
||||
URI string `json:"uri,omitempty"`
|
||||
}
|
||||
var value string
|
||||
if config.ImagePath != "" {
|
||||
value = fmt.Sprintf("%s,path=%s", config.DevName, config.ImagePath)
|
||||
}
|
||||
if config.URI != "" {
|
||||
value = fmt.Sprintf("%s,uri=%s", config.DevName, config.URI)
|
||||
|
||||
func (config *DiskStorageConfig) ToCmdLine() ([]string, error) {
|
||||
if config.ImagePath == "" {
|
||||
return nil, fmt.Errorf("%s devices need the path to a disk image", config.DevName)
|
||||
}
|
||||
|
||||
value := fmt.Sprintf("%s,path=%s", config.DevName, config.ImagePath)
|
||||
|
||||
if config.ReadOnly {
|
||||
value += ",readonly"
|
||||
}
|
||||
return []string{"--device", value}, nil
|
||||
}
|
||||
|
||||
func (config *StorageConfig) FromOptions(options []option) error {
|
||||
func (config *DiskStorageConfig) FromOptions(options []option) error {
|
||||
for _, option := range options {
|
||||
switch option.key {
|
||||
case "path":
|
||||
config.ImagePath = option.value
|
||||
case "readonly":
|
||||
if option.value != "" {
|
||||
return fmt.Errorf("unexpected value for virtio-blk 'readonly' option: %s", option.value)
|
||||
}
|
||||
config.ReadOnly = true
|
||||
default:
|
||||
return fmt.Errorf("unknown option for %s devices: %s", config.DevName, option.key)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (config *NetworkBlockStorageConfig) ToCmdLine() ([]string, error) {
|
||||
if config.URI == "" {
|
||||
return nil, fmt.Errorf("%s devices need the uri to a remote block device", config.DevName)
|
||||
}
|
||||
|
||||
value := fmt.Sprintf("%s,uri=%s", config.DevName, config.URI)
|
||||
|
||||
if config.ReadOnly {
|
||||
value += ",readonly"
|
||||
}
|
||||
return []string{"--device", value}, nil
|
||||
}
|
||||
|
||||
func (config *NetworkBlockStorageConfig) FromOptions(options []option) error {
|
||||
for _, option := range options {
|
||||
switch option.key {
|
||||
case "uri":
|
||||
config.URI = option.value
|
||||
case "readonly":
|
||||
|
60
vendor/github.com/crc-org/vfkit/pkg/util/exithandler.go
generated
vendored
Normal file
60
vendor/github.com/crc-org/vfkit/pkg/util/exithandler.go
generated
vendored
Normal file
@ -0,0 +1,60 @@
|
||||
package util
|
||||
|
||||
import (
|
||||
"log"
|
||||
"os"
|
||||
"os/signal"
|
||||
"sync"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
type exitHandlerRegistry struct {
|
||||
handlers []func()
|
||||
mutex sync.Mutex
|
||||
}
|
||||
|
||||
var exitRegistry = exitHandlerRegistry{}
|
||||
|
||||
// RegisterExitHandler appends a func Exit handler to the list of handlers.
|
||||
// The handlers will be invoked when vfkit receives a termination or interruption signal
|
||||
//
|
||||
// This method is useful when a caller wishes to execute a func before a shutdown.
|
||||
func RegisterExitHandler(handler func()) {
|
||||
exitRegistry.mutex.Lock()
|
||||
defer exitRegistry.mutex.Unlock()
|
||||
exitRegistry.handlers = append(exitRegistry.handlers, handler)
|
||||
}
|
||||
|
||||
// SetupExitSignalHandling sets up a signal channel to listen for termination or interruption signals.
|
||||
// When one of these signals is received, all the registered exit handlers will be invoked, just
|
||||
// before terminating the program.
|
||||
func SetupExitSignalHandling() {
|
||||
setupExitSignalHandling(true)
|
||||
}
|
||||
|
||||
// setupExitSignalHandling sets up a signal channel to listen for termination or interruption signals.
|
||||
// When one of these signals is received, all the registered exit handlers will be invoked.
|
||||
// It is possible to prevent the program from exiting by setting the doExit param to false (used for testing)
|
||||
func setupExitSignalHandling(doExit bool) {
|
||||
sigChan := make(chan os.Signal, 2)
|
||||
signal.Notify(sigChan, os.Interrupt, syscall.SIGTERM, syscall.SIGINT)
|
||||
go func() {
|
||||
for sig := range sigChan {
|
||||
log.Printf("captured %v, calling exit handlers and exiting..", sig)
|
||||
ExecuteExitHandlers()
|
||||
if doExit {
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
// ExecuteExitHandlers is call all registered exit handlers
|
||||
// This function should be called when program finish work(i.e. when VM is turned off by guest OS)
|
||||
func ExecuteExitHandlers() {
|
||||
exitRegistry.mutex.Lock()
|
||||
for _, handler := range exitRegistry.handlers {
|
||||
handler()
|
||||
}
|
||||
exitRegistry.mutex.Unlock()
|
||||
}
|
11
vendor/github.com/lufia/plan9stats/README.md
generated
vendored
11
vendor/github.com/lufia/plan9stats/README.md
generated
vendored
@ -1,2 +1,13 @@
|
||||
# plan9stats
|
||||
A module for retrieving statistics of Plan 9
|
||||
|
||||
[![GoDev][godev-image]][godev-url]
|
||||
[![Actions Status][actions-image]][actions-url]
|
||||
[![Coverage Status][coveralls-image]][coveralls-url]
|
||||
|
||||
[godev-image]: https://pkg.go.dev/badge/github.com/lufia/plan9stats
|
||||
[godev-url]: https://pkg.go.dev/github.com/lufia/plan9stats
|
||||
[actions-image]: https://github.com/lufia/plan9stats/workflows/Test/badge.svg?branch=main
|
||||
[actions-url]: https://github.com/lufia/plan9stats/actions?workflow=Test
|
||||
[coveralls-image]: https://coveralls.io/repos/github/lufia/plan9stats/badge.svg
|
||||
[coveralls-url]: https://coveralls.io/github/lufia/plan9stats
|
||||
|
5
vendor/github.com/lufia/plan9stats/cpu.go
generated
vendored
5
vendor/github.com/lufia/plan9stats/cpu.go
generated
vendored
@ -178,9 +178,12 @@ func ReadCPUStats(ctx context.Context, opts ...Option) (*CPUStats, error) {
|
||||
var up uint32parser
|
||||
pids := make([]uint32, len(names))
|
||||
for i, s := range names {
|
||||
if s == "trace" {
|
||||
continue
|
||||
}
|
||||
pids[i] = up.Parse(s)
|
||||
}
|
||||
if up.err != nil {
|
||||
if err := up.err; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
sort.Slice(pids, func(i, j int) bool {
|
||||
|
116
vendor/github.com/lufia/plan9stats/disk.go
generated
vendored
Normal file
116
vendor/github.com/lufia/plan9stats/disk.go
generated
vendored
Normal file
@ -0,0 +1,116 @@
|
||||
package stats
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"context"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// Storage represents /dev/sdXX/ctl.
|
||||
type Storage struct {
|
||||
Name string
|
||||
Model string
|
||||
Capacity int64
|
||||
Partitions []*Partition
|
||||
}
|
||||
|
||||
// Partition represents a part of /dev/sdXX/ctl.
|
||||
type Partition struct {
|
||||
Name string
|
||||
Start uint64
|
||||
End uint64
|
||||
}
|
||||
|
||||
func ReadStorages(ctx context.Context, opts ...Option) ([]*Storage, error) {
|
||||
cfg := newConfig(opts...)
|
||||
sdctl := filepath.Join(cfg.rootdir, "/dev/sdctl")
|
||||
f, err := os.Open(sdctl)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
var a []*Storage
|
||||
scanner := bufio.NewScanner(f)
|
||||
for scanner.Scan() {
|
||||
fields := bytes.Split(scanner.Bytes(), delim)
|
||||
if len(fields) == 0 {
|
||||
continue
|
||||
}
|
||||
exp := string(fields[0]) + "*"
|
||||
if !strings.HasPrefix(exp, "sd") {
|
||||
continue
|
||||
}
|
||||
dir := filepath.Join(cfg.rootdir, "/dev", exp)
|
||||
m, err := filepath.Glob(dir)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, dir := range m {
|
||||
s, err := readStorage(dir)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
a = append(a, s)
|
||||
}
|
||||
}
|
||||
if err := scanner.Err(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return a, nil
|
||||
}
|
||||
|
||||
func readStorage(dir string) (*Storage, error) {
|
||||
ctl := filepath.Join(dir, "ctl")
|
||||
f, err := os.Open(ctl)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
var s Storage
|
||||
s.Name = filepath.Base(dir)
|
||||
scanner := bufio.NewScanner(f)
|
||||
for scanner.Scan() {
|
||||
line := scanner.Bytes()
|
||||
switch {
|
||||
case bytes.HasPrefix(line, []byte("inquiry ")):
|
||||
s.Model = string(bytes.TrimSpace(line[7:]))
|
||||
case bytes.HasPrefix(line, []byte("geometry ")):
|
||||
fields := bytes.Split(line, delim)
|
||||
if len(fields) < 3 {
|
||||
continue
|
||||
}
|
||||
var p intParser
|
||||
sec := p.ParseInt64(string(fields[1]), 10)
|
||||
size := p.ParseInt64(string(fields[2]), 10)
|
||||
if err := p.Err(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
s.Capacity = sec * size
|
||||
case bytes.HasPrefix(line, []byte("part ")):
|
||||
fields := bytes.Split(line, delim)
|
||||
if len(fields) < 4 {
|
||||
continue
|
||||
}
|
||||
var p intParser
|
||||
start := p.ParseUint64(string(fields[2]), 10)
|
||||
end := p.ParseUint64(string(fields[3]), 10)
|
||||
if err := p.Err(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
s.Partitions = append(s.Partitions, &Partition{
|
||||
Name: string(fields[1]),
|
||||
Start: start,
|
||||
End: end,
|
||||
})
|
||||
}
|
||||
}
|
||||
if err := scanner.Err(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &s, nil
|
||||
}
|
82
vendor/github.com/lufia/plan9stats/host.go
generated
vendored
82
vendor/github.com/lufia/plan9stats/host.go
generated
vendored
@ -109,12 +109,6 @@ func parseGauge(s string, r *Gauge) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
type Storage struct {
|
||||
Name string
|
||||
Model string
|
||||
Capacity int64
|
||||
}
|
||||
|
||||
type Interface struct {
|
||||
Name string
|
||||
Addr string
|
||||
@ -177,7 +171,7 @@ func ReadHost(ctx context.Context, opts ...Option) (*Host, error) {
|
||||
}
|
||||
h.Sysname = name
|
||||
|
||||
a, err := readStorages(cfg.rootdir)
|
||||
a, err := ReadStorages(ctx, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -203,80 +197,6 @@ func readSysname(rootdir string) (string, error) {
|
||||
return string(bytes.TrimSpace(b)), nil
|
||||
}
|
||||
|
||||
func readStorages(rootdir string) ([]*Storage, error) {
|
||||
sdctl := filepath.Join(rootdir, "/dev/sdctl")
|
||||
f, err := os.Open(sdctl)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
var a []*Storage
|
||||
scanner := bufio.NewScanner(f)
|
||||
for scanner.Scan() {
|
||||
fields := bytes.Split(scanner.Bytes(), delim)
|
||||
if len(fields) == 0 {
|
||||
continue
|
||||
}
|
||||
exp := string(fields[0]) + "*"
|
||||
if !strings.HasPrefix(exp, "sd") {
|
||||
continue
|
||||
}
|
||||
dir := filepath.Join(rootdir, "/dev", exp)
|
||||
m, err := filepath.Glob(dir)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, dir := range m {
|
||||
s, err := readStorage(dir)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
a = append(a, s)
|
||||
}
|
||||
}
|
||||
if err := scanner.Err(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return a, nil
|
||||
}
|
||||
|
||||
func readStorage(dir string) (*Storage, error) {
|
||||
ctl := filepath.Join(dir, "ctl")
|
||||
f, err := os.Open(ctl)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
var s Storage
|
||||
s.Name = filepath.Base(dir)
|
||||
scanner := bufio.NewScanner(f)
|
||||
for scanner.Scan() {
|
||||
line := scanner.Bytes()
|
||||
switch {
|
||||
case bytes.HasPrefix(line, []byte("inquiry")):
|
||||
s.Model = string(bytes.TrimSpace(line[7:]))
|
||||
case bytes.HasPrefix(line, []byte("geometry")):
|
||||
fields := bytes.Split(line, delim)
|
||||
if len(fields) < 3 {
|
||||
continue
|
||||
}
|
||||
var p intParser
|
||||
sec := p.ParseInt64(string(fields[1]), 10)
|
||||
size := p.ParseInt64(string(fields[2]), 10)
|
||||
if err := p.Err(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
s.Capacity = sec * size
|
||||
}
|
||||
}
|
||||
if err := scanner.Err(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &s, nil
|
||||
}
|
||||
|
||||
type IPStats struct {
|
||||
ID int // number of interface in ipifc dir
|
||||
Device string // associated physical device
|
||||
|
9
vendor/github.com/lufia/plan9stats/int.go
generated
vendored
9
vendor/github.com/lufia/plan9stats/int.go
generated
vendored
@ -26,6 +26,15 @@ func (p *intParser) ParseInt64(s string, base int) int64 {
|
||||
return n
|
||||
}
|
||||
|
||||
func (p *intParser) ParseUint64(s string, base int) uint64 {
|
||||
if p.err != nil {
|
||||
return 0
|
||||
}
|
||||
var n uint64
|
||||
n, p.err = strconv.ParseUint(s, base, 64)
|
||||
return n
|
||||
}
|
||||
|
||||
func (p *intParser) Err() error {
|
||||
return p.err
|
||||
}
|
||||
|
1
vendor/github.com/power-devops/perfstat/config.go
generated
vendored
1
vendor/github.com/power-devops/perfstat/config.go
generated
vendored
@ -1,3 +1,4 @@
|
||||
//go:build aix
|
||||
// +build aix
|
||||
|
||||
package perfstat
|
||||
|
40
vendor/github.com/power-devops/perfstat/cpustat.go
generated
vendored
40
vendor/github.com/power-devops/perfstat/cpustat.go
generated
vendored
@ -1,3 +1,4 @@
|
||||
//go:build aix
|
||||
// +build aix
|
||||
|
||||
package perfstat
|
||||
@ -20,6 +21,13 @@ import (
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
var old_cpu_total_stat *C.perfstat_cpu_total_t
|
||||
|
||||
func init() {
|
||||
old_cpu_total_stat = (*C.perfstat_cpu_total_t)(C.malloc(C.sizeof_perfstat_cpu_total_t))
|
||||
C.perfstat_cpu_total(nil, old_cpu_total_stat, C.sizeof_perfstat_cpu_total_t, 1)
|
||||
}
|
||||
|
||||
func CpuStat() ([]CPU, error) {
|
||||
var cpustat *C.perfstat_cpu_t
|
||||
var cpu C.perfstat_id_t
|
||||
@ -96,3 +104,35 @@ func CpuUtilStat(intvl time.Duration) (*CPUUtil, error) {
|
||||
u := perfstatcpuutil2cpuutil(cpuutil)
|
||||
return &u, nil
|
||||
}
|
||||
|
||||
func CpuUtilTotalStat() (*CPUUtil, error) {
|
||||
var cpuutil *C.perfstat_cpu_util_t
|
||||
var new_cpu_total_stat *C.perfstat_cpu_total_t
|
||||
var data C.perfstat_rawdata_t
|
||||
|
||||
new_cpu_total_stat = (*C.perfstat_cpu_total_t)(C.malloc(C.sizeof_perfstat_cpu_total_t))
|
||||
cpuutil = (*C.perfstat_cpu_util_t)(C.malloc(C.sizeof_perfstat_cpu_util_t))
|
||||
defer C.free(unsafe.Pointer(cpuutil))
|
||||
|
||||
r := C.perfstat_cpu_total(nil, new_cpu_total_stat, C.sizeof_perfstat_cpu_total_t, 1)
|
||||
if r <= 0 {
|
||||
C.free(unsafe.Pointer(new_cpu_total_stat))
|
||||
return nil, fmt.Errorf("error perfstat_cpu_total()")
|
||||
}
|
||||
|
||||
data._type = C.UTIL_CPU_TOTAL
|
||||
data.curstat = unsafe.Pointer(new_cpu_total_stat)
|
||||
data.prevstat = unsafe.Pointer(old_cpu_total_stat)
|
||||
data.sizeof_data = C.sizeof_perfstat_cpu_total_t
|
||||
data.cur_elems = 1
|
||||
data.prev_elems = 1
|
||||
|
||||
r = C.perfstat_cpu_util(&data, cpuutil, C.sizeof_perfstat_cpu_util_t, 1)
|
||||
C.free(unsafe.Pointer(old_cpu_total_stat))
|
||||
old_cpu_total_stat = new_cpu_total_stat
|
||||
if r <= 0 {
|
||||
return nil, fmt.Errorf("error perfstat_cpu_util()")
|
||||
}
|
||||
u := perfstatcpuutil2cpuutil(cpuutil)
|
||||
return &u, nil
|
||||
}
|
||||
|
1
vendor/github.com/power-devops/perfstat/diskstat.go
generated
vendored
1
vendor/github.com/power-devops/perfstat/diskstat.go
generated
vendored
@ -1,3 +1,4 @@
|
||||
//go:build aix
|
||||
// +build aix
|
||||
|
||||
package perfstat
|
||||
|
13
vendor/github.com/power-devops/perfstat/doc.go
generated
vendored
13
vendor/github.com/power-devops/perfstat/doc.go
generated
vendored
@ -1,3 +1,4 @@
|
||||
//go:build !aix
|
||||
// +build !aix
|
||||
|
||||
// Copyright 2020 Power-Devops.com. All rights reserved.
|
||||
@ -36,24 +37,24 @@ func DisableLVMStat() {}
|
||||
// CpuStat() returns array of CPU structures with information about
|
||||
// logical CPUs on the system.
|
||||
// IBM documentation:
|
||||
// * https://www.ibm.com/support/knowledgecenter/ssw_aix_72/performancetools/idprftools_perfstat_int_cpu.html
|
||||
// * https://www.ibm.com/support/knowledgecenter/en/ssw_aix_72/p_bostechref/perfstat_cpu.html
|
||||
// - https://www.ibm.com/support/knowledgecenter/ssw_aix_72/performancetools/idprftools_perfstat_int_cpu.html
|
||||
// - https://www.ibm.com/support/knowledgecenter/en/ssw_aix_72/p_bostechref/perfstat_cpu.html
|
||||
func CpuStat() ([]CPU, error) {
|
||||
return nil, fmt.Errorf("not implemented")
|
||||
}
|
||||
|
||||
// CpuTotalStat() returns general information about CPUs on the system.
|
||||
// IBM documentation:
|
||||
// * https://www.ibm.com/support/knowledgecenter/ssw_aix_72/performancetools/idprftools_perfstat_glob_cpu.html
|
||||
// * https://www.ibm.com/support/knowledgecenter/en/ssw_aix_72/p_bostechref/perfstat_cputot.html
|
||||
// - https://www.ibm.com/support/knowledgecenter/ssw_aix_72/performancetools/idprftools_perfstat_glob_cpu.html
|
||||
// - https://www.ibm.com/support/knowledgecenter/en/ssw_aix_72/p_bostechref/perfstat_cputot.html
|
||||
func CpuTotalStat() (*CPUTotal, error) {
|
||||
return nil, fmt.Errorf("not implemented")
|
||||
}
|
||||
|
||||
// CpuUtilStat() calculates CPU utilization.
|
||||
// IBM documentation:
|
||||
// * https://www.ibm.com/support/knowledgecenter/ssw_aix_72/performancetools/idprftools_perfstat_cpu_util.html
|
||||
// * https://www.ibm.com/support/knowledgecenter/en/ssw_aix_72/p_bostechref/perfstat_cpu_util.html
|
||||
// - https://www.ibm.com/support/knowledgecenter/ssw_aix_72/performancetools/idprftools_perfstat_cpu_util.html
|
||||
// - https://www.ibm.com/support/knowledgecenter/en/ssw_aix_72/p_bostechref/perfstat_cpu_util.html
|
||||
func CpuUtilStat(intvl time.Duration) (*CPUUtil, error) {
|
||||
return nil, fmt.Errorf("not implemented")
|
||||
}
|
||||
|
1
vendor/github.com/power-devops/perfstat/fsstat.go
generated
vendored
1
vendor/github.com/power-devops/perfstat/fsstat.go
generated
vendored
@ -1,3 +1,4 @@
|
||||
//go:build aix
|
||||
// +build aix
|
||||
|
||||
package perfstat
|
||||
|
57
vendor/github.com/power-devops/perfstat/helpers.go
generated
vendored
57
vendor/github.com/power-devops/perfstat/helpers.go
generated
vendored
@ -1,3 +1,4 @@
|
||||
//go:build aix
|
||||
// +build aix
|
||||
|
||||
package perfstat
|
||||
@ -7,6 +8,7 @@ package perfstat
|
||||
|
||||
#include <libperfstat.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/dr.h>
|
||||
|
||||
#include "c_helpers.h"
|
||||
*/
|
||||
@ -754,7 +756,7 @@ func fsinfo2filesystem(n *C.struct_fsinfo) FileSystem {
|
||||
i.Device = C.GoString(n.devname)
|
||||
i.MountPoint = C.GoString(n.fsname)
|
||||
i.FSType = int(n.fstype)
|
||||
i.Flags = int(n.flags)
|
||||
i.Flags = uint(n.flags)
|
||||
i.TotalBlocks = int64(n.totalblks)
|
||||
i.FreeBlocks = int64(n.freeblks)
|
||||
i.TotalInodes = int64(n.totalinodes)
|
||||
@ -762,3 +764,56 @@ func fsinfo2filesystem(n *C.struct_fsinfo) FileSystem {
|
||||
|
||||
return i
|
||||
}
|
||||
|
||||
func lparinfo2partinfo(n C.lpar_info_format2_t) PartitionInfo {
|
||||
var i PartitionInfo
|
||||
|
||||
i.Version = int(n.version)
|
||||
i.OnlineMemory = uint64(n.online_memory)
|
||||
i.TotalDispatchTime = uint64(n.tot_dispatch_time)
|
||||
i.PoolIdleTime = uint64(n.pool_idle_time)
|
||||
i.DispatchLatency = uint64(n.dispatch_latency)
|
||||
i.LparFlags = uint(n.lpar_flags)
|
||||
i.PCpusInSys = uint(n.pcpus_in_sys)
|
||||
i.OnlineVCpus = uint(n.online_vcpus)
|
||||
i.OnlineLCpus = uint(n.online_lcpus)
|
||||
i.PCpusInPool = uint(n.pcpus_in_pool)
|
||||
i.UnallocCapacity = uint(n.unalloc_capacity)
|
||||
i.EntitledCapacity = uint(n.entitled_capacity)
|
||||
i.VariableWeight = uint(n.variable_weight)
|
||||
i.UnallocWeight = uint(n.unalloc_weight)
|
||||
i.MinReqVCpuCapacity = uint(n.min_req_vcpu_capacity)
|
||||
i.GroupId = uint8(n.group_id)
|
||||
i.PoolId = uint8(n.pool_id)
|
||||
i.ShCpusInSys = uint(n.shcpus_in_sys)
|
||||
i.MaxPoolCapacity = uint(n.max_pool_capacity)
|
||||
i.EntitledPoolCapacity = uint(n.entitled_pool_capacity)
|
||||
i.PoolMaxTime = uint64(n.pool_max_time)
|
||||
i.PoolBusyTime = uint64(n.pool_busy_time)
|
||||
i.PoolScaledBusyTime = uint64(n.pool_scaled_busy_time)
|
||||
i.ShCpuTotalTime = uint64(n.shcpu_tot_time)
|
||||
i.ShCpuBusyTime = uint64(n.shcpu_busy_time)
|
||||
i.ShCpuScaledBusyTime = uint64(n.shcpu_scaled_busy_time)
|
||||
i.EntMemCapacity = uint64(n.ent_mem_capacity)
|
||||
i.PhysMem = uint64(n.phys_mem)
|
||||
i.VrmPoolPhysMem = uint64(n.vrm_pool_physmem)
|
||||
i.HypPageSize = uint(n.hyp_pagesize)
|
||||
i.VrmPoolId = int(n.vrm_pool_id)
|
||||
i.VrmGroupId = int(n.vrm_group_id)
|
||||
i.VarMemWeight = int(n.var_mem_weight)
|
||||
i.UnallocVarMemWeight = int(n.unalloc_var_mem_weight)
|
||||
i.UnallocEntMemCapacity = uint64(n.unalloc_ent_mem_capacity)
|
||||
i.TrueOnlineMemory = uint64(n.true_online_memory)
|
||||
i.AmeOnlineMemory = uint64(n.ame_online_memory)
|
||||
i.AmeType = uint8(n.ame_type)
|
||||
i.SpecExecMode = uint8(n.spec_exec_mode)
|
||||
i.AmeFactor = uint(n.ame_factor)
|
||||
i.EmPartMajorCode = uint(n.em_part_major_code)
|
||||
i.EmPartMinorCode = uint(n.em_part_minor_code)
|
||||
i.BytesCoalesced = uint64(n.bytes_coalesced)
|
||||
i.BytesCoalescedMemPool = uint64(n.bytes_coalesced_mempool)
|
||||
i.PurrCoalescing = uint64(n.purr_coalescing)
|
||||
i.SpurrCoalescing = uint64(n.spurr_coalescing)
|
||||
|
||||
return i
|
||||
}
|
||||
|
14
vendor/github.com/power-devops/perfstat/lparstat.go
generated
vendored
14
vendor/github.com/power-devops/perfstat/lparstat.go
generated
vendored
@ -1,3 +1,4 @@
|
||||
//go:build aix
|
||||
// +build aix
|
||||
|
||||
package perfstat
|
||||
@ -6,11 +7,13 @@ package perfstat
|
||||
#cgo LDFLAGS: -lperfstat
|
||||
|
||||
#include <libperfstat.h>
|
||||
#include <sys/dr.h>
|
||||
*/
|
||||
import "C"
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
func PartitionStat() (*PartitionConfig, error) {
|
||||
@ -24,3 +27,14 @@ func PartitionStat() (*PartitionConfig, error) {
|
||||
return &p, nil
|
||||
|
||||
}
|
||||
|
||||
func LparInfo() (*PartitionInfo, error) {
|
||||
var pinfo C.lpar_info_format2_t
|
||||
|
||||
rc := C.lpar_get_info(C.LPAR_INFO_FORMAT2, unsafe.Pointer(&pinfo), C.sizeof_lpar_info_format2_t)
|
||||
if rc != 0 {
|
||||
return nil, fmt.Errorf("lpar_get_info() error")
|
||||
}
|
||||
p := lparinfo2partinfo(pinfo)
|
||||
return &p, nil
|
||||
}
|
||||
|
1
vendor/github.com/power-devops/perfstat/lvmstat.go
generated
vendored
1
vendor/github.com/power-devops/perfstat/lvmstat.go
generated
vendored
@ -1,3 +1,4 @@
|
||||
//go:build aix
|
||||
// +build aix
|
||||
|
||||
package perfstat
|
||||
|
1
vendor/github.com/power-devops/perfstat/memstat.go
generated
vendored
1
vendor/github.com/power-devops/perfstat/memstat.go
generated
vendored
@ -1,3 +1,4 @@
|
||||
//go:build aix
|
||||
// +build aix
|
||||
|
||||
package perfstat
|
||||
|
1
vendor/github.com/power-devops/perfstat/netstat.go
generated
vendored
1
vendor/github.com/power-devops/perfstat/netstat.go
generated
vendored
@ -1,3 +1,4 @@
|
||||
//go:build aix
|
||||
// +build aix
|
||||
|
||||
package perfstat
|
||||
|
1
vendor/github.com/power-devops/perfstat/procstat.go
generated
vendored
1
vendor/github.com/power-devops/perfstat/procstat.go
generated
vendored
@ -1,3 +1,4 @@
|
||||
//go:build aix
|
||||
// +build aix
|
||||
|
||||
package perfstat
|
||||
|
1
vendor/github.com/power-devops/perfstat/sysconf.go
generated
vendored
1
vendor/github.com/power-devops/perfstat/sysconf.go
generated
vendored
@ -1,3 +1,4 @@
|
||||
//go:build aix
|
||||
// +build aix
|
||||
|
||||
package perfstat
|
||||
|
33
vendor/github.com/power-devops/perfstat/systemcfg.go
generated
vendored
33
vendor/github.com/power-devops/perfstat/systemcfg.go
generated
vendored
@ -1,3 +1,4 @@
|
||||
//go:build aix
|
||||
// +build aix
|
||||
|
||||
package perfstat
|
||||
@ -70,6 +71,7 @@ const (
|
||||
SC_TM_VER = 59 /* Transaction Memory version, 0 - not capable */
|
||||
SC_NX_CAP = 60 /* NX GZIP capable */
|
||||
SC_PKS_STATE = 61 /* Platform KeyStore */
|
||||
SC_MMA_VER = 62
|
||||
)
|
||||
|
||||
/* kernel attributes */
|
||||
@ -119,6 +121,7 @@ const (
|
||||
IMPL_POWER7 = 0x8000 /* 7 class CPU */
|
||||
IMPL_POWER8 = 0x10000 /* 8 class CPU */
|
||||
IMPL_POWER9 = 0x20000 /* 9 class CPU */
|
||||
IMPL_POWER10 = 0x20000 /* 10 class CPU */
|
||||
)
|
||||
|
||||
// Values for implementation field for IA64 Architectures
|
||||
@ -151,11 +154,13 @@ const (
|
||||
PV_7 = 0x200000 /* Power PC 7 */
|
||||
PV_8 = 0x300000 /* Power PC 8 */
|
||||
PV_9 = 0x400000 /* Power PC 9 */
|
||||
PV_10 = 0x500000 /* Power PC 10 */
|
||||
PV_5_Compat = 0x0F8000 /* Power PC 5 */
|
||||
PV_6_Compat = 0x108000 /* Power PC 6 */
|
||||
PV_7_Compat = 0x208000 /* Power PC 7 */
|
||||
PV_8_Compat = 0x308000 /* Power PC 8 */
|
||||
PV_9_Compat = 0x408000 /* Power PC 9 */
|
||||
PV_10_Compat = 0x508000 /* Power PC 10 */
|
||||
PV_RESERVED_2 = 0x0A0000 /* source compatability */
|
||||
PV_RESERVED_3 = 0x0B0000 /* source compatability */
|
||||
PV_RS2 = 0x040000 /* Power RS2 */
|
||||
@ -194,6 +199,8 @@ const (
|
||||
PPI8_1 = 0x4B
|
||||
PPI8_2 = 0x4D
|
||||
PPI9 = 0x4E
|
||||
PPI9_1 = 0x4E
|
||||
PPI10_1 = 0x80
|
||||
)
|
||||
|
||||
// Macros for kernel attributes
|
||||
@ -291,14 +298,32 @@ func GetCPUImplementation() string {
|
||||
return "POWER8"
|
||||
case impl&IMPL_POWER9 != 0:
|
||||
return "POWER9"
|
||||
case impl&IMPL_POWER10 != 0:
|
||||
return "Power10"
|
||||
default:
|
||||
return "Unknown"
|
||||
}
|
||||
}
|
||||
|
||||
func POWER10OrNewer() bool {
|
||||
impl := unix.Getsystemcfg(SC_IMPL)
|
||||
if impl&IMPL_POWER10 != 0 {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func POWER10() bool {
|
||||
impl := unix.Getsystemcfg(SC_IMPL)
|
||||
if impl&IMPL_POWER10 != 0 {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func POWER9OrNewer() bool {
|
||||
impl := unix.Getsystemcfg(SC_IMPL)
|
||||
if impl&IMPL_POWER9 != 0 {
|
||||
if impl&IMPL_POWER10 != 0 || impl&IMPL_POWER9 != 0 {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
@ -314,7 +339,7 @@ func POWER9() bool {
|
||||
|
||||
func POWER8OrNewer() bool {
|
||||
impl := unix.Getsystemcfg(SC_IMPL)
|
||||
if impl&IMPL_POWER9 != 0 || impl&IMPL_POWER8 != 0 {
|
||||
if impl&IMPL_POWER10 != 0 || impl&IMPL_POWER9 != 0 || impl&IMPL_POWER8 != 0 {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
@ -330,7 +355,7 @@ func POWER8() bool {
|
||||
|
||||
func POWER7OrNewer() bool {
|
||||
impl := unix.Getsystemcfg(SC_IMPL)
|
||||
if impl&IMPL_POWER9 != 0 || impl&IMPL_POWER8 != 0 || impl&IMPL_POWER7 != 0 {
|
||||
if impl&IMPL_POWER10 != 0 || impl&IMPL_POWER9 != 0 || impl&IMPL_POWER8 != 0 || impl&IMPL_POWER7 != 0 {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
@ -419,6 +444,8 @@ func PksEnabled() bool {
|
||||
func CPUMode() string {
|
||||
impl := unix.Getsystemcfg(SC_VERS)
|
||||
switch impl {
|
||||
case PV_10, PV_10_Compat:
|
||||
return "Power10"
|
||||
case PV_9, PV_9_Compat:
|
||||
return "POWER9"
|
||||
case PV_8, PV_8_Compat:
|
||||
|
4
vendor/github.com/power-devops/perfstat/types_disk.go
generated
vendored
4
vendor/github.com/power-devops/perfstat/types_disk.go
generated
vendored
@ -29,8 +29,8 @@ type DiskTotal struct {
|
||||
// Disk Adapter Types
|
||||
const (
|
||||
DA_SCSI = 0 /* 0 ==> SCSI, SAS, other legacy adapter types */
|
||||
DA_VSCSI /* 1 ==> Virtual SCSI/SAS Adapter */
|
||||
DA_FCA /* 2 ==> Fiber Channel Adapter */
|
||||
DA_VSCSI = 1 /* 1 ==> Virtual SCSI/SAS Adapter */
|
||||
DA_FCA = 2 /* 2 ==> Fiber Channel Adapter */
|
||||
)
|
||||
|
||||
type DiskAdapter struct {
|
||||
|
2
vendor/github.com/power-devops/perfstat/types_fs.go
generated
vendored
2
vendor/github.com/power-devops/perfstat/types_fs.go
generated
vendored
@ -8,7 +8,7 @@ type FileSystem struct {
|
||||
Device string /* name of the mounted device */
|
||||
MountPoint string /* where the device is mounted */
|
||||
FSType int /* File system type, see the constants below */
|
||||
Flags int /* Flags of the file system */
|
||||
Flags uint /* Flags of the file system */
|
||||
TotalBlocks int64 /* number of 512 bytes blocks in the filesystem */
|
||||
FreeBlocks int64 /* number of free 512 bytes block in the filesystem */
|
||||
TotalInodes int64 /* total number of inodes in the filesystem */
|
||||
|
61
vendor/github.com/power-devops/perfstat/types_lpar.go
generated
vendored
61
vendor/github.com/power-devops/perfstat/types_lpar.go
generated
vendored
@ -66,3 +66,64 @@ type PartitionConfig struct {
|
||||
TargetMemExpSize int64 /* Expanded Memory Size in MB */
|
||||
SubProcessorMode int32 /* Split core mode, its value can be 0,1,2 or 4. 0 for unsupported, 1 for capable but not enabled, 2 or 4 for enabled*/
|
||||
}
|
||||
|
||||
const (
|
||||
AME_TYPE_V1 = 0x1
|
||||
AME_TYPE_V2 = 0x2
|
||||
LPAR_INFO_CAPPED = 0x01 /* Parition Capped */
|
||||
LPAR_INFO_AUTH_PIC = 0x02 /* Authority granted for poolidle*/
|
||||
LPAR_INFO_SMT_ENABLED = 0x04 /* SMT Enabled */
|
||||
LPAR_INFO_WPAR_ACTIVE = 0x08 /* Process Running Within a WPAR */
|
||||
LPAR_INFO_EXTENDED = 0x10 /* Extended shared processor pool information */
|
||||
LPAR_INFO_AME_ENABLED = 0x20 /* Active Mem. Expansion (AME) enabled*/
|
||||
LPAR_INFO_SEM_ENABLED = 0x40 /* Speculative Execution Mode enabled */
|
||||
)
|
||||
|
||||
type PartitionInfo struct {
|
||||
Version int /* version for this structure */
|
||||
OnlineMemory uint64 /* MB of currently online memory */
|
||||
TotalDispatchTime uint64 /* Total lpar dispatch time in nsecs */
|
||||
PoolIdleTime uint64 /* Idle time of shared CPU pool nsecs*/
|
||||
DispatchLatency uint64 /* Max latency inbetween dispatches of this LPAR on physCPUS in nsecs */
|
||||
LparFlags uint /* LPAR flags */
|
||||
PCpusInSys uint /* # of active licensed physical CPUs in system */
|
||||
OnlineVCpus uint /* # of current online virtual CPUs */
|
||||
OnlineLCpus uint /* # of current online logical CPUs */
|
||||
PCpusInPool uint /* # physical CPUs in shared pool */
|
||||
UnallocCapacity uint /* Unallocated Capacity available in shared pool */
|
||||
EntitledCapacity uint /* Entitled Processor Capacity for this partition */
|
||||
VariableWeight uint /* Variable Processor Capacity Weight */
|
||||
UnallocWeight uint /* Unallocated Variable Weight available for this partition */
|
||||
MinReqVCpuCapacity uint /* OS minimum required virtual processor capacity. */
|
||||
GroupId uint8 /* ID of a LPAR group/aggregation */
|
||||
PoolId uint8 /* ID of a shared pool */
|
||||
ShCpusInSys uint /* # of physical processors allocated for shared processor use */
|
||||
MaxPoolCapacity uint /* Maximum processor capacity of partition's pool */
|
||||
EntitledPoolCapacity uint /* Entitled processor capacity of partition's pool */
|
||||
PoolMaxTime uint64 /* Summation of maximum time that could be consumed by the pool, in nanoseconds */
|
||||
PoolBusyTime uint64 /* Summation of busy time accumulated across all partitions in the pool, in nanoseconds */
|
||||
PoolScaledBusyTime uint64 /* Scaled summation of busy time accumulated across all partitions in the pool, in nanoseconds */
|
||||
ShCpuTotalTime uint64 /* Summation of total time across all physical processors allocated for shared processor use, in nanoseconds */
|
||||
ShCpuBusyTime uint64 /* Summation of busy time accumulated across all shared processor partitions, in nanoseconds */
|
||||
ShCpuScaledBusyTime uint64 /* Scaled summation of busy time accumulated across all shared processor partitions, in nanoseconds */
|
||||
EntMemCapacity uint64 /* Partition's current entitlement memory capacity setting */
|
||||
PhysMem uint64 /* Amount of physical memory, in bytes, currently backing the partition's logical memory */
|
||||
VrmPoolPhysMem uint64 /* Total amount of physical memory in the VRM pool */
|
||||
HypPageSize uint /* Page size hypervisor is using to virtualize partition's memory */
|
||||
VrmPoolId int /* ID of VRM pool */
|
||||
VrmGroupId int /* eWLM VRM group to which partition belongs */
|
||||
VarMemWeight int /* Partition's current variable memory capacity weighting setting */
|
||||
UnallocVarMemWeight int /* Amount of unallocated variable memory capacity weight available to LPAR's group */
|
||||
UnallocEntMemCapacity uint64 /* Amount of unallocated I/O memory entitlement available to LPAR's group */
|
||||
TrueOnlineMemory uint64 /* true MB of currently online memory */
|
||||
AmeOnlineMemory uint64 /* AME MB of currently online memory */
|
||||
AmeType uint8
|
||||
SpecExecMode uint8 /* Speculative Execution Mode */
|
||||
AmeFactor uint /* memory expansion factor for LPAR */
|
||||
EmPartMajorCode uint /* Major and minor codes for our */
|
||||
EmPartMinorCode uint /* current energy management mode */
|
||||
BytesCoalesced uint64 /* The number of bytes of the calling partition.s logical real memory coalesced because they contained duplicated data */
|
||||
BytesCoalescedMemPool uint64 /* If the calling partition is authorized to see pool wide statistics then the number of bytes of logical real memory coalesced because they contained duplicated data in the calling partition.s memory pool else set to zero.*/
|
||||
PurrCoalescing uint64 /* If the calling partition is authorized to see pool wide statistics then PURR cycles consumed to coalesce data else set to zero.*/
|
||||
SpurrCoalescing uint64 /* If the calling partition is authorized to see pool wide statistics then SPURR cycles consumed to coalesce data else set to zero.*/
|
||||
}
|
||||
|
1
vendor/github.com/power-devops/perfstat/uptime.go
generated
vendored
1
vendor/github.com/power-devops/perfstat/uptime.go
generated
vendored
@ -1,3 +1,4 @@
|
||||
//go:build aix
|
||||
// +build aix
|
||||
|
||||
package perfstat
|
||||
|
24
vendor/github.com/tklauser/go-sysconf/.cirrus.yml
generated
vendored
24
vendor/github.com/tklauser/go-sysconf/.cirrus.yml
generated
vendored
@ -1,20 +1,20 @@
|
||||
env:
|
||||
CIRRUS_CLONE_DEPTH: 1
|
||||
GO_VERSION: go1.20
|
||||
|
||||
freebsd_12_task:
|
||||
freebsd_instance:
|
||||
image_family: freebsd-12-3
|
||||
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 ./...
|
||||
GO_VERSION: go1.22.2
|
||||
|
||||
freebsd_13_task:
|
||||
freebsd_instance:
|
||||
image_family: freebsd-13-0
|
||||
image_family: freebsd-13-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 ./...
|
||||
|
||||
freebsd_14_task:
|
||||
freebsd_instance:
|
||||
image_family: freebsd-14-0
|
||||
install_script: |
|
||||
pkg install -y go
|
||||
GOBIN=$PWD/bin go install golang.org/dl/${GO_VERSION}@latest
|
||||
|
1
vendor/github.com/tklauser/go-sysconf/sysconf_bsd.go
generated
vendored
1
vendor/github.com/tklauser/go-sysconf/sysconf_bsd.go
generated
vendored
@ -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
|
||||
|
||||
|
37
vendor/github.com/tklauser/go-sysconf/sysconf_darwin.go
generated
vendored
37
vendor/github.com/tklauser/go-sysconf/sysconf_darwin.go
generated
vendored
@ -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
|
||||
|
1
vendor/github.com/tklauser/go-sysconf/sysconf_generic.go
generated
vendored
1
vendor/github.com/tklauser/go-sysconf/sysconf_generic.go
generated
vendored
@ -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
|
||||
|
||||
|
16
vendor/github.com/tklauser/go-sysconf/sysconf_linux.go
generated
vendored
16
vendor/github.com/tklauser/go-sysconf/sysconf_linux.go
generated
vendored
@ -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,11 +85,17 @@ 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)
|
||||
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
|
||||
// cpu* lines at the beginning. Assume this
|
||||
@ -98,6 +103,9 @@ func getNprocsProcStat() (int64, error) {
|
||||
break
|
||||
}
|
||||
}
|
||||
if err := s.Err(); err != nil {
|
||||
return -1, err
|
||||
}
|
||||
return count, nil
|
||||
}
|
||||
|
||||
|
18
vendor/github.com/tklauser/go-sysconf/sysconf_netbsd.go
generated
vendored
18
vendor/github.com/tklauser/go-sysconf/sysconf_netbsd.go
generated
vendored
@ -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:
|
||||
|
1
vendor/github.com/tklauser/go-sysconf/sysconf_posix.go
generated
vendored
1
vendor/github.com/tklauser/go-sysconf/sysconf_posix.go
generated
vendored
@ -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
|
||||
|
||||
|
1
vendor/github.com/tklauser/go-sysconf/sysconf_unsupported.go
generated
vendored
1
vendor/github.com/tklauser/go-sysconf/sysconf_unsupported.go
generated
vendored
@ -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
|
||||
|
||||
|
2
vendor/github.com/tklauser/go-sysconf/zsysconf_defs_darwin.go
generated
vendored
2
vendor/github.com/tklauser/go-sysconf/zsysconf_defs_darwin.go
generated
vendored
@ -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 (
|
||||
|
1
vendor/github.com/tklauser/go-sysconf/zsysconf_defs_dragonfly.go
generated
vendored
1
vendor/github.com/tklauser/go-sysconf/zsysconf_defs_dragonfly.go
generated
vendored
@ -2,7 +2,6 @@
|
||||
// cgo -godefs sysconf_defs_dragonfly.go
|
||||
|
||||
//go:build dragonfly
|
||||
// +build dragonfly
|
||||
|
||||
package sysconf
|
||||
|
||||
|
1
vendor/github.com/tklauser/go-sysconf/zsysconf_defs_freebsd.go
generated
vendored
1
vendor/github.com/tklauser/go-sysconf/zsysconf_defs_freebsd.go
generated
vendored
@ -2,7 +2,6 @@
|
||||
// cgo -godefs sysconf_defs_freebsd.go
|
||||
|
||||
//go:build freebsd
|
||||
// +build freebsd
|
||||
|
||||
package sysconf
|
||||
|
||||
|
1
vendor/github.com/tklauser/go-sysconf/zsysconf_defs_linux.go
generated
vendored
1
vendor/github.com/tklauser/go-sysconf/zsysconf_defs_linux.go
generated
vendored
@ -2,7 +2,6 @@
|
||||
// cgo -godefs sysconf_defs_linux.go
|
||||
|
||||
//go:build linux
|
||||
// +build linux
|
||||
|
||||
package sysconf
|
||||
|
||||
|
1
vendor/github.com/tklauser/go-sysconf/zsysconf_defs_netbsd.go
generated
vendored
1
vendor/github.com/tklauser/go-sysconf/zsysconf_defs_netbsd.go
generated
vendored
@ -2,7 +2,6 @@
|
||||
// cgo -godefs sysconf_defs_netbsd.go
|
||||
|
||||
//go:build netbsd
|
||||
// +build netbsd
|
||||
|
||||
package sysconf
|
||||
|
||||
|
1
vendor/github.com/tklauser/go-sysconf/zsysconf_defs_openbsd.go
generated
vendored
1
vendor/github.com/tklauser/go-sysconf/zsysconf_defs_openbsd.go
generated
vendored
@ -2,7 +2,6 @@
|
||||
// cgo -godefs sysconf_defs_openbsd.go
|
||||
|
||||
//go:build openbsd
|
||||
// +build openbsd
|
||||
|
||||
package sysconf
|
||||
|
||||
|
1
vendor/github.com/tklauser/go-sysconf/zsysconf_defs_solaris.go
generated
vendored
1
vendor/github.com/tklauser/go-sysconf/zsysconf_defs_solaris.go
generated
vendored
@ -2,7 +2,6 @@
|
||||
// cgo -godefs sysconf_defs_solaris.go
|
||||
|
||||
//go:build solaris
|
||||
// +build solaris
|
||||
|
||||
package sysconf
|
||||
|
||||
|
1
vendor/github.com/tklauser/go-sysconf/zsysconf_values_freebsd_386.go
generated
vendored
1
vendor/github.com/tklauser/go-sysconf/zsysconf_values_freebsd_386.go
generated
vendored
@ -2,7 +2,6 @@
|
||||
// cgo -godefs sysconf_values_freebsd.go
|
||||
|
||||
//go:build freebsd && 386
|
||||
// +build freebsd,386
|
||||
|
||||
package sysconf
|
||||
|
||||
|
1
vendor/github.com/tklauser/go-sysconf/zsysconf_values_freebsd_amd64.go
generated
vendored
1
vendor/github.com/tklauser/go-sysconf/zsysconf_values_freebsd_amd64.go
generated
vendored
@ -2,7 +2,6 @@
|
||||
// cgo -godefs sysconf_values_freebsd.go
|
||||
|
||||
//go:build freebsd && amd64
|
||||
// +build freebsd,amd64
|
||||
|
||||
package sysconf
|
||||
|
||||
|
1
vendor/github.com/tklauser/go-sysconf/zsysconf_values_freebsd_arm.go
generated
vendored
1
vendor/github.com/tklauser/go-sysconf/zsysconf_values_freebsd_arm.go
generated
vendored
@ -2,7 +2,6 @@
|
||||
// cgo -godefs sysconf_values_freebsd.go
|
||||
|
||||
//go:build freebsd && arm
|
||||
// +build freebsd,arm
|
||||
|
||||
package sysconf
|
||||
|
||||
|
1
vendor/github.com/tklauser/go-sysconf/zsysconf_values_freebsd_arm64.go
generated
vendored
1
vendor/github.com/tklauser/go-sysconf/zsysconf_values_freebsd_arm64.go
generated
vendored
@ -2,7 +2,6 @@
|
||||
// cgo -godefs sysconf_values_freebsd.go
|
||||
|
||||
//go:build freebsd && arm64
|
||||
// +build freebsd,arm64
|
||||
|
||||
package sysconf
|
||||
|
||||
|
1
vendor/github.com/tklauser/go-sysconf/zsysconf_values_freebsd_riscv64.go
generated
vendored
1
vendor/github.com/tklauser/go-sysconf/zsysconf_values_freebsd_riscv64.go
generated
vendored
@ -2,7 +2,6 @@
|
||||
// cgo -godefs sysconf_values_freebsd.go
|
||||
|
||||
//go:build freebsd && riscv64
|
||||
// +build freebsd,riscv64
|
||||
|
||||
package sysconf
|
||||
|
||||
|
1
vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_386.go
generated
vendored
1
vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_386.go
generated
vendored
@ -2,7 +2,6 @@
|
||||
// cgo -godefs sysconf_values_linux.go
|
||||
|
||||
//go:build linux && 386
|
||||
// +build linux,386
|
||||
|
||||
package sysconf
|
||||
|
||||
|
1
vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_amd64.go
generated
vendored
1
vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_amd64.go
generated
vendored
@ -2,7 +2,6 @@
|
||||
// cgo -godefs sysconf_values_linux.go
|
||||
|
||||
//go:build linux && amd64
|
||||
// +build linux,amd64
|
||||
|
||||
package sysconf
|
||||
|
||||
|
1
vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_arm.go
generated
vendored
1
vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_arm.go
generated
vendored
@ -2,7 +2,6 @@
|
||||
// cgo -godefs sysconf_values_linux.go
|
||||
|
||||
//go:build linux && arm
|
||||
// +build linux,arm
|
||||
|
||||
package sysconf
|
||||
|
||||
|
1
vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_arm64.go
generated
vendored
1
vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_arm64.go
generated
vendored
@ -2,7 +2,6 @@
|
||||
// cgo -godefs sysconf_values_linux.go
|
||||
|
||||
//go:build linux && arm64
|
||||
// +build linux,arm64
|
||||
|
||||
package sysconf
|
||||
|
||||
|
1
vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_loong64.go
generated
vendored
1
vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_loong64.go
generated
vendored
@ -2,7 +2,6 @@
|
||||
// cgo -godefs sysconf_values_linux.go
|
||||
|
||||
//go:build linux && loong64
|
||||
// +build linux,loong64
|
||||
|
||||
package sysconf
|
||||
|
||||
|
1
vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_mips.go
generated
vendored
1
vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_mips.go
generated
vendored
@ -2,7 +2,6 @@
|
||||
// cgo -godefs sysconf_values_linux.go
|
||||
|
||||
//go:build linux && mips
|
||||
// +build linux,mips
|
||||
|
||||
package sysconf
|
||||
|
||||
|
1
vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_mips64.go
generated
vendored
1
vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_mips64.go
generated
vendored
@ -2,7 +2,6 @@
|
||||
// cgo -godefs sysconf_values_linux.go
|
||||
|
||||
//go:build linux && mips64
|
||||
// +build linux,mips64
|
||||
|
||||
package sysconf
|
||||
|
||||
|
1
vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_mips64le.go
generated
vendored
1
vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_mips64le.go
generated
vendored
@ -2,7 +2,6 @@
|
||||
// cgo -godefs sysconf_values_linux.go
|
||||
|
||||
//go:build linux && mips64le
|
||||
// +build linux,mips64le
|
||||
|
||||
package sysconf
|
||||
|
||||
|
1
vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_mipsle.go
generated
vendored
1
vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_mipsle.go
generated
vendored
@ -2,7 +2,6 @@
|
||||
// cgo -godefs sysconf_values_linux.go
|
||||
|
||||
//go:build linux && mipsle
|
||||
// +build linux,mipsle
|
||||
|
||||
package sysconf
|
||||
|
||||
|
1
vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_ppc64.go
generated
vendored
1
vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_ppc64.go
generated
vendored
@ -2,7 +2,6 @@
|
||||
// cgo -godefs sysconf_values_linux.go
|
||||
|
||||
//go:build linux && ppc64
|
||||
// +build linux,ppc64
|
||||
|
||||
package sysconf
|
||||
|
||||
|
1
vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_ppc64le.go
generated
vendored
1
vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_ppc64le.go
generated
vendored
@ -2,7 +2,6 @@
|
||||
// cgo -godefs sysconf_values_linux.go
|
||||
|
||||
//go:build linux && ppc64le
|
||||
// +build linux,ppc64le
|
||||
|
||||
package sysconf
|
||||
|
||||
|
1
vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_riscv64.go
generated
vendored
1
vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_riscv64.go
generated
vendored
@ -2,7 +2,6 @@
|
||||
// cgo -godefs sysconf_values_linux.go
|
||||
|
||||
//go:build linux && riscv64
|
||||
// +build linux,riscv64
|
||||
|
||||
package sysconf
|
||||
|
||||
|
1
vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_s390x.go
generated
vendored
1
vendor/github.com/tklauser/go-sysconf/zsysconf_values_linux_s390x.go
generated
vendored
@ -2,7 +2,6 @@
|
||||
// cgo -godefs sysconf_values_linux.go
|
||||
|
||||
//go:build linux && s390x
|
||||
// +build linux,s390x
|
||||
|
||||
package sysconf
|
||||
|
||||
|
1
vendor/github.com/tklauser/go-sysconf/zsysconf_values_netbsd_386.go
generated
vendored
1
vendor/github.com/tklauser/go-sysconf/zsysconf_values_netbsd_386.go
generated
vendored
@ -2,7 +2,6 @@
|
||||
// cgo -godefs sysconf_values_netbsd.go
|
||||
|
||||
//go:build netbsd && 386
|
||||
// +build netbsd,386
|
||||
|
||||
package sysconf
|
||||
|
||||
|
1
vendor/github.com/tklauser/go-sysconf/zsysconf_values_netbsd_amd64.go
generated
vendored
1
vendor/github.com/tklauser/go-sysconf/zsysconf_values_netbsd_amd64.go
generated
vendored
@ -2,7 +2,6 @@
|
||||
// cgo -godefs sysconf_values_netbsd.go
|
||||
|
||||
//go:build netbsd && amd64
|
||||
// +build netbsd,amd64
|
||||
|
||||
package sysconf
|
||||
|
||||
|
1
vendor/github.com/tklauser/go-sysconf/zsysconf_values_netbsd_arm.go
generated
vendored
1
vendor/github.com/tklauser/go-sysconf/zsysconf_values_netbsd_arm.go
generated
vendored
@ -2,7 +2,6 @@
|
||||
// cgo -godefs sysconf_values_netbsd.go
|
||||
|
||||
//go:build netbsd && arm
|
||||
// +build netbsd,arm
|
||||
|
||||
package sysconf
|
||||
|
||||
|
1
vendor/github.com/tklauser/go-sysconf/zsysconf_values_netbsd_arm64.go
generated
vendored
1
vendor/github.com/tklauser/go-sysconf/zsysconf_values_netbsd_arm64.go
generated
vendored
@ -2,7 +2,6 @@
|
||||
// cgo -godefs sysconf_values_netbsd.go
|
||||
|
||||
//go:build netbsd && arm64
|
||||
// +build netbsd,arm64
|
||||
|
||||
package sysconf
|
||||
|
||||
|
20
vendor/github.com/tklauser/numcpus/.cirrus.yml
generated
vendored
20
vendor/github.com/tklauser/numcpus/.cirrus.yml
generated
vendored
@ -1,13 +1,23 @@
|
||||
env:
|
||||
CIRRUS_CLONE_DEPTH: 1
|
||||
GO_VERSION: go1.20
|
||||
GO_VERSION: go1.23.0
|
||||
|
||||
freebsd_12_task:
|
||||
freebsd_13_task:
|
||||
freebsd_instance:
|
||||
image_family: freebsd-12-3
|
||||
image_family: freebsd-13-3
|
||||
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-0
|
||||
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 ./...
|
||||
|
23
vendor/github.com/tklauser/numcpus/numcpus.go
generated
vendored
23
vendor/github.com/tklauser/numcpus/numcpus.go
generated
vendored
@ -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()
|
||||
}
|
||||
|
1
vendor/github.com/tklauser/numcpus/numcpus_bsd.go
generated
vendored
1
vendor/github.com/tklauser/numcpus/numcpus_bsd.go
generated
vendored
@ -13,7 +13,6 @@
|
||||
// limitations under the License.
|
||||
|
||||
//go:build darwin || dragonfly || freebsd || netbsd || openbsd
|
||||
// +build darwin dragonfly freebsd netbsd openbsd
|
||||
|
||||
package numcpus
|
||||
|
||||
|
104
vendor/github.com/tklauser/numcpus/numcpus_linux.go
generated
vendored
104
vendor/github.com/tklauser/numcpus/numcpus_linux.go
generated
vendored
@ -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 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
|
||||
}
|
||||
|
||||
func parseCPURange(cpus string) (int, error) {
|
||||
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)
|
||||
}
|
||||
|
33
vendor/github.com/tklauser/numcpus/numcpus_list_unsupported.go
generated
vendored
Normal file
33
vendor/github.com/tklauser/numcpus/numcpus_list_unsupported.go
generated
vendored
Normal file
@ -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
|
||||
}
|
1
vendor/github.com/tklauser/numcpus/numcpus_solaris.go
generated
vendored
1
vendor/github.com/tklauser/numcpus/numcpus_solaris.go
generated
vendored
@ -13,7 +13,6 @@
|
||||
// limitations under the License.
|
||||
|
||||
//go:build solaris
|
||||
// +build solaris
|
||||
|
||||
package numcpus
|
||||
|
||||
|
1
vendor/github.com/tklauser/numcpus/numcpus_unsupported.go
generated
vendored
1
vendor/github.com/tklauser/numcpus/numcpus_unsupported.go
generated
vendored
@ -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
|
||||
|
||||
|
16
vendor/modules.txt
vendored
16
vendor/modules.txt
vendored
@ -393,8 +393,8 @@ github.com/coreos/go-systemd/v22/dbus
|
||||
github.com/coreos/go-systemd/v22/internal/dlopen
|
||||
github.com/coreos/go-systemd/v22/journal
|
||||
github.com/coreos/go-systemd/v22/sdjournal
|
||||
# github.com/crc-org/vfkit v0.6.0
|
||||
## explicit; go 1.22.0
|
||||
# github.com/crc-org/vfkit v0.6.1
|
||||
## explicit; go 1.23.0
|
||||
github.com/crc-org/vfkit/pkg/config
|
||||
github.com/crc-org/vfkit/pkg/rest/define
|
||||
github.com/crc-org/vfkit/pkg/util
|
||||
@ -669,7 +669,7 @@ github.com/letsencrypt/boulder/strictyaml
|
||||
# github.com/linuxkit/virtsock v0.0.0-20241009230534-cb6a20cc0422
|
||||
## explicit; go 1.17
|
||||
github.com/linuxkit/virtsock/pkg/hvsock
|
||||
# github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0
|
||||
# github.com/lufia/plan9stats v0.0.0-20240909124753-873cd0166683
|
||||
## explicit; go 1.16
|
||||
github.com/lufia/plan9stats
|
||||
# github.com/mailru/easyjson v0.9.0
|
||||
@ -865,7 +865,7 @@ github.com/planetscale/vtprotobuf/protohelpers
|
||||
# github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2
|
||||
## explicit
|
||||
github.com/pmezard/go-difflib/difflib
|
||||
# github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c
|
||||
# github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55
|
||||
## explicit; go 1.14
|
||||
github.com/power-devops/perfstat
|
||||
# github.com/proglottis/gpgme v0.1.4
|
||||
@ -970,11 +970,11 @@ github.com/tchap/go-patricia/v2/patricia
|
||||
# github.com/titanous/rocacheck v0.0.0-20171023193734-afe73141d399
|
||||
## explicit
|
||||
github.com/titanous/rocacheck
|
||||
# github.com/tklauser/go-sysconf v0.3.12
|
||||
## explicit; go 1.13
|
||||
# github.com/tklauser/go-sysconf v0.3.14
|
||||
## explicit; go 1.18
|
||||
github.com/tklauser/go-sysconf
|
||||
# github.com/tklauser/numcpus v0.6.1
|
||||
## explicit; go 1.13
|
||||
# github.com/tklauser/numcpus v0.9.0
|
||||
## explicit; go 1.18
|
||||
github.com/tklauser/numcpus
|
||||
# github.com/u-root/uio v0.0.0-20240224005618-d2acac8f3701
|
||||
## explicit; go 1.21
|
||||
|
Reference in New Issue
Block a user