Commit f4ce0a7c authored by Martin Wührer's avatar Martin Wührer Committed by Andrei Vagin

c-lib: added set_page_server_address_port

According to https://criu.org/API_compliance, the C-library
doesn't support the pageserver option.
This patch contains the functions
`criu_(local_)set_page_server_address_port()`
that allow to specify on which ip and tcp-port the pageserver
is listening.

This patch affects only the c-lib, as criu-rpc already supports the
pageserver settings.
Signed-off-by: 's avatarMartin Wührer <martin.wuehrer@artech.at>
Signed-off-by: 's avatarAndrei Vagin <avagin@gmail.com>
parent b368e661
...@@ -193,6 +193,11 @@ void criu_local_free_opts(criu_opts *opts) ...@@ -193,6 +193,11 @@ void criu_local_free_opts(criu_opts *opts)
} }
opts->rpc->n_external = 0; opts->rpc->n_external = 0;
if(opts->rpc->ps) {
free(opts->rpc->ps->address);
free(opts->rpc->ps);
}
free(opts->rpc->cgroup_props_file); free(opts->rpc->cgroup_props_file);
free(opts->rpc->cgroup_props); free(opts->rpc->cgroup_props);
free(opts->rpc->parent_img); free(opts->rpc->parent_img);
...@@ -1018,6 +1023,32 @@ int criu_add_external(char *key) ...@@ -1018,6 +1023,32 @@ int criu_add_external(char *key)
return criu_local_add_external(global_opts, key); return criu_local_add_external(global_opts, key);
} }
int criu_local_set_page_server_address_port(criu_opts *opts, const char *address, int port)
{
opts->rpc->ps = malloc(sizeof(CriuPageServerInfo));
if (opts->rpc->ps) {
criu_page_server_info__init(opts->rpc->ps);
opts->rpc->ps->address = strdup(address);
if (!opts->rpc->ps->address) {
free(opts->rpc->ps);
opts->rpc->ps = NULL;
goto out;
}
opts->rpc->ps->has_port = true;
opts->rpc->ps->port = port;
}
out:
return -ENOMEM;
}
int criu_set_page_server_address_port(const char *address, int port)
{
return criu_local_set_page_server_address_port(global_opts, address, port);
}
static CriuResp *recv_resp(int socket_fd) static CriuResp *recv_resp(int socket_fd)
{ {
unsigned char *buf = NULL; unsigned char *buf = NULL;
......
...@@ -97,6 +97,7 @@ void criu_set_ghost_limit(unsigned int limit); ...@@ -97,6 +97,7 @@ void criu_set_ghost_limit(unsigned int limit);
int criu_add_irmap_path(char *path); int criu_add_irmap_path(char *path);
int criu_add_inherit_fd(int fd, char *key); int criu_add_inherit_fd(int fd, char *key);
int criu_add_external(char *key); int criu_add_external(char *key);
int criu_set_page_server_address_port(const char *address, int port);
/* /*
* The criu_notify_arg_t na argument is an opaque * The criu_notify_arg_t na argument is an opaque
...@@ -211,6 +212,7 @@ int criu_local_add_cg_props_file(criu_opts *opts, char *path); ...@@ -211,6 +212,7 @@ 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_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_inherit_fd(criu_opts *opts, int fd, char *key);
int criu_local_add_external(criu_opts *opts, char *key); int criu_local_add_external(criu_opts *opts, char *key);
int criu_local_set_page_server_address_port(criu_opts *opts, const char *address, int port);
void criu_local_set_notify_cb(criu_opts *opts, int (*cb)(char *action, criu_notify_arg_t na)); void criu_local_set_notify_cb(criu_opts *opts, int (*cb)(char *action, criu_notify_arg_t na));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment