aboutsummaryrefslogtreecommitdiff
path: root/pkg/specgen/resources_linux.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/specgen/resources_linux.go')
-rw-r--r--pkg/specgen/resources_linux.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/pkg/specgen/resources_linux.go b/pkg/specgen/resources_linux.go
new file mode 100644
index 000000000..ffa9e5786
--- /dev/null
+++ b/pkg/specgen/resources_linux.go
@@ -0,0 +1,22 @@
+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,
+ }
+ }
+ }
+ }
+}