From bed49b39eaf2bb62b8cd49839f58228b4119a402 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Thu, 8 Mar 2018 19:46:06 +0000 Subject: [PATCH] Print CRIU and kernel version also in RPC mode 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 --- 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 274ff218b..30d537a01 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 1fe7aabf2..17e16ce86 100644 --- a/criu/crtools.c +++ b/criu/crtools.c @@ -21,7 +21,6 @@ #include #include -#include #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 8a1718c1e..377ef20f3 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 b19bf5175..1605e1162 100644 --- a/criu/util.c +++ b/criu/util.c @@ -34,6 +34,7 @@ #include #include #include +#include #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); +}