From 00b495a85b1088490d5757b38ed0528c158d433d Mon Sep 17 00:00:00 2001
From: Mike Yuan <me@yhndnzj.com>
Date: Sat, 15 Jun 2024 13:15:08 +0200
Subject: [PATCH 0771/1160] core/cgroup: make unit_has_host_root_cgroup take
 const Unit*

(cherry picked from commit 4442aef08e0fe8ba381b580455f7eb281c5a28a1)
(cherry picked from commit 06c2ee39799064a82d2af1bee7a5c72ebdd66090)
---
 src/core/cgroup.c | 3 ++-
 src/core/cgroup.h | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/core/cgroup.c b/src/core/cgroup.c
index 03d6ec9c6f..61539afdbf 100644
--- a/src/core/cgroup.c
+++ b/src/core/cgroup.c
@@ -100,8 +100,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. */
diff --git a/src/core/cgroup.h b/src/core/cgroup.h
index f1b674b4b7..4ef2d92364 100644
--- a/src/core/cgroup.h
+++ b/src/core/cgroup.h
@@ -389,7 +389,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);
 
-- 
2.33.0