Commit c39e7590 authored by Pavel Emelyanov's avatar Pavel Emelyanov Committed by Cyrill Gorcunov

check: Initial skeleton

Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
parent ce778017
......@@ -32,6 +32,7 @@ OBJS += crtools.o
OBJS += proc_parse.o
OBJS += cr-dump.o
OBJS += cr-show.o
OBJS += cr-check.o
OBJS += util.o
OBJS += util-net.o
OBJS += sysctl.o
......
#include "crtools.h"
#include "log.h"
int cr_check(void)
{
return 0;
}
......@@ -300,7 +300,7 @@ int main(int argc, char *argv[])
BUILD_BUG_ON(PAGE_SIZE != PAGE_IMAGE_SIZE);
if (argc < 3)
if (argc < 2)
goto usage;
action = argv[1][0];
......@@ -386,12 +386,13 @@ int main(int argc, char *argv[])
return -1;
}
if (!pid && (action != 's' || !opts.show_dump_file))
if (!pid && (action != 'c') && (action != 's' || !opts.show_dump_file))
goto opt_pid_missing;
if (strcmp(argv[1], "dump") &&
strcmp(argv[1], "restore") &&
strcmp(argv[1], "show")) {
strcmp(argv[1], "show") &&
strcmp(argv[1], "check")) {
pr_err("Unknown command");
goto usage;
}
......@@ -406,6 +407,9 @@ int main(int argc, char *argv[])
case 's':
ret = cr_show(pid, &opts);
break;
case 'c':
ret = cr_check();
break;
default:
goto usage;
break;
......@@ -418,11 +422,13 @@ usage:
pr_msg(" %s dump [-c] -p|-t pid [-n ns]\n", argv[0]);
pr_msg(" %s restore -p|-t pid [-n ns]\n", argv[0]);
pr_msg(" %s show [-c] (-p|-t pid)|(-f file)\n", argv[0]);
pr_msg(" %s check\n", argv[0]);
pr_msg("\nCommands:\n");
pr_msg(" dump checkpoint a process identified by pid\n");
pr_msg(" restore restore a process identified by pid\n");
pr_msg(" show show dump contents of a process identified by pid\n");
pr_msg(" check checks whether the kernel support is up-to-date\n");
pr_msg("\nGeneral parameters:\n");
pr_msg(" -p checkpoint/restore only a single process identified by pid\n");
pr_msg(" -t checkpoint/restore the whole process tree identified by pid\n");
......
......@@ -126,6 +126,7 @@ int cr_dump_tasks(pid_t pid, struct cr_options *opts);
int cr_restore_tasks(pid_t pid, struct cr_options *opts);
int cr_show(unsigned long pid, struct cr_options *opts);
int convert_to_elf(char *elf_path, int fd_core);
int cr_check(void);
struct cr_fdset *cr_dump_fdset_open(int pid, unsigned long use_mask, struct cr_fdset *);
struct cr_fdset *cr_show_fdset_open(int pid, unsigned long use_mask);
......
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