From 4db4641a65a08173ae8044448e33a50bc517e05b Mon Sep 17 00:00:00 2001 From: Mike Yuan Date: Fri, 11 Jul 2025 21:58:51 +0200 Subject: [PATCH 1/2] core/scope: drop effectively unused unit_watch_pidref() calls Follow-up for 495e75ed5c8cce933947dae10a4a1b5f8067e432 The mentioned commit switched scope unit's "pids" deserialization to call unit_watch_pid() already, meaning all later invocations in scope_coldplug() are no-op. Remove the cruft altogether. --- src/core/scope.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/core/scope.c b/src/core/scope.c index def2039e1a..83b7d2d46f 100644 --- a/src/core/scope.c +++ b/src/core/scope.c @@ -236,15 +236,6 @@ static int scope_coldplug(Unit *u) { if (r < 0) return r; - if (!IN_SET(s->deserialized_state, SCOPE_DEAD, SCOPE_FAILED) && u->pids) { - PidRef *pid; - SET_FOREACH(pid, u->pids) { - r = unit_watch_pidref(u, pid, /* exclusive= */ false); - if (r < 0) - return r; - } - } - bus_scope_track_controller(s); scope_set_state(s, s->deserialized_state); From 66867d5308f80430e465eebc51e22ca98855b431 Mon Sep 17 00:00:00 2001 From: Mike Yuan Date: Fri, 11 Jul 2025 22:19:14 +0200 Subject: [PATCH 2/2] core/scope: serialize_item() is NOP on NULL --- src/core/scope.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/core/scope.c b/src/core/scope.c index 83b7d2d46f..50dafacb42 100644 --- a/src/core/scope.c +++ b/src/core/scope.c @@ -502,8 +502,7 @@ static int scope_serialize(Unit *u, FILE *f, FDSet *fds) { (void) serialize_item(f, "state", scope_state_to_string(s->state)); (void) serialize_bool(f, "was-abandoned", s->was_abandoned); - if (s->controller) - (void) serialize_item(f, "controller", s->controller); + (void) serialize_item(f, "controller", s->controller); SET_FOREACH(pid, u->pids) serialize_pidref(f, fds, "pids", pid);