diff options
author | Lennart Poettering <lennart@poettering.net> | 2012-04-16 18:56:18 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2012-04-16 18:59:40 +0200 |
commit | b69d29ce049f12d463a589e18561dd10ee8c09f1 (patch) | |
tree | 8990e2d696fd91de9886c0d60bc41ba98a299e2f /src/login/logind-session-dbus.c | |
parent | 888c7102355af1450aa26253d60cc2cb46eeb71d (diff) |
systemctl: show main and control PID explicitly in cgroup-show
In some cases the main/control PID of a service can be outside of the
services cgroups (for example, if logind readjusts the processes'
cgroup). In order to clarify this for the user show the main/control PID
in the cgroup tree nonetheless, but mark them specially.
Diffstat (limited to 'src/login/logind-session-dbus.c')
-rw-r--r-- | src/login/logind-session-dbus.c | 24 |
1 files changed, 22 insertions, 2 deletions
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 }, |