c-lib: added set_page_server_address_port

Submitted by Martin Wuehrer on Jan. 30, 2019, 9:34 a.m.

Details

Message ID 20190130093445.14441-1-martin.wuehrer@artech.at
State Accepted
Series "c-lib: added set_page_server_address_port"
Headers show

Commit Message

Martin Wuehrer Jan. 30, 2019, 9:34 a.m.
From: Martin Wührer <martin.wuehrer@artech.at>

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: Martin Wührer <martin.wuehrer@artech.at>
---
 lib/c/criu.c | 31 +++++++++++++++++++++++++++++++
 lib/c/criu.h |  2 ++
 2 files changed, 33 insertions(+)

Patch hide | download patch | download mbox

diff --git a/lib/c/criu.c b/lib/c/criu.c
index 11dc6e84..6d299835 100644
--- a/lib/c/criu.c
+++ b/lib/c/criu.c
@@ -193,6 +193,11 @@  void criu_local_free_opts(criu_opts *opts)
 	}
 	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);
 	free(opts->rpc->parent_img);
@@ -1018,6 +1023,32 @@  int criu_add_external(char *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)
 {
 	unsigned char *buf = NULL;
diff --git a/lib/c/criu.h b/lib/c/criu.h
index 8acd342a..ceb30353 100644
--- a/lib/c/criu.h
+++ b/lib/c/criu.h
@@ -97,6 +97,7 @@  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);
+int criu_set_page_server_address_port(const char *address, int port);
 
 /*
  * 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);
 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);
+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));
 

Comments

Radostin Stoyanov Jan. 30, 2019, 11:13 a.m.
Hi Martin,

I remember that I sent a similar patch some time ago

https://lists.openvz.org/pipermail/criu/2018-February/040352.html

What do you think about the idea of starting page server via c-lib?
Another, thing that might be useful is the '--ps-socket' option which
allows to pass a file descriptor as socket for incoming connection
(instead of --address and --port)

Radostin

On 30/01/2019 09:34, martin.wuehrer@artech.at wrote:
> From: Martin Wührer <martin.wuehrer@artech.at>
>
> 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: Martin Wührer <martin.wuehrer@artech.at>
> ---
>  lib/c/criu.c | 31 +++++++++++++++++++++++++++++++
>  lib/c/criu.h |  2 ++
>  2 files changed, 33 insertions(+)
>
> diff --git a/lib/c/criu.c b/lib/c/criu.c
> index 11dc6e84..6d299835 100644
> --- a/lib/c/criu.c
> +++ b/lib/c/criu.c
> @@ -193,6 +193,11 @@ void criu_local_free_opts(criu_opts *opts)
>  	}
>  	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);
>  	free(opts->rpc->parent_img);
> @@ -1018,6 +1023,32 @@ int criu_add_external(char *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)
>  {
>  	unsigned char *buf = NULL;
> diff --git a/lib/c/criu.h b/lib/c/criu.h
> index 8acd342a..ceb30353 100644
> --- a/lib/c/criu.h
> +++ b/lib/c/criu.h
> @@ -97,6 +97,7 @@ 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);
> +int criu_set_page_server_address_port(const char *address, int port);
>  
>  /*
>   * 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);
>  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);
> +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));
>
Martin Wuehrer Jan. 30, 2019, 11:24 a.m.
Hi Radostin,

Sorry, but I have actually another usecase where the criu-dump and the
pageserver are running on two machines connected via network.
Thus in this case I don't have the possibility to access the UNIX-
socket from the dumping machine and I need the TCP address and port of
the machine where the pageserver runs.

But thanks anyway.

Martin

On Wed, 2019-01-30 at 11:13 +0000, Radostin Stoyanov wrote:
> Hi Martin,
> 
> I remember that I sent a similar patch some time ago
> 
> https://lists.openvz.org/pipermail/criu/2018-February/040352.html
> 
> What do you think about the idea of starting page server via c-lib?
> Another, thing that might be useful is the '--ps-socket' option which
> allows to pass a file descriptor as socket for incoming connection
> (instead of --address and --port)
> 
> Radostin
> 
> On 30/01/2019 09:34, martin.wuehrer@artech.at wrote:
> > From: Martin Wührer <martin.wuehrer@artech.at>
> > 
> > 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: Martin Wührer <martin.wuehrer@artech.at>
> > ---
> >  lib/c/criu.c | 31 +++++++++++++++++++++++++++++++
> >  lib/c/criu.h |  2 ++
> >  2 files changed, 33 insertions(+)
> > 
> > diff --git a/lib/c/criu.c b/lib/c/criu.c
> > index 11dc6e84..6d299835 100644
> > --- a/lib/c/criu.c
> > +++ b/lib/c/criu.c
> > @@ -193,6 +193,11 @@ void criu_local_free_opts(criu_opts *opts)
> >  	}
> >  	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);
> >  	free(opts->rpc->parent_img);
> > @@ -1018,6 +1023,32 @@ int criu_add_external(char *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)
> >  {
> >  	unsigned char *buf = NULL;
> > diff --git a/lib/c/criu.h b/lib/c/criu.h
> > index 8acd342a..ceb30353 100644
> > --- a/lib/c/criu.h
> > +++ b/lib/c/criu.h
> > @@ -97,6 +97,7 @@ 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);
> > +int criu_set_page_server_address_port(const char *address, int
> > port);
> >  
> >  /*
> >   * 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);
> >  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);
> > +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));
> >
Pawel Stradomski Jan. 30, 2019, 12:06 p.m.
The fd for --ps-socket doesn't have to be a UNIX socket, it can be a TCP
socket just fine.

śr., 30 sty 2019 o 12:25 Martin Wuehrer <martin.wuehrer@artech.at>
napisał(a):

> Hi Radostin,
>
> Sorry, but I have actually another usecase where the criu-dump and the
> pageserver are running on two machines connected via network.
> Thus in this case I don't have the possibility to access the UNIX-
> socket from the dumping machine and I need the TCP address and port of
> the machine where the pageserver runs.
>
> But thanks anyway.
>
> Martin
>
> On Wed, 2019-01-30 at 11:13 +0000, Radostin Stoyanov wrote:
> > Hi Martin,
> >
> > I remember that I sent a similar patch some time ago
> >
> > https://lists.openvz.org/pipermail/criu/2018-February/040352.html
> >
> > What do you think about the idea of starting page server via c-lib?
> > Another, thing that might be useful is the '--ps-socket' option which
> > allows to pass a file descriptor as socket for incoming connection
> > (instead of --address and --port)
> >
> > Radostin
> >
> > On 30/01/2019 09:34, martin.wuehrer@artech.at wrote:
> > > From: Martin Wührer <martin.wuehrer@artech.at>
> > >
> > > 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: Martin Wührer <martin.wuehrer@artech.at>
> > > ---
> > >  lib/c/criu.c | 31 +++++++++++++++++++++++++++++++
> > >  lib/c/criu.h |  2 ++
> > >  2 files changed, 33 insertions(+)
> > >
> > > diff --git a/lib/c/criu.c b/lib/c/criu.c
> > > index 11dc6e84..6d299835 100644
> > > --- a/lib/c/criu.c
> > > +++ b/lib/c/criu.c
> > > @@ -193,6 +193,11 @@ void criu_local_free_opts(criu_opts *opts)
> > >     }
> > >     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);
> > >     free(opts->rpc->parent_img);
> > > @@ -1018,6 +1023,32 @@ int criu_add_external(char *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)
> > >  {
> > >     unsigned char *buf = NULL;
> > > diff --git a/lib/c/criu.h b/lib/c/criu.h
> > > index 8acd342a..ceb30353 100644
> > > --- a/lib/c/criu.h
> > > +++ b/lib/c/criu.h
> > > @@ -97,6 +97,7 @@ 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);
> > > +int criu_set_page_server_address_port(const char *address, int
> > > port);
> > >
> > >  /*
> > >   * 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);
> > >  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);
> > > +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));
> > >
>
> _______________________________________________
> CRIU mailing list
> CRIU@openvz.org
> https://lists.openvz.org/mailman/listinfo/criu
>
Martin Wuehrer Jan. 30, 2019, 12:37 p.m.
Ok, now I understand.

So you suggest to add another function
criu_local_set_page_server_socket()
that allows to set the pageserver socket.

But I think that criu_local_set_page_server_address_port() would be
useful too.

On Wed, 2019-01-30 at 13:06 +0100, Paweł Stradomski wrote:
> The fd for --ps-socket doesn't have to be a UNIX socket, it can be a
> TCP socket just fine.
> 
> śr., 30 sty 2019 o 12:25 Martin Wuehrer <martin.wuehrer@artech.at>
> napisał(a):
> > Hi Radostin,
> > 
> > Sorry, but I have actually another usecase where the criu-dump and
> > the
> > pageserver are running on two machines connected via network.
> > Thus in this case I don't have the possibility to access the UNIX-
> > socket from the dumping machine and I need the TCP address and port
> > of
> > the machine where the pageserver runs.
> > 
> > But thanks anyway.
> > 
> > Martin
> > 
> > On Wed, 2019-01-30 at 11:13 +0000, Radostin Stoyanov wrote:
> > > Hi Martin,
> > > 
> > > I remember that I sent a similar patch some time ago
> > > 
> > > https://lists.openvz.org/pipermail/criu/2018-February/040352.html
> > > 
> > > What do you think about the idea of starting page server via c-
> > lib?
> > > Another, thing that might be useful is the '--ps-socket' option
> > which
> > > allows to pass a file descriptor as socket for incoming
> > connection
> > > (instead of --address and --port)
> > > 
> > > Radostin
> > > 
> > > On 30/01/2019 09:34, martin.wuehrer@artech.at wrote:
> > > > From: Martin Wührer <martin.wuehrer@artech.at>
> > > > 
> > > > 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: Martin Wührer <martin.wuehrer@artech.at>
> > > > ---
> > > >  lib/c/criu.c | 31 +++++++++++++++++++++++++++++++
> > > >  lib/c/criu.h |  2 ++
> > > >  2 files changed, 33 insertions(+)
> > > > 
> > > > diff --git a/lib/c/criu.c b/lib/c/criu.c
> > > > index 11dc6e84..6d299835 100644
> > > > --- a/lib/c/criu.c
> > > > +++ b/lib/c/criu.c
> > > > @@ -193,6 +193,11 @@ void criu_local_free_opts(criu_opts *opts)
> > > >     }
> > > >     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);
> > > >     free(opts->rpc->parent_img);
> > > > @@ -1018,6 +1023,32 @@ int criu_add_external(char *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)
> > > >  {
> > > >     unsigned char *buf = NULL;
> > > > diff --git a/lib/c/criu.h b/lib/c/criu.h
> > > > index 8acd342a..ceb30353 100644
> > > > --- a/lib/c/criu.h
> > > > +++ b/lib/c/criu.h
> > > > @@ -97,6 +97,7 @@ 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);
> > > > +int criu_set_page_server_address_port(const char *address, int
> > > > port);
> > > >  
> > > >  /*
> > > >   * 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);
> > > >  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);
> > > > +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));
> > > >  
> > 
> > _______________________________________________
> > CRIU mailing list
> > CRIU@openvz.org
> > https://lists.openvz.org/mailman/listinfo/criu
Andrei Vagin Feb. 1, 2019, 5:35 p.m.
Applied, thanks!

On Wed, Jan 30, 2019 at 10:34:45AM +0100, martin.wuehrer@artech.at wrote:
> From: Martin Wührer <martin.wuehrer@artech.at>
> 
> 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: Martin Wührer <martin.wuehrer@artech.at>
> ---
>  lib/c/criu.c | 31 +++++++++++++++++++++++++++++++
>  lib/c/criu.h |  2 ++
>  2 files changed, 33 insertions(+)
> 
> diff --git a/lib/c/criu.c b/lib/c/criu.c
> index 11dc6e84..6d299835 100644
> --- a/lib/c/criu.c
> +++ b/lib/c/criu.c
> @@ -193,6 +193,11 @@ void criu_local_free_opts(criu_opts *opts)
>  	}
>  	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);
>  	free(opts->rpc->parent_img);
> @@ -1018,6 +1023,32 @@ int criu_add_external(char *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)
>  {
>  	unsigned char *buf = NULL;
> diff --git a/lib/c/criu.h b/lib/c/criu.h
> index 8acd342a..ceb30353 100644
> --- a/lib/c/criu.h
> +++ b/lib/c/criu.h
> @@ -97,6 +97,7 @@ 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);
> +int criu_set_page_server_address_port(const char *address, int port);
>  
>  /*
>   * 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);
>  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);
> +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));
>  
> -- 
> 2.20.1
> 
> _______________________________________________
> CRIU mailing list
> CRIU@openvz.org
> https://lists.openvz.org/mailman/listinfo/criu