Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/checkpoint-restore/criu.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavel Emelyanov <xemul@parallels.com>2014-08-22 16:12:05 +0400
committerPavel Emelyanov <xemul@parallels.com>2014-08-22 19:20:06 +0400
commitf74ed43d0f25177e16d4f249292cbb34630767b2 (patch)
tree2d47074c984e412a67ca761805433338042d7da6
parent070757c142b028df3bf324a1861361b588746286 (diff)
libcriu: Add criu_add_cg_root() call
Signed-off-by: Pavel Emelyanov <xemul@parallels.com> Acked-by: Tycho Andersen <tycho.andersen@canonical.com>
-rw-r--r--lib/criu.c40
-rw-r--r--lib/criu.h1
2 files changed, 41 insertions, 0 deletions
diff --git a/lib/criu.c b/lib/criu.c
index 45006e292..c83c4d83c 100644
--- a/lib/criu.c
+++ b/lib/criu.c
@@ -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;
diff --git a/lib/criu.h b/lib/criu.h
index 94c59790e..18f911eea 100644
--- a/lib/criu.h
+++ b/lib/criu.h
@@ -51,6 +51,7 @@ void criu_set_manage_cgroups(bool manage);
int criu_set_exec_cmd(int argc, char *argv[]);
int criu_add_ext_mount(char *key, char *val);
int criu_add_veth_pair(char *in, char *out);
+int criu_add_cg_root(char *ctrl, char *path);
/*
* The criu_notify_arg_t na argument is an opaque