summaryrefslogtreecommitdiffstats
path: root/src/systemctl
diff options
context:
space:
mode:
authorMike Yuan <me@yhndnzj.com>2024-04-16 19:32:27 +0200
committerMike Yuan <me@yhndnzj.com>2024-04-19 04:08:36 +0200
commitad6b84d9601f6009fb7deeaa82e0c0901e511b1e (patch)
tree14dec6bbbd5c69118f3503338b04b0db68f66a23 /src/systemctl
parentsystemctl: use FOREACH_ARRAY and FOREACH_ELEMENT more (diff)
downloadsystemd-ad6b84d9601f6009fb7deeaa82e0c0901e511b1e.tar.xz
systemd-ad6b84d9601f6009fb7deeaa82e0c0901e511b1e.zip
systemctl-start-unit: Subscribe() is unnecessary if we RefUnit explicitly
Subscribe() enables full signal delivery on API bus. But aside from that, if a unit/job is explicitly Ref()'d, manager also emits the signal. See bus_foreach_bus() for details. bus-wait-for-units refs every unit to wait for, so there's no need to Subscribe() on top of that. In verb_clean_or_freeze() Subscribe() is not called either.
Diffstat (limited to 'src/systemctl')
-rw-r--r--src/systemctl/systemctl-start-unit.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/src/systemctl/systemctl-start-unit.c b/src/systemctl/systemctl-start-unit.c
index c1574f019e..8068d77d1c 100644
--- a/src/systemctl/systemctl-start-unit.c
+++ b/src/systemctl/systemctl-start-unit.c
@@ -381,10 +381,6 @@ int verb_start(int argc, char *argv[], void *userdata) {
}
if (arg_wait) {
- r = bus_call_method_async(bus, NULL, bus_systemd_mgr, "Subscribe", NULL, NULL, NULL);
- if (r < 0)
- return log_error_errno(r, "Failed to enable subscription: %m");
-
r = bus_wait_for_units_new(bus, &wu);
if (r < 0)
return log_error_errno(r, "Failed to allocate unit watch context: %m");
@@ -408,7 +404,7 @@ int verb_start(int argc, char *argv[], void *userdata) {
}
if (!arg_no_block) {
- const char* extra_args[4];
+ const char *extra_args[4];
WaitJobsFlags flags = 0;
SET_FLAG(flags, BUS_WAIT_JOBS_LOG_ERROR, !arg_quiet);