summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2017-12-18 22:10:11 +0100
committerLennart Poettering <lennart@poettering.net>2018-01-05 13:58:32 +0100
commit0c0b9306470baa9498900bc7b46149d4a9d06738 (patch)
treebaf2afd39d5430f188bbb695e31fbd6b8ce1a809 /src
parentsd-bus: when disconnecting a slot, also reset its memory (diff)
downloadsystemd-0c0b9306470baa9498900bc7b46149d4a9d06738.tar.xz
systemd-0c0b9306470baa9498900bc7b46149d4a9d06738.zip
tree-wide: make name requesting asynchronous in all our services
This optimizes service startup a bit, and makes it less prone to deadlocks.
Diffstat (limited to 'src')
-rw-r--r--src/core/dbus.c12
-rw-r--r--src/hostname/hostnamed.c4
-rw-r--r--src/import/importd.c4
-rw-r--r--src/locale/localed.c4
-rw-r--r--src/login/logind.c4
-rw-r--r--src/machine/machined.c4
-rw-r--r--src/network/networkd-manager.c4
-rw-r--r--src/resolve/resolved-bus.c4
-rw-r--r--src/timedate/timedated.c4
9 files changed, 21 insertions, 23 deletions
diff --git a/src/core/dbus.c b/src/core/dbus.c
index 115d071eb4..5dc019fae1 100644
--- a/src/core/dbus.c
+++ b/src/core/dbus.c
@@ -826,14 +826,12 @@ static int bus_setup_api(Manager *m, sd_bus *bus) {
if (r < 0)
log_warning_errno(r, "Failed to subscribe to activation signal: %m");
- /* Allow replacing of our name, to ease implementation of
- * reexecution, where we keep the old connection open until
- * after the new connection is set up and the name installed
- * to allow clients to synchronously wait for reexecution to
- * finish */
- r = sd_bus_request_name(bus,"org.freedesktop.systemd1", SD_BUS_NAME_REPLACE_EXISTING|SD_BUS_NAME_ALLOW_REPLACEMENT);
+ /* Allow replacing of our name, to ease implementation of reexecution, where we keep the old connection open
+ * until after the new connection is set up and the name installed to allow clients to synchronously wait for
+ * reexecution to finish */
+ r = sd_bus_request_name_async(bus, NULL, "org.freedesktop.systemd1", SD_BUS_NAME_REPLACE_EXISTING|SD_BUS_NAME_ALLOW_REPLACEMENT, NULL, NULL);
if (r < 0)
- return log_error_errno(r, "Failed to register name: %m");
+ return log_error_errno(r, "Failed to request name: %m");
r = manager_sync_bus_names(m, bus);
if (r < 0)
diff --git a/src/hostname/hostnamed.c b/src/hostname/hostnamed.c
index 5feaa60c99..1c8c76934c 100644
--- a/src/hostname/hostnamed.c
+++ b/src/hostname/hostnamed.c
@@ -680,9 +680,9 @@ static int connect_bus(Context *c, sd_event *event, sd_bus **_bus) {
if (r < 0)
return log_error_errno(r, "Failed to register object: %m");
- r = sd_bus_request_name(bus, "org.freedesktop.hostname1", 0);
+ r = sd_bus_request_name_async(bus, NULL, "org.freedesktop.hostname1", 0, NULL, NULL);
if (r < 0)
- return log_error_errno(r, "Failed to register name: %m");
+ return log_error_errno(r, "Failed to request name: %m");
r = sd_bus_attach_event(bus, event, 0);
if (r < 0)
diff --git a/src/import/importd.c b/src/import/importd.c
index 21af09fc45..98ee1a2fab 100644
--- a/src/import/importd.c
+++ b/src/import/importd.c
@@ -1149,9 +1149,9 @@ static int manager_add_bus_objects(Manager *m) {
if (r < 0)
return log_error_errno(r, "Failed to add transfer enumerator: %m");
- r = sd_bus_request_name(m->bus, "org.freedesktop.import1", 0);
+ r = sd_bus_request_name_async(m->bus, NULL, "org.freedesktop.import1", 0, NULL, NULL);
if (r < 0)
- return log_error_errno(r, "Failed to register name: %m");
+ return log_error_errno(r, "Failed to request name: %m");
r = sd_bus_attach_event(m->bus, m->event, 0);
if (r < 0)
diff --git a/src/locale/localed.c b/src/locale/localed.c
index 3e3f03e046..02f5e8c656 100644
--- a/src/locale/localed.c
+++ b/src/locale/localed.c
@@ -652,9 +652,9 @@ static int connect_bus(Context *c, sd_event *event, sd_bus **_bus) {
if (r < 0)
return log_error_errno(r, "Failed to register object: %m");
- r = sd_bus_request_name(bus, "org.freedesktop.locale1", 0);
+ r = sd_bus_request_name_async(bus, NULL, "org.freedesktop.locale1", 0, NULL, NULL);
if (r < 0)
- return log_error_errno(r, "Failed to register name: %m");
+ return log_error_errno(r, "Failed to request name: %m");
r = sd_bus_attach_event(bus, event, 0);
if (r < 0)
diff --git a/src/login/logind.c b/src/login/logind.c
index 49ca367e18..3e4b2fc350 100644
--- a/src/login/logind.c
+++ b/src/login/logind.c
@@ -752,9 +752,9 @@ static int manager_connect_bus(Manager *m) {
return r;
}
- r = sd_bus_request_name(m->bus, "org.freedesktop.login1", 0);
+ r = sd_bus_request_name_async(m->bus, NULL, "org.freedesktop.login1", 0, NULL, NULL);
if (r < 0)
- return log_error_errno(r, "Failed to register name: %m");
+ return log_error_errno(r, "Failed to request name: %m");
r = sd_bus_attach_event(m->bus, m->event, SD_EVENT_PRIORITY_NORMAL);
if (r < 0)
diff --git a/src/machine/machined.c b/src/machine/machined.c
index b5cb863e5d..9ef121fe66 100644
--- a/src/machine/machined.c
+++ b/src/machine/machined.c
@@ -277,9 +277,9 @@ static int manager_connect_bus(Manager *m) {
return r;
}
- r = sd_bus_request_name(m->bus, "org.freedesktop.machine1", 0);
+ r = sd_bus_request_name_async(m->bus, NULL, "org.freedesktop.machine1", 0, NULL, NULL);
if (r < 0)
- return log_error_errno(r, "Failed to register name: %m");
+ return log_error_errno(r, "Failed to request name: %m");
r = sd_bus_attach_event(m->bus, m->event, 0);
if (r < 0)
diff --git a/src/network/networkd-manager.c b/src/network/networkd-manager.c
index e3c514c804..836f58c78c 100644
--- a/src/network/networkd-manager.c
+++ b/src/network/networkd-manager.c
@@ -183,9 +183,9 @@ int manager_connect_bus(Manager *m) {
if (r < 0)
return log_error_errno(r, "Failed to add network enumerator: %m");
- r = sd_bus_request_name(m->bus, "org.freedesktop.network1", 0);
+ r = sd_bus_request_name_async(m->bus, NULL, "org.freedesktop.network1", 0, NULL, NULL);
if (r < 0)
- return log_error_errno(r, "Failed to register name: %m");
+ return log_error_errno(r, "Failed to request name: %m");
r = sd_bus_attach_event(m->bus, m->event, 0);
if (r < 0)
diff --git a/src/resolve/resolved-bus.c b/src/resolve/resolved-bus.c
index 9157d9ea68..5a93f89467 100644
--- a/src/resolve/resolved-bus.c
+++ b/src/resolve/resolved-bus.c
@@ -1921,9 +1921,9 @@ int manager_connect_bus(Manager *m) {
if (r < 0)
return log_error_errno(r, "Failed to register dnssd enumerator: %m");
- r = sd_bus_request_name(m->bus, "org.freedesktop.resolve1", 0);
+ r = sd_bus_request_name_async(m->bus, NULL, "org.freedesktop.resolve1", 0, NULL, NULL);
if (r < 0)
- return log_error_errno(r, "Failed to register name: %m");
+ return log_error_errno(r, "Failed to request name: %m");
r = sd_bus_attach_event(m->bus, m->event, 0);
if (r < 0)
diff --git a/src/timedate/timedated.c b/src/timedate/timedated.c
index a55a929a49..822835cce9 100644
--- a/src/timedate/timedated.c
+++ b/src/timedate/timedated.c
@@ -675,9 +675,9 @@ static int connect_bus(Context *c, sd_event *event, sd_bus **_bus) {
if (r < 0)
return log_error_errno(r, "Failed to register object: %m");
- r = sd_bus_request_name(bus, "org.freedesktop.timedate1", 0);
+ r = sd_bus_request_name_async(bus, NULL, "org.freedesktop.timedate1", 0, NULL, NULL);
if (r < 0)
- return log_error_errno(r, "Failed to register name: %m");
+ return log_error_errno(r, "Failed to request name: %m");
r = sd_bus_attach_event(bus, event, 0);
if (r < 0)