From 48b92b37acbd2bf9c36ac5e67961b15723243cda Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Tue, 2 Aug 2022 19:49:20 +0100 Subject: core: add basic infrastructure to record unit activation information Not wired in by any unit type yet, just the basic to allocate, ref, deref and plug in to other unit types. Includes recording the trigger unit name and passing it to the triggered unit as TRIGGER_UNIT= env var. --- src/core/dbus-util.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'src/core/dbus-util.c') diff --git a/src/core/dbus-util.c b/src/core/dbus-util.c index 264a4f55b6..edfa0eb69a 100644 --- a/src/core/dbus-util.c +++ b/src/core/dbus-util.c @@ -228,3 +228,35 @@ int bus_read_mount_options( return 0; } + +int bus_property_get_activation_details( + sd_bus *bus, + const char *path, + const char *interface, + const char *property, + sd_bus_message *reply, + void *userdata, + sd_bus_error *error) { + + ActivationDetails **details = ASSERT_PTR(userdata); + _cleanup_strv_free_ char **pairs = NULL; + int r; + + assert(reply); + + r = activation_details_append_pair(*details, &pairs); + if (r < 0) + return r; + + r = sd_bus_message_open_container(reply, 'a', "(ss)"); + if (r < 0) + return r; + + STRV_FOREACH_PAIR(key, value, pairs) { + r = sd_bus_message_append(reply, "(ss)", *key, *value); + if (r < 0) + return r; + } + + return sd_bus_message_close_container(reply); +} -- cgit v1.2.1