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 <areber@redhat.com>
This commit is contained in:
Adrian Reber 2018-03-08 19:46:06 +00:00 committed by Andrei Vagin
parent 001ea53388
commit 780d6ea01d
4 changed files with 23 additions and 17 deletions

View file

@ -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;

View file

@ -235,20 +235,6 @@ static void soccr_print_on_level(unsigned int loglevel, const char *format, ...)
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)
{
struct rlimit new;
@ -764,9 +750,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");

View file

@ -377,4 +377,6 @@ static inline void print_stack_trace(pid_t pid) {}
___ret; \
})
extern void print_versions(void);
#endif /* __CR_UTIL_H__ */

View file

@ -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"
@ -1512,3 +1514,19 @@ void print_stack_trace(pid_t pid)
free(strings);
}
#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);
}