Commit 142f2c8e authored by Tycho Andersen's avatar Tycho Andersen Committed by Pavel Emelyanov

cgroup: dump some global properties as well

These are present in every cgroup, so let's dump them.
Signed-off-by: 's avatarTycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent cbe8ef4f
...@@ -81,6 +81,13 @@ static const char *freezer_props[] = { ...@@ -81,6 +81,13 @@ static const char *freezer_props[] = {
NULL NULL
}; };
static const char *global_props[] = {
"cgroup.clone_children",
"cgroup.sane_behavior",
"notify_on_release",
NULL
};
/* /*
* This structure describes set of controller groups * This structure describes set of controller groups
* a task lives in. The cg_ctl entries are stored in * a task lives in. The cg_ctl entries are stored in
...@@ -401,17 +408,13 @@ static const char **get_known_properties(char *controller) ...@@ -401,17 +408,13 @@ static const char **get_known_properties(char *controller)
return prop_arr; return prop_arr;
} }
static int add_cgroup_properties(const char *fpath, struct cgroup_dir *ncd, static int dump_cg_props_array(const char *fpath, struct cgroup_dir *ncd,
struct cg_controller *controller) const char **prop_arr)
{ {
int i, j; int j;
char buf[PATH_MAX]; char buf[PATH_MAX];
struct cgroup_prop *prop; struct cgroup_prop *prop;
for (i = 0; i < controller->n_controllers; ++i) {
const char **prop_arr = get_known_properties(controller->controllers[i]);
for (j = 0; prop_arr != NULL && prop_arr[j] != NULL; ++j) { for (j = 0; prop_arr != NULL && prop_arr[j] != NULL; ++j) {
if (snprintf(buf, PATH_MAX, "%s/%s", fpath, prop_arr[j]) >= PATH_MAX) { if (snprintf(buf, PATH_MAX, "%s/%s", fpath, prop_arr[j]) >= PATH_MAX) {
pr_err("snprintf output was truncated\n"); pr_err("snprintf output was truncated\n");
...@@ -439,6 +442,28 @@ static int add_cgroup_properties(const char *fpath, struct cgroup_dir *ncd, ...@@ -439,6 +442,28 @@ static int add_cgroup_properties(const char *fpath, struct cgroup_dir *ncd,
list_add_tail(&prop->list, &ncd->properties); list_add_tail(&prop->list, &ncd->properties);
ncd->n_properties++; ncd->n_properties++;
} }
return 0;
}
static int add_cgroup_properties(const char *fpath, struct cgroup_dir *ncd,
struct cg_controller *controller)
{
int i;
for (i = 0; i < controller->n_controllers; ++i) {
const char **prop_arr = get_known_properties(controller->controllers[i]);
if (dump_cg_props_array(fpath, ncd, prop_arr) < 0) {
pr_err("dumping known properties failed");
return -1;
}
if (dump_cg_props_array(fpath, ncd, global_props) < 0) {
pr_err("dumping global properties failed");
return -1;
}
} }
return 0; return 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment