[CRIU] [PATCH] Print CRIU and kernel version also in RPC mode

Andrei Vagin avagin at virtuozzo.com
Fri Mar 9 22:11:41 MSK 2018


Applied, thanks
On Thu, Mar 08, 2018 at 07:46:06PM +0000, Adrian Reber wrote:
> From: Adrian Reber <areber at redhat.com>
> 
> The newly introduced output of the CRIU and kernel version does not
> happen when running CRIU under RPC. This moves the print_versions()
> function util.c and calls it from cr-service.c
> 
> Signed-off-by: Adrian Reber <areber at redhat.com>
> ---
>  criu/cr-service.c   |  2 ++
>  criu/crtools.c      | 19 +------------------
>  criu/include/util.h |  2 ++
>  criu/util.c         | 18 ++++++++++++++++++
>  4 files changed, 23 insertions(+), 18 deletions(-)
> 
> diff --git a/criu/cr-service.c b/criu/cr-service.c
> index 274ff21..30d537a 100644
> --- a/criu/cr-service.c
> +++ b/criu/cr-service.c
> @@ -307,6 +307,8 @@ static int setup_opts_from_req(int sk, CriuOpts *req)
>  		goto err;
>  	}
>  
> +	print_versions();
> +
>  	/* checking flags from client */
>  	if (req->has_leave_running && req->leave_running)
>  		opts.final_state = TASK_ALIVE;
> diff --git a/criu/crtools.c b/criu/crtools.c
> index 1fe7aab..17e16ce 100644
> --- a/criu/crtools.c
> +++ b/criu/crtools.c
> @@ -21,7 +21,6 @@
>  
>  #include <sys/time.h>
>  #include <sys/resource.h>
> -#include <sys/utsname.h>
>  
>  #include "int.h"
>  #include "page.h"
> @@ -422,20 +421,6 @@ static void init_configuration(int argc, char *argv[], int defaults_forbidden)
>  	}
>  }
>  
> -static void print_kernel_version(void)
> -{
> -	struct utsname buf;
> -
> -	if (uname(&buf) < 0) {
> -		pr_perror("Reading kernel version failed!");
> -		/* This pretty unlikely, just keep on running. */
> -		return;
> -	}
> -
> -	pr_info("Running on %s %s %s %s %s\n", buf.nodename, buf.sysname,
> -		buf.release, buf.version, buf.machine);
> -}
> -
>  int main(int argc, char *argv[], char *envp[])
>  {
>  #define PARSING_GLOBAL_CONF	1
> @@ -981,9 +966,7 @@ int main(int argc, char *argv[], char *envp[])
>  	libsoccr_set_log(log_level, soccr_print_on_level);
>  	compel_log_init(vprint_on_level, log_get_loglevel());
>  
> -	pr_info("Version: %s (gitid %s)\n", CRIU_VERSION, CRIU_GITID);
> -
> -	print_kernel_version();
> +	print_versions();
>  
>  	if (opts.deprecated_ok)
>  		pr_debug("DEPRECATED ON\n");
> diff --git a/criu/include/util.h b/criu/include/util.h
> index 8a1718c..377ef20 100644
> --- a/criu/include/util.h
> +++ b/criu/include/util.h
> @@ -380,4 +380,6 @@ static inline void print_stack_trace(pid_t pid) {}
>  		___ret;									\
>  	})
>  
> +extern void print_versions(void);
> +
>  #endif /* __CR_UTIL_H__ */
> diff --git a/criu/util.c b/criu/util.c
> index b19bf51..1605e11 100644
> --- a/criu/util.c
> +++ b/criu/util.c
> @@ -34,6 +34,7 @@
>  #include <netinet/tcp.h>
>  #include <sched.h>
>  #include <ctype.h>
> +#include <sys/utsname.h>
>  
>  #include "bitops.h"
>  #include "page.h"
> @@ -53,6 +54,7 @@
>  #include "cr-service.h"
>  #include "files.h"
>  #include "pstree.h"
> +#include "version.h"
>  
>  #include "cr-errno.h"
>  
> @@ -1623,3 +1625,19 @@ pid_t fork()
>  {
>  	return sys_clone_unified(SIGCHLD, 0, NULL, NULL, 0);
>  }
> +
> +void print_versions(void)
> +{
> +	struct utsname buf;
> +
> +	pr_info("Version: %s (gitid %s)\n", CRIU_VERSION, CRIU_GITID);
> +
> +	if (uname(&buf) < 0) {
> +		pr_perror("Reading kernel version failed!");
> +		/* This pretty unlikely, just keep on running. */
> +		return;
> +	}
> +
> +	pr_info("Running on %s %s %s %s %s\n", buf.nodename, buf.sysname,
> +		buf.release, buf.version, buf.machine);
> +}
> -- 
> 1.8.3.1
> 
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu


More information about the CRIU mailing list