mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-07-28 12:36:47 +00:00
criu: print criu and kernel versions from log_init()
log_init() opens a log file. We want to have criu and kernel versions in each log file, so it looks reasonable to print them from log_init(). Without this patch, versions are not printed, if criu is called in the swrk mode. Reviewed-by: Dmitry Safonov <0x7f454c46@gmail.com> Acked-by: Adrian Reber <areber@redhat.com> Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
This commit is contained in:
parent
8338cbc483
commit
3e86fb12bc
5 changed files with 21 additions and 24 deletions
|
|
@ -307,8 +307,6 @@ 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;
|
||||
|
|
|
|||
|
|
@ -727,8 +727,6 @@ int main(int argc, char *argv[], char *envp[])
|
|||
if (log_init(opts.output))
|
||||
return 1;
|
||||
|
||||
print_versions();
|
||||
|
||||
if (opts.deprecated_ok)
|
||||
pr_debug("DEPRECATED ON\n");
|
||||
|
||||
|
|
|
|||
|
|
@ -377,6 +377,4 @@ static inline void print_stack_trace(pid_t pid) {}
|
|||
___ret; \
|
||||
})
|
||||
|
||||
extern void print_versions(void);
|
||||
|
||||
#endif /* __CR_UTIL_H__ */
|
||||
|
|
|
|||
21
criu/log.c
21
criu/log.c
|
|
@ -9,6 +9,7 @@
|
|||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/resource.h>
|
||||
#include <sys/utsname.h>
|
||||
|
||||
#include <fcntl.h>
|
||||
|
||||
|
|
@ -20,6 +21,8 @@
|
|||
#include "rst-malloc.h"
|
||||
#include "common/lock.h"
|
||||
#include "string.h"
|
||||
#include "version.h"
|
||||
|
||||
#include "../soccr/soccr.h"
|
||||
#include "compel/log.h"
|
||||
|
||||
|
|
@ -135,6 +138,22 @@ char *log_first_err(void)
|
|||
return first_err->s;
|
||||
}
|
||||
|
||||
static 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);
|
||||
}
|
||||
|
||||
int log_init(const char *output)
|
||||
{
|
||||
int new_logfd, fd;
|
||||
|
|
@ -167,6 +186,8 @@ int log_init(const char *output)
|
|||
if (fd < 0)
|
||||
goto err;
|
||||
|
||||
print_versions();
|
||||
|
||||
return 0;
|
||||
|
||||
err:
|
||||
|
|
|
|||
18
criu/util.c
18
criu/util.c
|
|
@ -34,7 +34,6 @@
|
|||
#include <netinet/tcp.h>
|
||||
#include <sched.h>
|
||||
#include <ctype.h>
|
||||
#include <sys/utsname.h>
|
||||
|
||||
#include "bitops.h"
|
||||
#include "page.h"
|
||||
|
|
@ -54,7 +53,6 @@
|
|||
#include "cr-service.h"
|
||||
#include "files.h"
|
||||
#include "pstree.h"
|
||||
#include "version.h"
|
||||
|
||||
#include "cr-errno.h"
|
||||
|
||||
|
|
@ -1517,19 +1515,3 @@ 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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue