diff options
author | Lennart Poettering <lennart@poettering.net> | 2013-11-11 23:45:36 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2013-11-12 00:12:44 +0100 |
commit | 7b0b392f7bce4bb1b17fec54d1baf27daa85777f (patch) | |
tree | 103137677905841b83262a567be0b178fd689835 | |
parent | 8d162091c0512e0c2bb0e7ac22b927f1f5af95b4 (diff) |
busctl: show machine name of all registered names
-rw-r--r-- | src/libsystemd-bus/busctl.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/libsystemd-bus/busctl.c b/src/libsystemd-bus/busctl.c index 088111cbce..d5ac2fe0f2 100644 --- a/src/libsystemd-bus/busctl.c +++ b/src/libsystemd-bus/busctl.c @@ -70,11 +70,12 @@ static int list_bus_names(sd_bus *bus, char **argv) { STRV_FOREACH(i, l) max_i = MAX(max_i, strlen(*i)); - printf("%-*s %*s %-*s %-*s CONNECTION\n", - (int) max_i, "NAME", 10, "PID", 15, "PROCESS", 16, "USER"); + printf("%-*s %*s %-*s %-*s %-*s MACHINE\n", + (int) max_i, "NAME", 10, "PID", 15, "PROCESS", 16, "USER", 20, "CONNECTION"); STRV_FOREACH(i, l) { _cleanup_free_ char *owner = NULL; + sd_id128_t mid; pid_t pid; uid_t uid; @@ -111,8 +112,15 @@ static int list_bus_names(sd_bus *bus, char **argv) { r = sd_bus_get_owner(bus, *i, &owner); if (r >= 0) - printf(" %s\n", owner); + printf(" %-20s", owner); else + printf(" - "); + + r = sd_bus_get_owner_machine_id(bus, *i, &mid); + if (r >= 0) { + char m[SD_ID128_STRING_MAX]; + printf(" %s\n", sd_id128_to_string(mid, m)); + } else printf(" -\n"); } |