spiegel_podman/pkg/specgenutil/pids.go
Jan Rodák 5fa0cb1090
Map pids-limit 0 to unlimited for runc
Docker documents HostConfig.PidsLimit 0 as unlimited, but runc sets
pids.max=1 for OCI pids.limit 0. Normalize 0 to -1 when building the
OCI spec so native CLI, compat API, and kube play behave consistently.

Fixes: https://github.com/podman-container-tools/podman/issues/29826

Signed-off-by: Jan Rodák <hony.com@seznam.cz>
2026-09-23 20:45:45 +02:00

14 lines
436 B
Go

package specgenutil
// PidsLimitForOCI returns the value to store in the OCI runtime spec
// linux.resources.pids.limit field.
//
// Docker documents HostConfig.PidsLimit 0 as unlimited. runc maps OCI limit 0 to
// cgroup pids.max=1, while -1 means unlimited. crun treats 0 as unlimited.
// Normalize 0 to -1 so all runtimes get unlimited pids.
func PidsLimitForOCI(limit int64) int64 {
if limit == 0 {
return -1
}
return limit
}