[CRIU] [PATCH 6/7] exec: Initial skeleton
Pavel Emelyanov
xemul at parallels.com
Mon Dec 17 15:31:13 EST 2012
Reserve the cmdline option for this and link empty file.
Signed-off-by: Pavel Emelyanov <xemul at parallels.com>
---
Makefile | 1 +
cr-exec.c | 10 ++++++++++
crtools.c | 10 +++++++++-
include/crtools.h | 1 +
4 files changed, 21 insertions(+), 1 deletions(-)
create mode 100644 cr-exec.c
diff --git a/Makefile b/Makefile
index 18db408..95580eb 100644
--- a/Makefile
+++ b/Makefile
@@ -116,6 +116,7 @@ OBJS += signalfd.o
OBJS += pstree.o
OBJS += protobuf.o
OBJS += tty.o
+OBJS += cr-exec.o
DEPS := $(patsubst %.o,%.d,$(OBJS))
diff --git a/cr-exec.c b/cr-exec.c
new file mode 100644
index 0000000..b32099a
--- /dev/null
+++ b/cr-exec.c
@@ -0,0 +1,10 @@
+#include <unistd.h>
+#include <string.h>
+#include "crtools.h"
+#include "ptrace.h"
+#include "parasite-syscall.h"
+
+int cr_exec(int pid, char **opt)
+{
+ return -1;
+}
diff --git a/crtools.c b/crtools.c
index 5e58b40..b4f4b53 100644
--- a/crtools.c
+++ b/crtools.c
@@ -252,7 +252,8 @@ int main(int argc, char *argv[])
if (strcmp(argv[optind], "dump") &&
strcmp(argv[optind], "restore") &&
strcmp(argv[optind], "show") &&
- strcmp(argv[optind], "check")) {
+ strcmp(argv[optind], "check") &&
+ strcmp(argv[optind], "exec")) {
pr_err("Unknown command %s\n", argv[optind]);
goto usage;
}
@@ -274,6 +275,11 @@ int main(int argc, char *argv[])
case 'c':
ret = cr_check();
break;
+ case 'e':
+ if (!pid)
+ goto opt_pid_missing;
+ ret = cr_exec(pid, argv + optind + 1);
+ break;
default:
goto usage;
break;
@@ -287,12 +293,14 @@ usage:
pr_msg(" %s restore -t pid [<options>]\n", argv[0]);
pr_msg(" %s show (-D dir)|(-f file) [<options>]\n", argv[0]);
pr_msg(" %s check\n", argv[0]);
+ pr_msg(" %s exec -t pid <syscall-string>\n", argv[0]);
pr_msg("\nCommands:\n");
pr_msg(" dump checkpoint a process/tree identified by pid\n");
pr_msg(" restore restore a process/tree identified by pid\n");
pr_msg(" show show dump file(s) contents\n");
pr_msg(" check checks whether the kernel support is up-to-date\n");
+ pr_msg(" exec execute a system call by other task\n");
if (argc < 2) {
pr_msg("\nTry -h|--help for more info\n");
diff --git a/include/crtools.h b/include/crtools.h
index 799ea6e..0a07b41 100644
--- a/include/crtools.h
+++ b/include/crtools.h
@@ -196,6 +196,7 @@ int cr_restore_tasks(pid_t pid, struct cr_options *opts);
int cr_show(struct cr_options *opts);
int convert_to_elf(char *elf_path, int fd_core);
int cr_check(void);
+int cr_exec(int pid, char **opts);
#define O_DUMP (O_RDWR | O_CREAT | O_EXCL)
#define O_SHOW (O_RDONLY)
--
1.7.1
More information about the CRIU
mailing list