Skip to main content

count_cgroup_processes

Function count_cgroup_processes 

Source
pub async fn count_cgroup_processes(fs_root: &str, output: &ListOutput) -> u32
Expand description

Count the processes in a unit’s cgroup, including nested ones.

The D-Bus path counts what GetProcesses returns, and systemd walks the whole subtree there — a service that delegates its cgroup and puts workers in children would be undercounted by reading only its own cgroup.procs. The main PID is folded in the same way systemd does, since it can sit outside the cgroup. fs_root prefixes the cgroup mount for containers.