]> 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 16:21:09 +0000 (09:21 -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>
(cherry picked from commit cfe7354274f1d3de5b7d0d059ab67f217bdc2b3a)

src/tools/cgclassify.c

index d868fec6e28fca3336d8b67d765ceeeb29dca4e6..b9f1f70cdec60456eb1fefeba504f3528ba7d50a 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);