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); +}