[CRIU] [PATCH] crtools: initial skeleton for cr_service()

Ruslan Kuprieiev kupruser at gmail.com
Wed Sep 4 08:26:25 EDT 2013


Initial skeleton for cr_service() -- function to provide access to criu 
using protobuf args through unix socket.
-------------- next part --------------
diff --git a/Makefile.crtools b/Makefile.crtools
index 33a9c70..d1c37e8 100644
--- a/Makefile.crtools
+++ b/Makefile.crtools
@@ -53,6 +53,7 @@ obj-y	+= stats.o
 obj-y	+= string.o
 obj-y	+= sigframe.o
 obj-y	+= arch/$(ARCH)/vdso.o
+obj-y	+= cr-service.o
 
 ifneq ($(MAKECMDGOALS),clean)
 incdeps := y
diff --git a/cr-service.c b/cr-service.c
new file mode 100644
index 0000000..e921828
--- /dev/null
+++ b/cr-service.c
@@ -0,0 +1,4 @@
+int cr_service(void)
+{
+	return 0;
+}
diff --git a/crtools.c b/crtools.c
index c7bc8b4..6642dde 100644
--- a/crtools.c
+++ b/crtools.c
@@ -334,6 +334,9 @@ int main(int argc, char *argv[])
 	if (!strcmp(argv[optind], "page-server"))
 		return cr_page_server(opts.restore_detach);
 
+	if (!strcmp(argv[optind], "service"))
+		return cr_service();
+
 	pr_msg("Unknown command \"%s\"\n", argv[optind]);
 usage:
 	pr_msg("\n"
@@ -344,6 +347,7 @@ usage:
 "  criu check [--ms]\n"
 "  criu exec -p PID <syscall-string>\n"
 "  criu page-server\n"
+"  criu service [<options>]\n"
 "\n"
 "Commands:\n"
 "  dump           checkpoint a process/tree identified by pid\n"
@@ -353,6 +357,7 @@ usage:
 "  check          checks whether the kernel support is up-to-date\n"
 "  exec           execute a system call by other task\n"
 "  page-server    launch page server\n"
+"  service        launch service server\n"
 	);
 
 	if (argc < 2) {
@@ -403,6 +408,9 @@ usage:
 "  --port PORT           port of page server\n"
 "  -d|--daemon           run in the background after creating socket\n"
 "\n"
+"Service server options\n"
+"  --address ADDR        address, where to put service socket\n"
+"\n"
 "Show options:\n"
 "  -f|--file FILE        show contents of a checkpoint file\n"
 "  -D|--images-dir DIR   directory where to get images from\n"
diff --git a/include/crtools.h b/include/crtools.h
index 3c90b29..d867522 100644
--- a/include/crtools.h
+++ b/include/crtools.h
@@ -119,6 +119,7 @@ int cr_show(int pid);
 int convert_to_elf(char *elf_path, int fd_core);
 int cr_check(void);
 int cr_exec(int pid, char **opts);
+int cr_service(void);
 
 #define O_DUMP	(O_RDWR | O_CREAT | O_EXCL)
 #define O_SHOW	(O_RDONLY)


More information about the CRIU mailing list