summaryrefslogtreecommitdiff
path: root/src/libsystemd/sd-bus
diff options
context:
space:
mode:
Diffstat (limited to 'src/libsystemd/sd-bus')
-rw-r--r--src/libsystemd/sd-bus/busctl.c8
-rw-r--r--src/libsystemd/sd-bus/sd-bus.c22
2 files changed, 24 insertions, 6 deletions
diff --git a/src/libsystemd/sd-bus/busctl.c b/src/libsystemd/sd-bus/busctl.c
index f75a9dcbd3..1ba4e8adac 100644
--- a/src/libsystemd/sd-bus/busctl.c
+++ b/src/libsystemd/sd-bus/busctl.c
@@ -1176,12 +1176,16 @@ static int status(sd_bus *bus, char *argv[]) {
pid,
_SD_BUS_CREDS_ALL);
} else {
- const char *scope;
+ const char *scope, *address;
sd_id128_t bus_id;
+ r = sd_bus_get_address(bus, &address);
+ if (r >= 0)
+ printf("BusAddress=%s%s%s\n", ansi_highlight(), address, ansi_highlight_off());
+
r = sd_bus_get_scope(bus, &scope);
if (r >= 0)
- printf("Scope=%s%s%s\n", ansi_highlight(), scope, ansi_highlight_off());
+ printf("BusScope=%s%s%s\n", ansi_highlight(), scope, ansi_highlight_off());
r = sd_bus_get_bus_id(bus, &bus_id);
if (r >= 0)
diff --git a/src/libsystemd/sd-bus/sd-bus.c b/src/libsystemd/sd-bus/sd-bus.c
index 5947cd72c9..6b35036c06 100644
--- a/src/libsystemd/sd-bus/sd-bus.c
+++ b/src/libsystemd/sd-bus/sd-bus.c
@@ -3396,24 +3396,38 @@ _public_ int sd_bus_get_scope(sd_bus *bus, const char **scope) {
if (streq(n, "0-system")) {
*scope = "system";
- return 1;
+ return 0;
}
dash = strchr(n, '-');
if (streq(dash, "-user")) {
*scope = "user";
- return 1;
+ return 0;
}
}
if (bus->is_user) {
*scope = "user";
- return 1;
+ return 0;
}
if (bus->is_system) {
*scope = "system";
- return 1;
+ return 0;
+ }
+
+ return -ENODATA;
+}
+
+_public_ int sd_bus_get_address(sd_bus *bus, const char **address) {
+
+ assert_return(bus, -EINVAL);
+ assert_return(address, -EINVAL);
+ assert_return(!bus_pid_changed(bus), -ECHILD);
+
+ if (bus->address) {
+ *address = bus->address;
+ return 0;
}
return -ENODATA;