From ac9f55ed407f2994e22422f39456a2f68027c39a Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 21 Apr 2020 10:34:05 +0200 Subject: [PATCH] tree-wide: implement new log control API dbus interface in all our daemons --- src/home/homed-manager.c | 5 +++++ src/hostname/hostnamed.c | 5 +++++ src/import/importd.c | 5 +++++ src/locale/localed.c | 5 +++++ src/login/logind.c | 5 +++++ src/machine/machined.c | 5 +++++ src/network/networkd-manager.c | 5 +++++ src/portable/portabled.c | 5 +++++ src/timedate/timedated.c | 5 +++++ src/timesync/timesyncd-bus.c | 5 +++++ 10 files changed, 50 insertions(+) diff --git a/src/home/homed-manager.c b/src/home/homed-manager.c index 12422bd733..ed2a54615c 100644 --- a/src/home/homed-manager.c +++ b/src/home/homed-manager.c @@ -12,6 +12,7 @@ #include "btrfs-util.h" #include "bus-common-errors.h" #include "bus-error.h" +#include "bus-log-control-api.h" #include "bus-polkit.h" #include "clean-ipc.h" #include "conf-files.h" @@ -894,6 +895,10 @@ static int manager_connect_bus(Manager *m) { if (r < 0) return log_error_errno(r, "Failed to add object manager: %m"); + r = bus_log_control_api_register(m->bus); + if (r < 0) + return r; + r = sd_bus_request_name_async(m->bus, NULL, "org.freedesktop.home1", 0, NULL, NULL); if (r < 0) return log_error_errno(r, "Failed to request name: %m"); diff --git a/src/hostname/hostnamed.c b/src/hostname/hostnamed.c index 66af1c0b5c..5b4c74e299 100644 --- a/src/hostname/hostnamed.c +++ b/src/hostname/hostnamed.c @@ -8,6 +8,7 @@ #include "alloc-util.h" #include "bus-common-errors.h" +#include "bus-log-control-api.h" #include "bus-polkit.h" #include "def.h" #include "env-file-label.h" @@ -754,6 +755,10 @@ 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 = bus_log_control_api_register(bus); + if (r < 0) + return r; + r = sd_bus_request_name_async(bus, NULL, "org.freedesktop.hostname1", 0, NULL, NULL); if (r < 0) return log_error_errno(r, "Failed to request name: %m"); diff --git a/src/import/importd.c b/src/import/importd.c index c4e8920169..8977ebd835 100644 --- a/src/import/importd.c +++ b/src/import/importd.c @@ -7,6 +7,7 @@ #include "alloc-util.h" #include "bus-common-errors.h" +#include "bus-log-control-api.h" #include "bus-polkit.h" #include "def.h" #include "fd-util.h" @@ -1308,6 +1309,10 @@ static int manager_add_bus_objects(Manager *m) { if (r < 0) return log_error_errno(r, "Failed to add transfer enumerator: %m"); + r = bus_log_control_api_register(m->bus); + if (r < 0) + return r; + 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 request name: %m"); diff --git a/src/locale/localed.c b/src/locale/localed.c index 3d626f6bcc..7315d93a98 100644 --- a/src/locale/localed.c +++ b/src/locale/localed.c @@ -14,6 +14,7 @@ #include "alloc-util.h" #include "bus-error.h" +#include "bus-log-control-api.h" #include "bus-message.h" #include "bus-polkit.h" #include "def.h" @@ -724,6 +725,10 @@ 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 = bus_log_control_api_register(bus); + if (r < 0) + return r; + r = sd_bus_request_name_async(bus, NULL, "org.freedesktop.locale1", 0, NULL, NULL); if (r < 0) return log_error_errno(r, "Failed to request name: %m"); diff --git a/src/login/logind.c b/src/login/logind.c index 8f3708d2a4..75958189ac 100644 --- a/src/login/logind.c +++ b/src/login/logind.c @@ -9,6 +9,7 @@ #include "alloc-util.h" #include "bus-error.h" +#include "bus-log-control-api.h" #include "bus-polkit.h" #include "cgroup-util.h" #include "def.h" @@ -706,6 +707,10 @@ static int manager_connect_bus(Manager *m) { if (r < 0) return log_error_errno(r, "Failed to enable subscription: %m"); + r = bus_log_control_api_register(m->bus); + if (r < 0) + return r; + 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 request name: %m"); diff --git a/src/machine/machined.c b/src/machine/machined.c index ace2131c2d..a93bfc42be 100644 --- a/src/machine/machined.c +++ b/src/machine/machined.c @@ -10,6 +10,7 @@ #include "alloc-util.h" #include "bus-error.h" +#include "bus-log-control-api.h" #include "bus-polkit.h" #include "cgroup-util.h" #include "dirent-util.h" @@ -263,6 +264,10 @@ static int manager_connect_bus(Manager *m) { if (r < 0) return log_error_errno(r, "Failed to enable subscription: %m"); + r = bus_log_control_api_register(m->bus); + if (r < 0) + return r; + 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 request name: %m"); diff --git a/src/network/networkd-manager.c b/src/network/networkd-manager.c index 1348fcb9b3..31bf02f500 100644 --- a/src/network/networkd-manager.c +++ b/src/network/networkd-manager.c @@ -11,6 +11,7 @@ #include "sd-netlink.h" #include "alloc-util.h" +#include "bus-log-control-api.h" #include "bus-polkit.h" #include "bus-util.h" #include "conf-parser.h" @@ -165,6 +166,10 @@ int manager_connect_bus(Manager *m) { if (r < 0) return log_error_errno(r, "Failed to add network enumerator: %m"); + r = bus_log_control_api_register(m->bus); + if (r < 0) + return r; + 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 request name: %m"); diff --git a/src/portable/portabled.c b/src/portable/portabled.c index 75b76926e5..265f7a7440 100644 --- a/src/portable/portabled.c +++ b/src/portable/portabled.c @@ -7,6 +7,7 @@ #include "sd-daemon.h" #include "alloc-util.h" +#include "bus-log-control-api.h" #include "bus-polkit.h" #include "def.h" #include "main-func.h" @@ -84,6 +85,10 @@ static int manager_connect_bus(Manager *m) { if (r < 0) return log_error_errno(r, "Failed to add image enumerator: %m"); + r = bus_log_control_api_register(m->bus); + if (r < 0) + return r; + r = sd_bus_request_name_async(m->bus, NULL, "org.freedesktop.portable1", 0, NULL, NULL); if (r < 0) return log_error_errno(r, "Failed to request name: %m"); diff --git a/src/timedate/timedated.c b/src/timedate/timedated.c index bc49da910e..8e15cd4f06 100644 --- a/src/timedate/timedated.c +++ b/src/timedate/timedated.c @@ -12,6 +12,7 @@ #include "alloc-util.h" #include "bus-common-errors.h" #include "bus-error.h" +#include "bus-log-control-api.h" #include "bus-polkit.h" #include "clock-util.h" #include "conf-files.h" @@ -1100,6 +1101,10 @@ 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 = bus_log_control_api_register(bus); + if (r < 0) + return r; + r = sd_bus_request_name_async(bus, NULL, "org.freedesktop.timedate1", 0, NULL, NULL); if (r < 0) return log_error_errno(r, "Failed to request name: %m"); diff --git a/src/timesync/timesyncd-bus.c b/src/timesync/timesyncd-bus.c index 5a5896f0b7..006800709d 100644 --- a/src/timesync/timesyncd-bus.c +++ b/src/timesync/timesyncd-bus.c @@ -4,6 +4,7 @@ #include "alloc-util.h" #include "bus-internal.h" +#include "bus-log-control-api.h" #include "bus-protocol.h" #include "bus-util.h" #include "in-addr-util.h" @@ -189,6 +190,10 @@ int manager_connect_bus(Manager *m) { if (r < 0) return log_error_errno(r, "Failed to add manager object vtable: %m"); + r = bus_log_control_api_register(m->bus); + if (r < 0) + return r; + r = sd_bus_request_name_async(m->bus, NULL, "org.freedesktop.timesync1", 0, NULL, NULL); if (r < 0) return log_error_errno(r, "Failed to request name: %m");