[CRIU] [crtools-bot for Pavel Emelyanov ] check: Initial skeleton

Cyrill Gorcunov gorcunov at openvz.org
Fri Mar 2 05:15:09 EST 2012


The commit is pushed to "master" and will appear on git://github.com/cyrillos/crtools.git
------>
commit c39e75904892d3661e19b8649db83834f35a47e4
Author: Pavel Emelyanov <xemul at parallels.com>
Date:   Fri Mar 2 14:01:08 2012 +0400

    check: Initial skeleton
    
    Signed-off-by: Pavel Emelyanov <xemul at parallels.com>
    Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 Makefile          |    1 +
 cr-check.c        |    7 +++++++
 crtools.c         |   12 +++++++++---
 include/crtools.h |    1 +
 4 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 6bf0909..2753553 100644
--- a/Makefile
+++ b/Makefile
@@ -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
diff --git a/cr-check.c b/cr-check.c
new file mode 100644
index 0000000..3383b37
--- /dev/null
+++ b/cr-check.c
@@ -0,0 +1,7 @@
+#include "crtools.h"
+#include "log.h"
+
+int cr_check(void)
+{
+	return 0;
+}
diff --git a/crtools.c b/crtools.c
index db68b77..469a7b3 100644
--- a/crtools.c
+++ b/crtools.c
@@ -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");
diff --git a/include/crtools.h b/include/crtools.h
index e110218..ac4f03a 100644
--- a/include/crtools.h
+++ b/include/crtools.h
@@ -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);


More information about the CRIU mailing list