github.com/containers/podman/v4@v4.9.4/pkg/specgen/resources_linux.go (about)

     1  package specgen
     2  
     3  import (
     4  	"github.com/containers/common/pkg/config"
     5  	spec "github.com/opencontainers/runtime-spec/specs-go"
     6  )
     7  
     8  func (s *SpecGenerator) InitResourceLimits(rtc *config.Config) {
     9  	if s.ResourceLimits == nil || s.ResourceLimits.Pids == nil {
    10  		if s.CgroupsMode != "disabled" {
    11  			limit := rtc.PidsLimit()
    12  			if limit != 0 {
    13  				if s.ResourceLimits == nil {
    14  					s.ResourceLimits = &spec.LinuxResources{}
    15  				}
    16  				s.ResourceLimits.Pids = &spec.LinuxPids{
    17  					Limit: limit,
    18  				}
    19  			}
    20  		}
    21  	}
    22  }