[CRIU] [PATCH] lib: add external support
Ruslan Kuprieiev
rkuprieiev at cloudlinux.com
Fri Oct 21 11:10:46 PDT 2016
It is already present in rpc, so lets add it to libcriu too.
Signed-off-by: Ruslan Kuprieiev <rkuprieiev at cloudlinux.com>
---
lib/c/criu.c | 29 +++++++++++++++++++++++++++++
lib/c/criu.h | 2 ++
2 files changed, 31 insertions(+)
diff --git a/lib/c/criu.c b/lib/c/criu.c
index a7df66a..76385e0 100644
--- a/lib/c/criu.c
+++ b/lib/c/criu.c
@@ -840,6 +840,35 @@ int criu_add_inherit_fd(int fd, char *key)
return criu_local_add_inherit_fd(global_opts, fd, key);
}
+int criu_local_add_external(criu_opts *opts, char *key)
+{
+ int nr;
+ char **a, *e = NULL;
+
+ e = strdup(key);
+ if (!e)
+ goto err;
+
+ nr = opts->rpc->n_external + 1;
+ a = realloc(opts->rpc->external, nr * sizeof(*a));
+ if (!a)
+ goto err;
+
+ a[nr - 1] = e;
+ opts->rpc->external = a;
+ opts->rpc->n_external = nr;
+ return 0;
+err:
+ if (e)
+ free(e);
+ return -ENOMEM;
+}
+
+int criu_add_external(char *key)
+{
+ return criu_local_add_external(global_opts, key);
+}
+
static CriuResp *recv_resp(int socket_fd)
{
unsigned char *buf = NULL;
diff --git a/lib/c/criu.h b/lib/c/criu.h
index 5785044..f887b71 100644
--- a/lib/c/criu.h
+++ b/lib/c/criu.h
@@ -93,6 +93,7 @@ int criu_add_skip_mnt(char *mnt);
void criu_set_ghost_limit(unsigned int limit);
int criu_add_irmap_path(char *path);
int criu_add_inherit_fd(int fd, char *key);
+int criu_add_external(char *key);
/*
* The criu_notify_arg_t na argument is an opaque
@@ -202,6 +203,7 @@ int criu_local_add_cg_props(criu_opts *opts, char *stream);
int criu_local_add_cg_props_file(criu_opts *opts, char *path);
int criu_local_add_cg_dump_controller(criu_opts *opts, char *name);
int criu_local_add_inherit_fd(criu_opts *opts, int fd, char *key);
+int criu_local_add_external(criu_opts *opts, char *key);
void criu_local_set_notify_cb(criu_opts *opts, int (*cb)(char *action, criu_notify_arg_t na));
--
2.5.5
More information about the CRIU
mailing list