]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
tools/cgclassify: guard systemd default delegate slice
authorKamalesh Babulal <kamalesh.babulal@oracle.com>
Thu, 16 Nov 2023 08:38:03 +0000 (14:08 +0530)
committerTom Hromatka <tom.hromatka@oracle.com>
Thu, 7 Dec 2023 15:58:13 +0000 (08:58 -0700)
Guard setting default systemd delegate slice with WITH_SYSTEMD, to limit
the systemd delegation only to --enable-systemd=yes only.

Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
src/tools/cgclassify.c

index fb5841fea995879dce1e87ad08858ebebb0e68cb..ad3e530bdd703843f6b13b7a93e9a47879a9f7c1 100644 (file)
@@ -135,7 +135,9 @@ static struct option longopts[] = {
 int main(int argc, char *argv[])
 {
        struct cgroup_group_spec *cgroup_list[CG_HIER_MAX];
+#ifdef WITH_SYSTEMD
        int ignore_default_systemd_delegate_slice = 0;
+#endif
        int ret = 0, i, exit_code = 0;
        int skip_replace_idle = 0;
        pid_t scope_pid = -1;
@@ -197,9 +199,10 @@ int main(int argc, char *argv[])
                return ret;
        }
 
-       /* this is false always for disable-systemd */
+#ifdef WITH_SYSTEMD
        if (!ignore_default_systemd_delegate_slice)
                cgroup_set_default_systemd_cgroup();
+#endif
 
        for (i = optind; i < argc; i++) {
                pid = (pid_t) strtol(argv[i], &endptr, 10);