diff options
author | Lennart Poettering <lennart@poettering.net> | 2014-01-22 18:43:03 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2014-01-22 18:51:49 +0100 |
commit | 14008e4e9cc6b51d68cd07ed091f788239d92856 (patch) | |
tree | 29d0706be3db7f8d0f3703383864e88d61e1a87b /src/libsystemd/sd-bus/busctl.c | |
parent | 2578d51ebd40ae0a8c6343164334358384dd55f7 (diff) |
busctl: include connection name in busctl output
Diffstat (limited to 'src/libsystemd/sd-bus/busctl.c')
-rw-r--r-- | src/libsystemd/sd-bus/busctl.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/libsystemd/sd-bus/busctl.c b/src/libsystemd/sd-bus/busctl.c index e962ba3f63..1d7f575314 100644 --- a/src/libsystemd/sd-bus/busctl.c +++ b/src/libsystemd/sd-bus/busctl.c @@ -106,8 +106,8 @@ static int list_bus_names(sd_bus *bus, char **argv) { merged[n] = NULL; strv_sort(merged); - printf("%-*s %*s %-*s %-*s %-*s %-*s %-*s", - (int) max_i, "NAME", 10, "PID", 15, "PROCESS", 16, "USER", 13, "CONNECTION", 25, "UNIT", 10, "SESSION"); + printf("%-*s %*s %-*s %-*s %-*s %-*s %-*s %-*s", + (int) max_i, "NAME", 10, "PID", 15, "PROCESS", 16, "USER", 13, "CONNECTION", 25, "UNIT", 10, "SESSION", 19, "CONNECTION-NAME"); if (arg_show_machine) puts(" MACHINE"); @@ -139,9 +139,12 @@ static int list_bus_names(sd_bus *bus, char **argv) { printf("%-*s", (int) max_i, *i); - r = sd_bus_get_owner(bus, *i, SD_BUS_CREDS_UID|SD_BUS_CREDS_PID|SD_BUS_CREDS_COMM|SD_BUS_CREDS_UNIQUE_NAME|SD_BUS_CREDS_UNIT|SD_BUS_CREDS_SESSION, &creds); + r = sd_bus_get_owner(bus, *i, + SD_BUS_CREDS_UID|SD_BUS_CREDS_PID|SD_BUS_CREDS_COMM| + SD_BUS_CREDS_UNIQUE_NAME|SD_BUS_CREDS_UNIT|SD_BUS_CREDS_SESSION| + SD_BUS_CREDS_CONNECTION_NAME, &creds); if (r >= 0) { - const char *unique, *session, *unit; + const char *unique, *session, *unit, *cn; pid_t pid; uid_t uid; @@ -194,8 +197,14 @@ static int list_bus_names(sd_bus *bus, char **argv) { else fputs(" - ", stdout); + r = sd_bus_creds_get_connection_name(creds, &cn); + if (r >= 0) + printf(" %-19s", cn); + else + fputs(" - ", stdout); + } else - printf(" - - - - - - "); + printf(" - - - - - - - "); if (arg_show_machine) { r = sd_bus_get_owner_machine_id(bus, *i, &mid); |