KTSTR_CGROUP_WALK_ROOT_ENV

Constant KTSTR_CGROUP_WALK_ROOT_ENV 

Source
pub const KTSTR_CGROUP_WALK_ROOT_ENV: &str = "KTSTR_CGROUP_WALK_ROOT";
Expand description

Name of the environment variable that overrides the cgroup-fs root crate::cgroup::CgroupManager::setup walks down from when enabling controllers in every ancestor’s cgroup.subtree_control. Empty / unset falls back to /sys/fs/cgroup (the canonical cgroup-v2 mount). Non-empty value must be a prefix of KTSTR_HOST_CGROUP_PARENT_ENV’s configured parent so the walk stays inside the directory the operator owns; values that do not satisfy the prefix invariant are rejected upfront by crate::cgroup::CgroupManager::with_walk_root.

Exists for cgroup-v2 user delegation (Mode B/C: systemd Delegate=yes, container nsdelegate): the operator owns subtree_control writes only inside the delegated subtree, and a blind walk from /sys/fs/cgroup down would EACCES at the user.slice / container-root boundary. Setting the walk root to the delegation boundary makes the setup-time controller-enable walk stop there.

§Empty-string contract

Empty string is observationally identical to unset: both fall back to /sys/fs/cgroup (the crate::cgroup::CgroupManager::new default). This mirrors the sibling env vars; a shell that exports KTSTR_CGROUP_WALK_ROOT= (without a value) explicitly opts back into the default rather than passing an empty path down to crate::cgroup::CgroupManager::with_walk_root (which would always fail the prefix invariant).

Single source of truth so the name is not spelled by hand at each reader. Mirrors the sibling KTSTR_HOST_CGROUP_PARENT_ENV constant-defined naming convention; a single grep across KTSTR_*_ENV consts gives the operator the complete env-var inventory.

Read by crate::test_support::dispatch::resolve_host_cgroup_parent.