]> git.ipfire.org Git - thirdparty/libcgroup.git/commit
tools/cgget: add support for default systemd delegation slice/scope
authorKamalesh Babulal <kamalesh.babulal@oracle.com>
Fri, 10 Feb 2023 21:48:14 +0000 (14:48 -0700)
committerTom Hromatka <tom.hromatka@oracle.com>
Fri, 10 Feb 2023 21:48:18 +0000 (14:48 -0700)
commitda8c80e68f7b72980c908d4bdce8197dfd909494
tree46e75eff427415c8ca5b263facfae49d81975f8c
parentab305c0881199e5ad9b9f2d1671dbb46600642e0
tools/cgget: add support for default systemd delegation slice/scope

Enhance the cgget tool to support default systemd delegation
slice/scope, if set in the cgconfig.conf's systemd setting.
Parse the configuration file and read the systemd::delegate setting,
if any, and set it as the default systemd slice/scope in
systemd_default_cgroup. Setting it appends the slice/scope name to
the constructed default cgroup mount path.

When the user passes the relative cgroup name, its appends to the
sub-tree (delegated slice/scope) by default and if the user wishes to get
details about the cgroups in another subtree or cgroup root hierarchy,
they need to use the absolute path. For example:
  cgroup_root
 /     \
/      \
 systemd.slice[1]      cgrp1
|
 systemd.scope
|
    cgrp-d1

[1] default systemd delegation slice/scope - read from cgconfig.conf

$ sudo cgget -g cpu:cgrp-d1

will display the CPU controller information under the
cgroup_root:systemd_default_cgroup:cgrp-d1

and for viewing the CPU controller information of cgrp1, the user can
use:
$ sudo cgget -g cpu:/cgrp1

or use the newly introduced -b switch to ignore the systemd slice/scope:
$ sudo cgget -b -g cpu:cgrp

Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
TJH: Fix minor typo in a comment where delegate was written instead
     of setdefault
(cherry picked from commit aa9c756add6f1ca9b61cb54ce1334d6b0be745b9)
src/tools/cgget.c