X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Flibsystemd-bus%2Fbusctl.c;h=b9b3305e93b58f96406475d5da965677789c1fd2;hb=718db96199eb307751264e4163555662c9a389fa;hp=717b91120ee1aea864c92a49ebd6abf2797baf00;hpb=eb9da376d76b48585b3b63b4f91903b54f7abd36;p=elogind.git diff --git a/src/libsystemd-bus/busctl.c b/src/libsystemd-bus/busctl.c index 717b91120..b9b3305e9 100644 --- a/src/libsystemd-bus/busctl.c +++ b/src/libsystemd-bus/busctl.c @@ -31,6 +31,7 @@ #include "bus-message.h" #include "bus-internal.h" #include "bus-util.h" +#include "bus-dump.h" static bool arg_no_pager = false; static char *arg_address = NULL; @@ -70,11 +71,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 +113,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"); } @@ -183,14 +192,14 @@ static int help(void) { "Introspect the bus.\n\n" " -h --help Show this help\n" " --version Show package version\n" + " --no-pager Do not pipe output into a pager\n" " --system Connect to system bus\n" " --user Connect to user bus\n" " -H --host=[USER@]HOST Operate on remote host\n" " -M --machine=CONTAINER Operate on local container\n" " --address=ADDRESS Connect to bus specified by address\n" " --no-unique Only show well-known names\n" - " --match=MATCH Only show matching messages\n" - " --no-pager Do not pipe output into a pager\n\n" + " --match=MATCH Only show matching messages\n\n" "Commands:\n" " list List bus names\n" " monitor [SERVICE...] Show bus traffic\n", @@ -220,6 +229,8 @@ static int parse_argv(int argc, char *argv[]) { { "address", required_argument, NULL, ARG_ADDRESS }, { "no-unique", no_argument, NULL, ARG_NO_UNIQUE }, { "match", required_argument, NULL, ARG_MATCH }, + { "host", required_argument, NULL, 'H' }, + { "machine", required_argument, NULL, 'M' }, {}, };