summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2020-04-21 10:43:32 +0200
committerLennart Poettering <lennart@poettering.net>2020-04-21 17:08:23 +0200
commit893f801d673fab291b35bae1b6849d27ef848e64 (patch)
treeb53de2466ef4f4f026b2a85da6f89b1f9455d513 /src
parentcore: use generic implementations of log level/target bus propertier getters (diff)
downloadsystemd-893f801d673fab291b35bae1b6849d27ef848e64.tar.xz
systemd-893f801d673fab291b35bae1b6849d27ef848e64.zip
core: implement generic log control API in PID1 too
It has slightly different setters in place, so it needs some special love, which is easy enough though.
Diffstat (limited to 'src')
-rw-r--r--src/core/dbus-manager.c15
-rw-r--r--src/core/dbus-manager.h1
-rw-r--r--src/core/dbus.c4
3 files changed, 20 insertions, 0 deletions
diff --git a/src/core/dbus-manager.c b/src/core/dbus-manager.c
index 08f13a63a1..5f862e47fd 100644
--- a/src/core/dbus-manager.c
+++ b/src/core/dbus-manager.c
@@ -3022,6 +3022,21 @@ const sd_bus_vtable bus_manager_vtable[] = {
SD_BUS_VTABLE_END
};
+const sd_bus_vtable bus_manager_log_control_vtable[] = {
+ SD_BUS_VTABLE_START(0),
+
+ /* We define a private version of this interface here, since we want slightly different
+ * implementations for the setters. We'll still use the generic getters however, and we share the
+ * setters with the implementations for the Manager interface above (which pre-dates the generic
+ * service API interface). */
+
+ SD_BUS_WRITABLE_PROPERTY("LogLevel", "s", bus_property_get_log_level, property_set_log_level, 0, 0),
+ SD_BUS_WRITABLE_PROPERTY("LogTarget", "s", bus_property_get_log_target, property_set_log_target, 0, 0),
+ SD_BUS_PROPERTY("SyslogIdentifier", "s", bus_property_get_syslog_identifier, 0, 0),
+
+ SD_BUS_VTABLE_END,
+};
+
static int send_finished(sd_bus *bus, void *userdata) {
_cleanup_(sd_bus_message_unrefp) sd_bus_message *message = NULL;
usec_t *times = userdata;
diff --git a/src/core/dbus-manager.h b/src/core/dbus-manager.h
index 10aa2eccee..83854b0f59 100644
--- a/src/core/dbus-manager.h
+++ b/src/core/dbus-manager.h
@@ -6,6 +6,7 @@
#include "manager.h"
extern const sd_bus_vtable bus_manager_vtable[];
+extern const sd_bus_vtable bus_manager_log_control_vtable[];
void bus_manager_send_finished(Manager *m, usec_t firmware_usec, usec_t loader_usec, usec_t kernel_usec, usec_t initrd_usec, usec_t userspace_usec, usec_t total_usec);
void bus_manager_send_reloading(Manager *m, bool active);
diff --git a/src/core/dbus.c b/src/core/dbus.c
index 50155f22c6..fd6753b93d 100644
--- a/src/core/dbus.c
+++ b/src/core/dbus.c
@@ -539,6 +539,10 @@ static int bus_setup_api_vtables(Manager *m, sd_bus *bus) {
if (r < 0)
return log_error_errno(r, "Failed to register Manager vtable: %m");
+ r = sd_bus_add_object_vtable(bus, NULL, "/org/freedesktop/LogControl1", "org.freedesktop.LogControl1", bus_manager_log_control_vtable, m);
+ if (r < 0)
+ return log_error_errno(r, "Failed to register service API vtable: %m");
+
r = sd_bus_add_fallback_vtable(bus, NULL, "/org/freedesktop/systemd1/job", "org.freedesktop.systemd1.Job", bus_job_vtable, bus_job_find, m);
if (r < 0)
return log_error_errno(r, "Failed to register Job vtable: %m");