summaryrefslogtreecommitdiff
path: root/src/core/dbus-util.c
diff options
context:
space:
mode:
authorLuca Boccassi <bluca@debian.org>2022-08-02 19:49:20 +0100
committerLuca Boccassi <bluca@debian.org>2022-08-23 20:38:08 +0100
commit48b92b37acbd2bf9c36ac5e67961b15723243cda (patch)
treec9264b37c5d949b8e35d8219fb3eac426cf16f54 /src/core/dbus-util.c
parentf52faaf923acfe6fe3f0955d1ad66840b13babfc (diff)
downloadsystemd-48b92b37acbd2bf9c36ac5e67961b15723243cda.tar.gz
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.
Diffstat (limited to 'src/core/dbus-util.c')
-rw-r--r--src/core/dbus-util.c32
1 files changed, 32 insertions, 0 deletions
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);
+}