2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-09-05 00:35:23 +00:00

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>
This commit is contained in:
Tycho Andersen
2014-07-10 17:00:28 +04:00
committed by Pavel Emelyanov
parent e1b56c8fac
commit 51876eea5d
13 changed files with 816 additions and 23 deletions

View File

@@ -288,7 +288,7 @@ int vaddr_to_pfn(unsigned long vaddr, u64 *pfn);
/*
* Check whether @str starts with @sub
*/
static inline bool strstartswith(char *str, char *sub)
static inline bool strstartswith(const char *str, const char *sub)
{
while (1) {
if (*sub == '\0') /* end of sub -- match */
@@ -303,4 +303,16 @@ static inline bool strstartswith(char *str, char *sub)
}
}
/*
* mkdir -p
*/
int mkdirp(const char *path);
/*
* Tests whether a path is a prefix of another path. This is different than
* strstartswith because "/foo" is _not_ a path prefix of "/foobar", since they
* refer to different directories.
*/
bool is_path_prefix(const char *path, const char *prefix);
FILE *fopenat(int dirfd, char *path, char *cflags);
#endif /* __CR_UTIL_H__ */