2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-09-02 23:35:21 +00:00

exec: Initial skeleton

Reserve the cmdline option for this and link empty file.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Pavel Emelyanov
2012-12-17 22:56:06 +03:00
parent 45fdee04fb
commit 4bb4ece76e
4 changed files with 21 additions and 1 deletions

View File

@@ -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))

10
cr-exec.c Normal file
View File

@@ -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;
}

View File

@@ -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[])
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:
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");

View File

@@ -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)