[systemd-commits] 3 commits - TODO src/login src/machine src/systemctl
Lennart Poettering
lennart at kemper.freedesktop.org
Thu Jul 11 10:16:19 PDT 2013
TODO | 2 --
src/login/loginctl.c | 17 ++++++++++++-----
src/machine/machinectl.c | 13 ++++++++++---
src/systemctl/systemctl.c | 2 +-
4 files changed, 23 insertions(+), 11 deletions(-)
New commits:
commit c14901bdebb311531fb85b02c7c6eebf6e8e4388
Author: Lennart Poettering <lennart at poettering.net>
Date: Thu Jul 11 19:16:11 2013 +0200
update TODO
diff --git a/TODO b/TODO
index 34634fb..a6eed6f 100644
--- a/TODO
+++ b/TODO
@@ -36,8 +36,6 @@ Fedora 19:
CGroup Rework Completion:
-* systemctl user.slice doesn't show the full tree?
-
* introduce "mainpid" for scopes
* implement system-wide DefaultCPUAccounting=1 switch (and similar for blockio, memory?)
commit 042f9f5e5e76cf0e3cbfd009abd2add0366cdeca
Author: Lennart Poettering <lennart at poettering.net>
Date: Thu Jul 11 19:15:01 2013 +0200
systemctl: show cgroup tree if cgroup is empty but has non-empty children
This makes sure "systemctl status user.slice" shows a nice cgroup tree
of all logged in users.
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index d25b7d6..2ea5a3b 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -2788,7 +2788,7 @@ static void print_status_info(UnitStatusInfo *i) {
printf(" Status: \"%s\"\n", i->status_text);
if (i->control_group &&
- (i->main_pid > 0 || i->control_pid > 0 || cg_is_empty(SYSTEMD_CGROUP_CONTROLLER, i->control_group, false) == 0)) {
+ (i->main_pid > 0 || i->control_pid > 0 || cg_is_empty_recursive(SYSTEMD_CGROUP_CONTROLLER, i->control_group, false) == 0)) {
unsigned c;
printf(" CGroup: %s\n", i->control_group);
commit 9d12709626bccc0cae677a7035f62efe6aabb4ab
Author: Lennart Poettering <lennart at poettering.net>
Date: Thu Jul 11 19:14:38 2013 +0200
loginctl: suppress cgroup tree output if cgroup is empty
same for machinectl
diff --git a/src/login/loginctl.c b/src/login/loginctl.c
index 93f4bee..736db6a 100644
--- a/src/login/loginctl.c
+++ b/src/login/loginctl.c
@@ -35,8 +35,9 @@
#include "build.h"
#include "strv.h"
#include "unit-name.h"
-#include "cgroup-show.h"
#include "sysfs-show.h"
+#include "cgroup-show.h"
+#include "cgroup-util.h"
#include "spawn-polkit-agent.h"
static char **arg_property = NULL;
@@ -262,7 +263,7 @@ static int list_seats(DBusConnection *bus, char **args, unsigned n) {
return 0;
}
-static int show_unit_cgroup(DBusConnection *bus, const char *interface, const char *unit) {
+static int show_unit_cgroup(DBusConnection *bus, const char *interface, const char *unit, pid_t leader) {
const char *property = "ControlGroup";
_cleanup_dbus_message_unref_ DBusMessage *reply = NULL;
_cleanup_free_ char *path = NULL;
@@ -313,6 +314,12 @@ static int show_unit_cgroup(DBusConnection *bus, const char *interface, const ch
dbus_message_iter_get_basic(&sub, &cgroup);
+ if (isempty(cgroup))
+ return 0;
+
+ if (cg_is_empty_recursive(SYSTEMD_CGROUP_CONTROLLER, cgroup, false) != 0 && leader <= 0)
+ return 0;
+
output_flags =
arg_all * OUTPUT_SHOW_ALL |
arg_full * OUTPUT_FULL_WIDTH;
@@ -323,7 +330,7 @@ static int show_unit_cgroup(DBusConnection *bus, const char *interface, const ch
else
c = 0;
- show_cgroup_by_path(cgroup, "\t\t ", c, false, output_flags);
+ show_cgroup_and_extra(SYSTEMD_CGROUP_CONTROLLER, cgroup, "\t\t ", c, false, &leader, leader > 0, output_flags);
return 0;
}
@@ -441,7 +448,7 @@ static void print_session_status_info(DBusConnection *bus, SessionStatusInfo *i)
if (i->scope) {
printf("\t Unit: %s\n", i->scope);
- show_unit_cgroup(bus, "org.freedesktop.systemd1.Scope", i->scope);
+ show_unit_cgroup(bus, "org.freedesktop.systemd1.Scope", i->scope, i->leader);
}
}
@@ -483,7 +490,7 @@ static void print_user_status_info(DBusConnection *bus, UserStatusInfo *i) {
if (i->slice) {
printf("\t Unit: %s\n", i->slice);
- show_unit_cgroup(bus, "org.freedesktop.systemd1.Slice", i->slice);
+ show_unit_cgroup(bus, "org.freedesktop.systemd1.Slice", i->slice, 0);
}
}
diff --git a/src/machine/machinectl.c b/src/machine/machinectl.c
index cd640e7..97c2193 100644
--- a/src/machine/machinectl.c
+++ b/src/machine/machinectl.c
@@ -36,6 +36,7 @@
#include "strv.h"
#include "unit-name.h"
#include "cgroup-show.h"
+#include "cgroup-util.h"
#include "spawn-polkit-agent.h"
static char **arg_property = NULL;
@@ -125,7 +126,7 @@ static int list_machines(DBusConnection *bus, char **args, unsigned n) {
return 0;
}
-static int show_scope_cgroup(DBusConnection *bus, const char *unit) {
+static int show_scope_cgroup(DBusConnection *bus, const char *unit, pid_t leader) {
const char *interface = "org.freedesktop.systemd1.Scope";
const char *property = "ControlGroup";
_cleanup_dbus_message_unref_ DBusMessage *reply = NULL;
@@ -177,6 +178,12 @@ static int show_scope_cgroup(DBusConnection *bus, const char *unit) {
dbus_message_iter_get_basic(&sub, &cgroup);
+ if (isempty(cgroup))
+ return 0;
+
+ if (cg_is_empty_recursive(SYSTEMD_CGROUP_CONTROLLER, cgroup, false) != 0 && leader <= 0)
+ return 0;
+
output_flags =
arg_all * OUTPUT_SHOW_ALL |
arg_full * OUTPUT_FULL_WIDTH;
@@ -187,7 +194,7 @@ static int show_scope_cgroup(DBusConnection *bus, const char *unit) {
else
c = 0;
- show_cgroup_by_path(cgroup, "\t\t ", c, false, output_flags);
+ show_cgroup_and_extra(SYSTEMD_CGROUP_CONTROLLER, cgroup, "\t\t ", c, false, &leader, leader > 0, output_flags);
return 0;
}
@@ -249,7 +256,7 @@ static void print_machine_status_info(DBusConnection *bus, MachineStatusInfo *i)
if (i->scope) {
printf("\t Unit: %s\n", i->scope);
- show_scope_cgroup(bus, i->scope);
+ show_scope_cgroup(bus, i->scope, i->leader);
}
}
More information about the systemd-commits
mailing list