Commit 4bb4ece7 authored by Pavel Emelyanov's avatar Pavel Emelyanov

exec: Initial skeleton

Reserve the cmdline option for this and link empty file.
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 45fdee04
...@@ -116,6 +116,7 @@ OBJS += signalfd.o ...@@ -116,6 +116,7 @@ OBJS += signalfd.o
OBJS += pstree.o OBJS += pstree.o
OBJS += protobuf.o OBJS += protobuf.o
OBJS += tty.o OBJS += tty.o
OBJS += cr-exec.o
DEPS := $(patsubst %.o,%.d,$(OBJS)) DEPS := $(patsubst %.o,%.d,$(OBJS))
......
#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;
}
...@@ -252,7 +252,8 @@ int main(int argc, char *argv[]) ...@@ -252,7 +252,8 @@ int main(int argc, char *argv[])
if (strcmp(argv[optind], "dump") && if (strcmp(argv[optind], "dump") &&
strcmp(argv[optind], "restore") && strcmp(argv[optind], "restore") &&
strcmp(argv[optind], "show") && strcmp(argv[optind], "show") &&
strcmp(argv[optind], "check")) { strcmp(argv[optind], "check") &&
strcmp(argv[optind], "exec")) {
pr_err("Unknown command %s\n", argv[optind]); pr_err("Unknown command %s\n", argv[optind]);
goto usage; goto usage;
} }
...@@ -274,6 +275,11 @@ int main(int argc, char *argv[]) ...@@ -274,6 +275,11 @@ int main(int argc, char *argv[])
case 'c': case 'c':
ret = cr_check(); ret = cr_check();
break; break;
case 'e':
if (!pid)
goto opt_pid_missing;
ret = cr_exec(pid, argv + optind + 1);
break;
default: default:
goto usage; goto usage;
break; break;
...@@ -287,12 +293,14 @@ usage: ...@@ -287,12 +293,14 @@ usage:
pr_msg(" %s restore -t pid [<options>]\n", argv[0]); 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 show (-D dir)|(-f file) [<options>]\n", argv[0]);
pr_msg(" %s check\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("\nCommands:\n");
pr_msg(" dump checkpoint a process/tree identified by pid\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(" restore restore a process/tree identified by pid\n");
pr_msg(" show show dump file(s) contents\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(" 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) { if (argc < 2) {
pr_msg("\nTry -h|--help for more info\n"); pr_msg("\nTry -h|--help for more info\n");
......
...@@ -196,6 +196,7 @@ int cr_restore_tasks(pid_t pid, struct cr_options *opts); ...@@ -196,6 +196,7 @@ int cr_restore_tasks(pid_t pid, struct cr_options *opts);
int cr_show(struct cr_options *opts); int cr_show(struct cr_options *opts);
int convert_to_elf(char *elf_path, int fd_core); int convert_to_elf(char *elf_path, int fd_core);
int cr_check(void); int cr_check(void);
int cr_exec(int pid, char **opts);
#define O_DUMP (O_RDWR | O_CREAT | O_EXCL) #define O_DUMP (O_RDWR | O_CREAT | O_EXCL)
#define O_SHOW (O_RDONLY) #define O_SHOW (O_RDONLY)
......
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