2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-31 06:15:24 +00:00

libcriu: Add criu_add_cg_root() call

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Tycho Andersen <tycho.andersen@canonical.com>
This commit is contained in:
Pavel Emelyanov
2014-08-22 16:12:05 +04:00
parent 070757c142
commit f74ed43d0f
2 changed files with 41 additions and 0 deletions

View File

@@ -232,6 +232,46 @@ er:
return -ENOMEM;
}
int criu_add_cg_root(char *ctrl, char *path)
{
int nr;
CgroupRoot **a, *root;
root = malloc(sizeof(*root));
if (!root)
goto er;
cgroup_root__init(root);
if (ctrl) {
root->ctrl = strdup(ctrl);
if (!root->ctrl)
goto er_r;
}
root->path = strdup(path);
if (!root->path)
goto er_c;
nr = opts->n_cg_root + 1;
a = realloc(opts->cg_root, nr * sizeof(root));
if (!a)
goto er_p;
a[nr - 1] = root;
opts->cg_root = a;
opts->n_cg_root = nr;
return 0;
er_p:
free(root->path);
er_c:
if (root->ctrl)
free(root->ctrl);
er_r:
free(root);
er:
return -ENOMEM;
}
int criu_add_veth_pair(char *in, char *out)
{
int nr;