summaryrefslogtreecommitdiff
path: root/vendor/go.uber.org/automaxprocs
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/go.uber.org/automaxprocs')
-rw-r--r--vendor/go.uber.org/automaxprocs/internal/cgroups/cgroups.go4
-rw-r--r--vendor/go.uber.org/automaxprocs/internal/cgroups/cgroups2.go4
-rw-r--r--vendor/go.uber.org/automaxprocs/internal/cgroups/mountpoint.go4
3 files changed, 10 insertions, 2 deletions
diff --git a/vendor/go.uber.org/automaxprocs/internal/cgroups/cgroups.go b/vendor/go.uber.org/automaxprocs/internal/cgroups/cgroups.go
index e6c173197..e89f54360 100644
--- a/vendor/go.uber.org/automaxprocs/internal/cgroups/cgroups.go
+++ b/vendor/go.uber.org/automaxprocs/internal/cgroups/cgroups.go
@@ -110,8 +110,8 @@ func (cg CGroups) CPUQuota() (float64, bool, error) {
}
cfsPeriodUs, err := cpuCGroup.readInt(_cgroupCPUCFSPeriodUsParam)
- if err != nil {
- return -1, false, err
+ if defined := cfsPeriodUs > 0; err != nil || !defined {
+ return -1, defined, err
}
return float64(cfsQuotaUs) / float64(cfsPeriodUs), true, nil
diff --git a/vendor/go.uber.org/automaxprocs/internal/cgroups/cgroups2.go b/vendor/go.uber.org/automaxprocs/internal/cgroups/cgroups2.go
index 3ac10c8b6..78556062f 100644
--- a/vendor/go.uber.org/automaxprocs/internal/cgroups/cgroups2.go
+++ b/vendor/go.uber.org/automaxprocs/internal/cgroups/cgroups2.go
@@ -159,6 +159,10 @@ func (cg *CGroups2) CPUQuota() (float64, bool, error) {
if err != nil {
return -1, false, err
}
+
+ if period == 0 {
+ return -1, false, errors.New("zero value for period is not allowed")
+ }
}
return float64(max) / float64(period), true, nil
diff --git a/vendor/go.uber.org/automaxprocs/internal/cgroups/mountpoint.go b/vendor/go.uber.org/automaxprocs/internal/cgroups/mountpoint.go
index 2efde4c4b..f3877f78a 100644
--- a/vendor/go.uber.org/automaxprocs/internal/cgroups/mountpoint.go
+++ b/vendor/go.uber.org/automaxprocs/internal/cgroups/mountpoint.go
@@ -95,8 +95,12 @@ func NewMountPointFromLine(line string) (*MountPoint, error) {
for i, field := range fields[_miFieldIDOptionalFields:] {
if field == _mountInfoOptionalFieldsSep {
+ // End of optional fields.
fsTypeStart := _miFieldIDOptionalFields + i + 1
+ // Now we know where the optional fields end, split the line again with a
+ // limit to avoid issues with spaces in super options as present on WSL.
+ fields = strings.SplitN(line, _mountInfoSep, fsTypeStart+_miFieldCountSecondHalf)
if len(fields) != fsTypeStart+_miFieldCountSecondHalf {
return nil, mountPointFormatInvalidError{line}
}