2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-30 13:58:34 +00:00

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 c66ce3095f
commit bed49b39ea
4 changed files with 23 additions and 18 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

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

View File

@ -380,4 +380,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"
@ -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);
}