loginctl: show linger status in user-status

zbyszek (1002)
           Since: Tue 2016-04-12 23:11:46 EDT; 23min ago
           State: active
        Sessions: *3
          Linger: yes
            Unit: user-1002.slice
                  ├─user@1002.service
                  │ └─init.scope
                  │   ├─38 /usr/lib/systemd/systemd --user
                  │   └─39 (sd-pam)
                  └─session-3.scope
                    ├─   31 login -- zbyszek
                    ├─   44 -bash
                    ├─15076 loginctl user-status zbyszek
                    └─15077 less
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2016-04-21 00:21:33 -04:00
parent 152199f2d7
commit 26e00f0e6a
+8 -6
View File
@@ -293,6 +293,7 @@ typedef struct SessionStatusInfo {
typedef struct UserStatusInfo {
uid_t uid;
bool linger;
char *name;
struct dual_timestamp timestamp;
char *state;
@@ -551,6 +552,7 @@ static int print_user_status_info(sd_bus *bus, const char *path, bool *new_line)
static const struct bus_properties_map map[] = {
{ "Name", "s", NULL, offsetof(UserStatusInfo, name) },
{ "Linger", "b", NULL, offsetof(UserStatusInfo, linger) },
{ "Slice", "s", NULL, offsetof(UserStatusInfo, slice) },
{ "State", "s", NULL, offsetof(UserStatusInfo, state) },
{ "UID", "u", NULL, offsetof(UserStatusInfo, uid) },
@@ -595,16 +597,16 @@ static int print_user_status_info(sd_bus *bus, const char *path, bool *new_line)
char **l;
printf("\tSessions:");
STRV_FOREACH(l, i.sessions) {
if (streq_ptr(*l, i.display))
printf(" *%s", *l);
else
printf(" %s", *l);
}
STRV_FOREACH(l, i.sessions)
printf(" %s%s",
streq_ptr(*l, i.display) ? "*" : "",
*l);
printf("\n");
}
printf("\t Linger: %s\n", yes_no(i.linger));
if (i.slice) {
printf("\t Unit: %s\n", i.slice);
show_unit_cgroup(bus, "org.freedesktop.systemd1.Slice", i.slice, 0);