summaryrefslogtreecommitdiff
path: root/src/shared/bus-util.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2020-04-23 12:46:23 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2020-05-05 22:36:38 +0200
commit8b4933973eada07454816853d9b7cdb48e7f306a (patch)
tree0e1d7b96e9d82eb0496f5057cb8d4ed053497a8b /src/shared/bus-util.c
parent8d1280897bb63c529fdf8b3a19c09f75afbc7993 (diff)
downloadsystemd-8b4933973eada07454816853d9b7cdb48e7f306a.tar.gz
bus-introspect: list the interfaces with "list"
The output is not very well formatted, but it is still useful when testing this.
Diffstat (limited to 'src/shared/bus-util.c')
-rw-r--r--src/shared/bus-util.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c
index 4214aa340e..df701a3bfe 100644
--- a/src/shared/bus-util.c
+++ b/src/shared/bus-util.c
@@ -1638,6 +1638,17 @@ static int bus_introspect_implementation(
return 0;
}
+static void list_paths(
+ FILE *out,
+ const BusObjectImplementation* const* bus_objects) {
+
+ for (size_t i = 0; bus_objects[i]; i++) {
+ fprintf(out, "%s\t%s\n", bus_objects[i]->path, bus_objects[i]->interface);
+ if (bus_objects[i]->children)
+ list_paths(out, bus_objects[i]->children);
+ }
+}
+
int bus_introspect_implementations(
FILE *out,
const char *pattern,
@@ -1647,6 +1658,11 @@ int bus_introspect_implementations(
_cleanup_free_ char *s = NULL;
int r;
+ if (streq(pattern, "list")) {
+ list_paths(out, bus_objects);
+ return 0;
+ }
+
struct introspect intro = {};
bool is_interface = interface_name_is_valid(pattern);