nit: Maybe have this function take the cgroup path and it appends the cgroup file, reads the file, and parses the input. Right now the first two parts are duplicated in systemd and non-systemd sides.