From: Lennart Poettering Date: Tue, 21 Apr 2020 08:34:05 +0000 (+0200) Subject: tree-wide: implement new log control API dbus interface in all our daemons X-Git-Tag: v246-rc1~532^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ac9f55ed407f2994e22422f39456a2f68027c39a;p=thirdparty%2Fsystemd.git tree-wide: implement new log control API dbus interface in all our daemons --- diff --git a/src/home/homed-manager.c b/src/home/homed-manager.c index 12422bd7338..ed2a54615c6 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 66af1c0b5c1..5b4c74e299d 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 c4e89201694..8977ebd8352 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 3d626f6bcce..7315d93a982 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 8f3708d2a4f..75958189ac8 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 ace2131c2de..a93bfc42be2 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 1348fcb9b3e..31bf02f5002 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 75b76926e55..265f7a7440d 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 bc49da910ea..8e15cd4f06e 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 5a5896f0b77..006800709db 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");