cgroups: get controllers from /proc/self/cgroups (v2)

Some controllers can be disabled in kernel options. In this case they
are shown in /proc/cgroups, but they could not be mounted.

All enabled controllers can be collected from /proc/self/cgroup.

https://github.com/xemul/criu/issues/28

v2: ',' is used to separate controllers

Cc: Tycho Andersen <tycho.andersen@canonical.com>
Reported-by: Ross Boucher <boucher@gmail.com>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Andrey Vagin 2015-09-11 18:35:00 +03:00 committed by Pavel Emelyanov
parent 5db3f4c337
commit d3be641acd
4 changed files with 53 additions and 46 deletions

View file

@ -40,7 +40,6 @@ struct cgroup_dir {
* The heads are subdirectories organized in their tree format.
*/
struct cg_controller {
int heirarchy;
unsigned int n_controllers;
char **controllers;
@ -51,7 +50,7 @@ struct cg_controller {
/* for cgroup list in cgroup.c */
struct list_head l;
};
struct cg_controller *new_controller(const char *name, int heirarchy);
struct cg_controller *new_controller(const char *name);
/* parse all global cgroup information into structures */
int parse_cg_info(void);

View file

@ -180,7 +180,7 @@ struct cg_ctl {
extern int parse_task_cgroup(int pid, struct list_head *l, unsigned int *n);
extern void put_ctls(struct list_head *);
int parse_cgroups(struct list_head *cgroups, unsigned int *n_cgroups);
int collect_controllers(struct list_head *cgroups, unsigned int *n_cgroups);
/* callback for AUFS support */
extern int aufs_parse(struct mount_info *mi);