core/cgroup: make unit_has_host_root_cgroup take const Unit*
authorMike Yuan <me@yhndnzj.com>
Sat, 15 Jun 2024 11:15:08 +0000 (13:15 +0200)
committerLuca Boccassi <luca.boccassi@gmail.com>
Fri, 19 Jul 2024 22:33:14 +0000 (00:33 +0200)
(cherry picked from commit 4442aef08e0fe8ba381b580455f7eb281c5a28a1)

src/core/cgroup.c
src/core/cgroup.h

index 0c3a9532bd66792b9fc0db6bee04416e15c4b9ba..83296f9e52bae5166c622a3178eb2c10024fac50 100644 (file)
@@ -102,8 +102,9 @@ bool unit_has_startup_cgroup_constraints(Unit *u) {
                c->startup_memory_low_set;
 }
 
-bool unit_has_host_root_cgroup(Unit *u) {
+bool unit_has_host_root_cgroup(const Unit *u) {
         assert(u);
+        assert(u->manager);
 
         /* Returns whether this unit manages the root cgroup. This will return true if this unit is the root slice and
          * the manager manages the root cgroup. */
index d0cdb9623df7942b1c4b699271fa38ca5ef65c7d..5170c7b21f5383f38ca445d6a779134e845c4302 100644 (file)
@@ -495,7 +495,7 @@ int unit_reset_accounting(Unit *u);
         })
 
 bool manager_owns_host_root_cgroup(Manager *m);
-bool unit_has_host_root_cgroup(Unit *u);
+bool unit_has_host_root_cgroup(const Unit *u);
 
 bool unit_has_startup_cgroup_constraints(Unit *u);