Skip to main content

build_cgroup_functions_snippet

Function build_cgroup_functions_snippet 

Source
pub fn build_cgroup_functions_snippet() -> String
Expand description

Shell functions shared by the sampler and its final read:

__start_command_cgroup_dir NAME  print the container's cgroup v2 directory
__start_command_cgroup_read DIR  print `<max> <peak> <oom> <oom_kill> DIR`

The directory comes from /proc/<.State.Pid>/cgroup (0::<path>), which covers the systemd and cgroupfs drivers, --cgroup-parent and rootless docker alike; the two default layouts are fallbacks. A candidate must name the container ID, so a PID reported by a remote daemon can never select an unrelated local cgroup. START_COMMAND_CGROUP_ROOT and START_COMMAND_PROC_ROOT replace /sys/fs/cgroup and /proc (tests).