Files
podman/pkg/specgen/resources_linux.go
Doug Rabson 911e4a1389 specgen/generate: Factor out setting resource limits from CompleteSpec
This avoids setting values in the spec which are not supported on
FreeBSD - including these values causes warning messages for the
unsupported features.

[NO NEW TESTS NEEDED]

Signed-off-by: Doug Rabson <dfr@rabson.org>
2022-09-08 08:24:18 +01:00

23 lines
507 B
Go

package specgen
import (
"github.com/containers/common/pkg/config"
spec "github.com/opencontainers/runtime-spec/specs-go"
)
func (s *SpecGenerator) InitResourceLimits(rtc *config.Config) {
if s.ResourceLimits == nil || s.ResourceLimits.Pids == nil {
if s.CgroupsMode != "disabled" {
limit := rtc.PidsLimit()
if limit != 0 {
if s.ResourceLimits == nil {
s.ResourceLimits = &spec.LinuxResources{}
}
s.ResourceLimits.Pids = &spec.LinuxPids{
Limit: limit,
}
}
}
}
}