Commit 780d6ea0 authored by Adrian Reber's avatar Adrian Reber Committed by Andrei Vagin

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: 's avatarAdrian Reber <areber@redhat.com>
parent 001ea533
...@@ -307,6 +307,8 @@ static int setup_opts_from_req(int sk, CriuOpts *req) ...@@ -307,6 +307,8 @@ static int setup_opts_from_req(int sk, CriuOpts *req)
goto err; goto err;
} }
print_versions();
/* checking flags from client */ /* checking flags from client */
if (req->has_leave_running && req->leave_running) if (req->has_leave_running && req->leave_running)
opts.final_state = TASK_ALIVE; opts.final_state = TASK_ALIVE;
......
...@@ -235,20 +235,6 @@ static void soccr_print_on_level(unsigned int loglevel, const char *format, ...) ...@@ -235,20 +235,6 @@ static void soccr_print_on_level(unsigned int loglevel, const char *format, ...)
va_end(args); va_end(args);
} }
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);
}
static void rlimit_unlimit_nofile_self(void) static void rlimit_unlimit_nofile_self(void)
{ {
struct rlimit new; struct rlimit new;
...@@ -764,9 +750,7 @@ int main(int argc, char *argv[], char *envp[]) ...@@ -764,9 +750,7 @@ int main(int argc, char *argv[], char *envp[])
libsoccr_set_log(log_level, soccr_print_on_level); libsoccr_set_log(log_level, soccr_print_on_level);
compel_log_init(vprint_on_level, log_get_loglevel()); compel_log_init(vprint_on_level, log_get_loglevel());
pr_info("Version: %s (gitid %s)\n", CRIU_VERSION, CRIU_GITID); print_versions();
print_kernel_version();
if (opts.deprecated_ok) if (opts.deprecated_ok)
pr_debug("DEPRECATED ON\n"); pr_debug("DEPRECATED ON\n");
......
...@@ -377,4 +377,6 @@ static inline void print_stack_trace(pid_t pid) {} ...@@ -377,4 +377,6 @@ static inline void print_stack_trace(pid_t pid) {}
___ret; \ ___ret; \
}) })
extern void print_versions(void);
#endif /* __CR_UTIL_H__ */ #endif /* __CR_UTIL_H__ */
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include <netinet/tcp.h> #include <netinet/tcp.h>
#include <sched.h> #include <sched.h>
#include <ctype.h> #include <ctype.h>
#include <sys/utsname.h>
#include "bitops.h" #include "bitops.h"
#include "page.h" #include "page.h"
...@@ -53,6 +54,7 @@ ...@@ -53,6 +54,7 @@
#include "cr-service.h" #include "cr-service.h"
#include "files.h" #include "files.h"
#include "pstree.h" #include "pstree.h"
#include "version.h"
#include "cr-errno.h" #include "cr-errno.h"
...@@ -1512,3 +1514,19 @@ void print_stack_trace(pid_t pid) ...@@ -1512,3 +1514,19 @@ void print_stack_trace(pid_t pid)
free(strings); free(strings);
} }
#endif #endif
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);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment