[CRIU] [PATCH 2/6] lib: Add support for setting new namespace flags via libcriu

Serge Hallyn serge.hallyn at ubuntu.com
Tue Jul 29 15:07:41 PDT 2014


Quoting Tycho Andersen (tycho.andersen at canonical.com):
> Signed-off-by: Tycho Andersen <tycho.andersen at canonical.com>

Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.com>

> ---
>  cr-service.c       | 3 +++
>  lib/criu.c         | 6 ++++++
>  lib/criu.h         | 2 ++
>  protobuf/rpc.proto | 1 +
>  4 files changed, 12 insertions(+)
> 
> diff --git a/cr-service.c b/cr-service.c
> index 11e9778..2041ed8 100644
> --- a/cr-service.c
> +++ b/cr-service.c
> @@ -266,6 +266,9 @@ static int setup_opts_from_req(int sk, CriuOpts *req)
>  	if (req->has_force_irmap)
>  		opts.force_irmap = req->force_irmap;
>  
> +	if (req->has_ns_flags)
> +		opts.rst_namespaces_flags = req->ns_flags;
> +
>  	if (req->n_exec_cmd > 0) {
>  		opts.exec_cmd = xmalloc((req->n_exec_cmd + 1) * sizeof(char *));
>  		memcpy(opts.exec_cmd, req->exec_cmd, req->n_exec_cmd * sizeof(char *));
> diff --git a/lib/criu.c b/lib/criu.c
> index 9d84c83..dbf35cd 100644
> --- a/lib/criu.c
> +++ b/lib/criu.c
> @@ -163,6 +163,12 @@ void criu_set_cpu_cap(unsigned int cap)
>  	opts->cpu_cap		= cap;
>  }
>  
> +void criu_set_ns_flags(uint32_t flags)
> +{
> +	opts->has_ns_flags	= true;
> +	opts->ns_flags		= flags;
> +}
> +
>  int criu_set_exec_cmd(int argc, char *argv[])
>  {
>  	int i;
> diff --git a/lib/criu.h b/lib/criu.h
> index 5ab09c3..593aae3 100644
> --- a/lib/criu.h
> +++ b/lib/criu.h
> @@ -20,6 +20,7 @@
>  #define __CRIU_LIB_H__
>  
>  #include <stdbool.h>
> +#include <inttypes.h>
>  
>  void criu_set_service_address(char *path);
>  
> @@ -47,6 +48,7 @@ void criu_set_log_level(int log_level);
>  void criu_set_log_file(char *log_file);
>  void criu_set_cpu_cap(unsigned int cap);
>  void criu_set_root(char *root);
> +void criu_set_ns_flags(uint32_t flags);
>  int criu_add_action_script(char *script);
>  int criu_set_exec_cmd(int argc, char *argv[]);
>  int criu_add_ext_mount(char *key, char *val);
> diff --git a/protobuf/rpc.proto b/protobuf/rpc.proto
> index 1604f37..410b159 100644
> --- a/protobuf/rpc.proto
> +++ b/protobuf/rpc.proto
> @@ -47,6 +47,7 @@ message criu_opts {
>  	repeated ext_mount_map		ext_mnt		= 23;
>  
>  	repeated string			action_scripts	= 24;
> +	optional uint32			ns_flags	= 25;
>  }
>  
>  message criu_dump_resp {
> -- 
> 1.9.1
> 
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu


More information about the CRIU mailing list