Skip to main content

Module cgroup

Module cgroup 

Source
Expand description

cgroup — Namespace and cgroup resource-isolation primitives.

This slice’s concrete target: resolving the real cgroup path of an already-running process on the host, by pid — filling principal::ContainerRef::cgroup, which is unconditionally None until something actually resolves it. lifecycle::Lifecycle::container_ref is the caller that wires this in for a real dockerd container.

Scope boundary (hard constraint, same as every substrate-kit module): this is OS mechanics only. It resolves what a cgroup path is, never why a cgroup limit is set to a given value or who should be allowed to see/change it — that’s an authorization/policy question for identity-kit to answer, not this crate. See principal.rs’s module doc for the full hard-constraint statement.

Known limitation, not an oversight: this resolver only understands the cgroup v2 unified hierarchy (/proc/<pid>/cgroup’s 0::<path> line), matching the target hosts (dockerd with the systemd cgroup driver defaults to cgroup v2 on any reasonably current kernel). A cgroup v1 or hybrid host — no 0:: line present — resolves to SubstrateError::Resolve rather than guessing at a v1 controller hierarchy; broader support is real follow-up work if a v1 host ever needs to run this substrate.

Full namespace/cgroup isolation primitives (creating/limiting a cgroup, not just reading one back) remain deferred; resource limits on a container are not yet part of lifecycle::ContainerSpec either.

Constants§

CGROUP_V2_MOUNT
The cgroup v2 unified hierarchy’s standard mount point. Universal on every distro this substrate targets — not configurable here because none of its target hosts mounts cgroup v2 anywhere else.

Functions§

resolve_cgroup_path
Resolve the real, absolute cgroup v2 path for a running process on the host, by pid.