summaryrefslogtreecommitdiff
path: root/src/run
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2017-12-19 12:29:04 +0100
committerLennart Poettering <lennart@poettering.net>2018-01-05 13:58:32 +0100
commit75152a4d6aedbfd3ee8b2d5782b9edf27407622a (patch)
tree5eebf8a41515cd24ccba533132b237893ee0827f /src/run
parent0c0b9306470baa9498900bc7b46149d4a9d06738 (diff)
downloadsystemd-75152a4d6aedbfd3ee8b2d5782b9edf27407622a.tar.gz
tree-wide: install matches asynchronously
Let's remove a number of synchronization points from our service startups: let's drop synchronous match installation, and let's opt for asynchronous instead. Also, let's use sd_bus_match_signal() instead of sd_bus_add_match() where we can.
Diffstat (limited to 'src/run')
-rw-r--r--src/run/run.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/run/run.c b/src/run/run.c
index 0ff8db6b3e..a30501169c 100644
--- a/src/run/run.c
+++ b/src/run/run.c
@@ -1059,7 +1059,6 @@ static int start_transient_service(
.inactive_enter_usec = USEC_INFINITY,
};
_cleanup_free_ char *path = NULL;
- const char *mt;
c.bus = sd_bus_ref(bus);
@@ -1089,18 +1088,20 @@ static int start_transient_service(
if (!path)
return log_oom();
- mt = strjoina("type='signal',"
- "sender='org.freedesktop.systemd1',"
- "path='", path, "',"
- "interface='org.freedesktop.DBus.Properties',"
- "member='PropertiesChanged'");
- r = sd_bus_add_match(bus, &c.match, mt, on_properties_changed, &c);
+ r = sd_bus_match_signal_async(
+ bus,
+ &c.match,
+ "org.freedesktop.systemd1",
+ path,
+ "org.freedesktop.DBus.Properties",
+ "PropertiesChanged",
+ on_properties_changed, NULL, &c);
if (r < 0)
- return log_error_errno(r, "Failed to add properties changed signal.");
+ return log_error_errno(r, "Failed to request properties changed signal match: %m");
r = sd_bus_attach_event(bus, c.event, SD_EVENT_PRIORITY_NORMAL);
if (r < 0)
- return log_error_errno(r, "Failed to attach bus to event loop.");
+ return log_error_errno(r, "Failed to attach bus to event loop: %m");
r = run_context_update(&c, path);
if (r < 0)