criu/include/cgroup.h
Tycho Andersen 51876eea5d Attempt to restore cgroups
During the dump phase, /proc/cgroups is parsed to find co-mounted cgroups.
Then, for each task /proc/self/cgroup is parsed for the cgroups that it is a
member of, and that cgroup is traversed to find any child cgroups which may
also need restoring. Any cgroups not currently mounted will be temporarily
mounted and traversed. All of this information is persisted along with the
original cg_sets, which indicate which cgroups a task is a member of.

On restore, an initial phase creates all the cgroups which were saved. Tasks
are then restored into these cgroups via cg_sets as usual.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-07-10 17:00:28 +04:00

50 lines
1.2 KiB
C

#ifndef __CR_CGROUP_H__
#define __CR_CGROUP_H__
#include "asm/int.h"
struct pstree_item;
extern u32 root_cg_set;
int dump_task_cgroup(struct pstree_item *, u32 *);
int dump_cgroups(void);
int prepare_task_cgroup(struct pstree_item *);
int prepare_cgroup(void);
void fini_cgroup(void);
struct cg_controller;
/* This describes a particular cgroup path, e.g. the '/lxc/u1' part of
* 'blkio/lxc/u1' and any properties it has.
*/
struct cgroup_dir {
char *path;
/* this is how children are linked together */
struct list_head siblings;
/* more cgroup_dirs */
struct list_head children;
unsigned int n_children;
struct cg_controller *controller;
};
/* This describes a particular cgroup controller, e.g. blkio or cpuset.
* The heads are subdirectories organized in their tree format.
*/
struct cg_controller {
int heirarchy;
unsigned int n_controllers;
char **controllers;
/* cgroup_dirs */
struct list_head heads;
unsigned int n_heads;
/* for cgroup list in cgroup.c */
struct list_head l;
};
struct cg_controller *new_controller(const char *name, int heirarchy);
/* parse all global cgroup information into structures */
int parse_cg_info(void);
#endif /* __CR_CGROUP_H__ */