diff --git a/Makefile b/Makefile index 18db408fd..95580eb18 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 000000000..b32099a93 --- /dev/null +++ b/cr-exec.c @@ -0,0 +1,10 @@ +#include +#include +#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 5e58b40e9..b4f4b5381 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 []\n", argv[0]); pr_msg(" %s show (-D dir)|(-f file) []\n", argv[0]); pr_msg(" %s check\n", argv[0]); + pr_msg(" %s exec -t pid \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 799ea6ed9..0a07b412d 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)