summaryrefslogtreecommitdiff
path: root/src/login
diff options
context:
space:
mode:
Diffstat (limited to 'src/login')
-rw-r--r--src/login/loginctl.c24
-rw-r--r--src/login/logind-session-dbus.c24
-rw-r--r--src/login/logind-user-dbus.c24
3 files changed, 56 insertions, 16 deletions
diff --git a/src/login/loginctl.c b/src/login/loginctl.c
index f1cb16e713..3ec8057d3b 100644
--- a/src/login/loginctl.c
+++ b/src/login/loginctl.c
@@ -352,7 +352,7 @@ typedef struct SessionStatusInfo {
uid_t uid;
const char *name;
usec_t timestamp;
- const char *control_group;
+ const char *default_control_group;
int vtnr;
const char *seat;
const char *tty;
@@ -371,7 +371,7 @@ typedef struct UserStatusInfo {
uid_t uid;
const char *name;
usec_t timestamp;
- const char *control_group;
+ const char *default_control_group;
const char *state;
char **sessions;
const char *display;
@@ -461,10 +461,10 @@ static void print_session_status_info(SessionStatusInfo *i) {
printf("\t Active: %s\n", yes_no(i->active));
- if (i->control_group) {
+ if (i->default_control_group) {
unsigned c;
- printf("\t CGroup: %s\n", i->control_group);
+ printf("\t CGroup: %s\n", i->default_control_group);
if (arg_transport != TRANSPORT_SSH) {
c = columns();
@@ -473,7 +473,7 @@ static void print_session_status_info(SessionStatusInfo *i) {
else
c = 0;
- show_cgroup_by_path(i->control_group, "\t\t ", c, false, arg_all);
+ show_cgroup_and_extra_by_spec(i->default_control_group, "\t\t ", c, false, arg_all, &i->leader, i->leader > 0 ? 1 : 0);
}
}
}
@@ -513,10 +513,10 @@ static void print_user_status_info(UserStatusInfo *i) {
printf("\n");
}
- if (i->control_group) {
+ if (i->default_control_group) {
unsigned c;
- printf("\t CGroup: %s\n", i->control_group);
+ printf("\t CGroup: %s\n", i->default_control_group);
if (arg_transport != TRANSPORT_SSH) {
c = columns();
@@ -525,7 +525,7 @@ static void print_user_status_info(UserStatusInfo *i) {
else
c = 0;
- show_cgroup_by_path(i->control_group, "\t\t ", c, false, arg_all);
+ show_cgroup_by_path(i->default_control_group, "\t\t ", c, false, arg_all);
}
}
}
@@ -581,8 +581,8 @@ static int status_property_session(const char *name, DBusMessageIter *iter, Sess
i->id = s;
else if (streq(name, "Name"))
i->name = s;
- else if (streq(name, "ControlGroupPath"))
- i->control_group = s;
+ else if (streq(name, "DefaultControlGroup"))
+ i->default_control_group = s;
else if (streq(name, "TTY"))
i->tty = s;
else if (streq(name, "Display"))
@@ -680,8 +680,8 @@ static int status_property_user(const char *name, DBusMessageIter *iter, UserSta
if (!isempty(s)) {
if (streq(name, "Name"))
i->name = s;
- else if (streq(name, "ControlGroupPath"))
- i->control_group = s;
+ else if (streq(name, "DefaultControlGroup"))
+ i->default_control_group = s;
else if (streq(name, "State"))
i->state = s;
}
diff --git a/src/login/logind-session-dbus.c b/src/login/logind-session-dbus.c
index 0780f3f42a..7f1b58072d 100644
--- a/src/login/logind-session-dbus.c
+++ b/src/login/logind-session-dbus.c
@@ -45,7 +45,7 @@
" <property name=\"Name\" type=\"s\" access=\"read\"/>\n" \
" <property name=\"Timestamp\" type=\"t\" access=\"read\"/>\n" \
" <property name=\"TimestampMonotonic\" type=\"t\" access=\"read\"/>\n" \
- " <property name=\"ControlGroupPath\" type=\"s\" access=\"read\"/>\n" \
+ " <property name=\"DefaultControlGroup\" type=\"s\" access=\"read\"/>\n" \
" <property name=\"VTNr\" type=\"u\" access=\"read\"/>\n" \
" <property name=\"Seat\" type=\"(so)\" access=\"read\"/>\n" \
" <property name=\"TTY\" type=\"s\" access=\"read\"/>\n" \
@@ -196,6 +196,26 @@ static int bus_session_append_idle_hint_since(DBusMessageIter *i, const char *pr
return 0;
}
+static int bus_session_append_default_cgroup(DBusMessageIter *i, const char *property, void *data) {
+ Session *s = data;
+ char *t;
+ int r;
+ bool success;
+
+ assert(i);
+ assert(property);
+ assert(s);
+
+ r = cg_join_spec(SYSTEMD_CGROUP_CONTROLLER, s->cgroup_path, &t);
+ if (r < 0)
+ return r;
+
+ success = dbus_message_iter_append_basic(i, DBUS_TYPE_STRING, &t);
+ free(t);
+
+ return success ? 0 : -ENOMEM;
+}
+
static DEFINE_BUS_PROPERTY_APPEND_ENUM(bus_session_append_type, session_type, SessionType);
static DEFINE_BUS_PROPERTY_APPEND_ENUM(bus_session_append_class, session_class, SessionClass);
@@ -228,7 +248,7 @@ static const BusProperty bus_login_session_properties[] = {
{ "Id", bus_property_append_string, "s", offsetof(Session, id), true },
{ "Timestamp", bus_property_append_usec, "t", offsetof(Session, timestamp.realtime) },
{ "TimestampMonotonic", bus_property_append_usec, "t", offsetof(Session, timestamp.monotonic) },
- { "ControlGroupPath", bus_property_append_string, "s", offsetof(Session, cgroup_path), true },
+ { "DefaultControlGroup", bus_session_append_default_cgroup, "s", 0, },
{ "VTNr", bus_property_append_uint32, "u", offsetof(Session, vtnr) },
{ "Seat", bus_session_append_seat, "(so)", 0 },
{ "TTY", bus_property_append_string, "s", offsetof(Session, tty), true },
diff --git a/src/login/logind-user-dbus.c b/src/login/logind-user-dbus.c
index 2d3375a09c..21b608d526 100644
--- a/src/login/logind-user-dbus.c
+++ b/src/login/logind-user-dbus.c
@@ -38,7 +38,7 @@
" <property name=\"Timestamp\" type=\"t\" access=\"read\"/>\n" \
" <property name=\"TimestampMonotonic\" type=\"t\" access=\"read\"/>\n" \
" <property name=\"RuntimePath\" type=\"s\" access=\"read\"/>\n" \
- " <property name=\"ControlGroupPath\" type=\"s\" access=\"read\"/>\n" \
+ " <property name=\"DefaultControlGroup\" type=\"s\" access=\"read\"/>\n" \
" <property name=\"Service\" type=\"s\" access=\"read\"/>\n" \
" <property name=\"Display\" type=\"(so)\" access=\"read\"/>\n" \
" <property name=\"State\" type=\"s\" access=\"read\"/>\n" \
@@ -189,6 +189,26 @@ static int bus_user_append_idle_hint_since(DBusMessageIter *i, const char *prope
return 0;
}
+static bus_user_append_default_cgroup(DBusMessageIter *i, const char *property, void *data) {
+ User *u = data;
+ char *t;
+ int r;
+ bool success;
+
+ assert(i);
+ assert(property);
+ assert(u);
+
+ r = cg_join_spec(SYSTEMD_CGROUP_CONTROLLER, u->cgroup_path, &t);
+ if (r < 0)
+ return r;
+
+ success = dbus_message_iter_append_basic(i, DBUS_TYPE_STRING, &t);
+ free(t);
+
+ return success ? 0 : -ENOMEM;
+}
+
static int get_user_for_path(Manager *m, const char *path, User **_u) {
User *u;
unsigned long lu;
@@ -220,7 +240,7 @@ static const BusProperty bus_login_user_properties[] = {
{ "Timestamp", bus_property_append_usec, "t", offsetof(User, timestamp.realtime) },
{ "TimestampMonotonic", bus_property_append_usec, "t", offsetof(User, timestamp.monotonic) },
{ "RuntimePath", bus_property_append_string, "s", offsetof(User, runtime_path), true },
- { "ControlGroupPath", bus_property_append_string, "s", offsetof(User, cgroup_path), true },
+ { "DefaultControlGroup", bus_user_append_default_cgroup, "s", 0 },
{ "Service", bus_property_append_string, "s", offsetof(User, service), true },
{ "Display", bus_user_append_display, "(so)", 0 },
{ "State", bus_user_append_state, "s", 0 },