pub fn cpu_max_to_write(
spec_limits: Option<&RunLimits>,
env_cpu_max: Option<&str>,
) -> Option<String>Expand description
Resolve the cpu.max payload for the host-subprocess cgroup leaf.
Resolution order (highest priority first):
spec.run.limits.cpuMax— typed source of truth from the contract.env_cpu_max— operator-suppliedCELLOS_CGROUP_CPU_MAXoverride; used only when the spec is silent. The caller passes the env value verbatim (orNonewhen unset / empty); validation/normalization happens here.
Returns Some(payload) when a value should be written to the leaf’s
cpu.max file (without a trailing newline; the writer adds one). Returns
None when neither source produced an applicable value, or when the env
override was syntactically invalid (caller should warn — see
cpu_max_env_validation_error for the diagnostic string).
Accepted env-override syntaxes (per cgroup v2 cpu.max):
max→"max 100000"max <period>→"max <period>"<quota>→"<quota> 100000"<quota> <period>→"<quota> <period>"
Whitespace is collapsed; quota and period must parse as u64 and be
>= 1 (cgroup v2 rejects 0). Anything else returns None here and the
caller is expected to log a warning.