No description
Find a file
Cyrill Gorcunov 24864ae75b parasite: Prepare structures for daemon mode
Parasite daemon mode might be considered as a series
of network messages sent from main crtools module to
parasite daemon which spins on a socket waiting for
command to handle.

Simple command handling session might look as

        crtools                     daemon
        |                           |                           |
        | ---> command message ---> |                           |
        |                           | ---> receive command ---> |
        |                           |           ....            |
        |                           |       handle command      |
        |                           |           ....            |
        |                           | <--- send ack       <---  |
        | <--- receive ack     <--- |                           |
        |                           |                           |
        v                           v                           v
      time

where, in case of multithread application [handle command] stage
includes waking up of children threads via futexes, wait until
handling complete and only then send ack back to ctrools module.

This patch brings in description of command message as

struct ctl_msg {
    unsigned int    id;     /* command recipient */
    unsigned int    cmd;    /* command itself */
    unsigned int    ack;    /* ack on command */
    int             err;    /* error code on reply */
};

For example, in case of dumpee being with pid 2 and acquiring
to handle PARASITE_CMD_DUMP_MISC, the command/ack series will look
as

    cmd-msg
    -------
    .id     = 2,
    .cmd    = PARASITE_CMD_DUMP_MISC,
    .ack    = 0,
    .err    = 0,

    ack-msg
    -------
    .id     = 2,
    .cmd    = PARASITE_CMD_DUMP_MISC,
    .ack    = PARASITE_CMD_DUMP_MISC,
    .err    = 0

in case if error happened in parasite, the @err field set accordingly.

For convenience ctl_msg_cmd()/ctl_msg_ack() macros are provided
for control message generations.

v2: delete futex_t ack from tid_state_s

Fixed-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-24 20:09:39 +04:00
arch parasite-syscall: Add "trap" postfix to parasite execute functions 2013-05-24 19:57:55 +04:00
Documentation Documentation/Makefile: fix clean target 2013-05-10 11:01:57 +04:00
include parasite: Prepare structures for daemon mode 2013-05-24 20:09:39 +04:00
pie parasite: Prepare structures for daemon mode 2013-05-24 20:09:39 +04:00
protobuf protobuf: Prepare scaffolds for procfs NS entries 2013-05-18 03:37:00 +04:00
scripts make: config -- Add test for prlimit call 2013-05-23 15:12:56 +04:00
test zdtm: check one-shot posix timers 2013-05-24 13:04:52 +04:00
.gitignore crtools: rename binary to criu 2013-04-30 20:17:55 +04:00
.mailmap repo: Add mailmap file 2012-03-25 23:31:20 +04:00
COPYING Add LGPL licence for library directory 2013-04-01 12:29:06 +04:00
cr-check.c cr: Fix permissions on several files 2013-05-15 17:50:57 +04:00
cr-dump.c dump: save registers when the task is already infected 2013-05-24 19:28:34 +04:00
cr-exec.c parasite: use transparent thread indexes 2013-05-24 18:47:11 +04:00
cr-restore.c restore: construct sigframe in crtools 2013-05-24 17:39:52 +04:00
cr-show.c protobuf: Prepare scaffolds for procfs NS entries 2013-05-18 03:37:00 +04:00
CREDITS Add the CREDITS file 2012-07-30 13:52:37 +04:00
crtools crtools: rename binary to criu 2013-04-30 20:17:55 +04:00
crtools.c page-server: introduce the --daemon long option 2013-05-20 19:11:19 +04:00
eventfd.c show: Remove options args from ->show callback 2013-05-08 00:23:42 +04:00
eventpoll.c show: Remove options args from ->show callback 2013-05-08 00:23:42 +04:00
fifo.c Fix typos in comments 2013-04-15 12:46:46 +04:00
file-ids.c x86: moved x86-specific files into the directory arch/x86. 2013-01-09 17:02:47 +04:00
file-lock.c Fix typos in log messages 2013-04-15 12:46:25 +04:00
files-reg.c files: Add ability to use read link in dump_one_reg_file 2013-05-18 03:36:54 +04:00
files.c ns: Add c/r for /proc/$pid/ns/$ids references 2013-05-18 04:00:05 +04:00
fsnotify.c show: Remove options args from ->show callback 2013-05-08 00:23:42 +04:00
image.c protobuf: Prepare scaffolds for procfs NS entries 2013-05-18 03:37:00 +04:00
ipc_ns.c ipc_ns: allocate enough memrory for the buffer 2013-05-21 19:06:03 +04:00
kcmp-ids.c x86: moved x86-specific files into the directory arch/x86. 2013-01-09 17:02:47 +04:00
kerndat.c pagemap: Move PME_ constants to the header 2013-05-23 12:50:43 +04:00
libnetlink.c netlink: return errno from do_rtnl_req 2013-03-28 18:21:11 +04:00
log.c log: log_init -- Check for dup return code 2013-04-12 20:50:27 +04:00
Makefile vdso: Introduce vdso pie-engine 2013-05-24 13:27:13 +04:00
Makefile.config make: config -- Add test for prlimit call 2013-05-23 15:12:56 +04:00
Makefile.crtools restore: add a function for constructing sigframe 2013-05-24 17:39:49 +04:00
Makefile.inc Makefiles: add install target 2013-05-03 01:56:30 +04:00
mem.c parasite-syscall: Add "trap" postfix to parasite execute functions 2013-05-24 19:57:55 +04:00
mount.c ns: Extend ns_desc to carry the length of the ns name 2013-05-18 03:36:56 +04:00
namespaces.c ns: Add c/r for /proc/$pid/ns/$ids references 2013-05-18 04:00:05 +04:00
net.c ns: Extend ns_desc to carry the length of the ns name 2013-05-18 03:36:56 +04:00
netfilter.c Don't use \Newline in pr_perror 2013-05-16 17:05:45 +04:00
page-pipe.c page-pipe: fixed format strings 2013-04-30 18:31:34 +04:00
page-read.c page-read: fixed format strings 2013-04-30 18:31:35 +04:00
page-xfer.c page-server: Add daemonize call return check 2013-05-21 19:05:15 +04:00
parasite-syscall.c parasite-syscall: Add "trap" postfix to parasite execute functions 2013-05-24 19:57:55 +04:00
pipes.c img: Get rid of open_image_ro helper 2013-04-09 19:22:21 +04:00
proc_parse.c proc: Don't mark mishinted vdso 2013-05-24 13:27:21 +04:00
protobuf.c protobuf: Prepare scaffolds for procfs NS entries 2013-05-18 03:37:00 +04:00
pstree.c parasite: use transparent thread indexes 2013-05-24 18:47:11 +04:00
ptrace.c Change crtools to criu in criu messages 2013-05-10 11:02:20 +04:00
rbtree.c code: Fix spaced indentation where found 2012-08-11 21:36:03 +04:00
README README: crtools to criu rename 2013-05-10 11:02:02 +04:00
shmem.c shmem: Print shmem ID on dump in decimal 2013-05-16 16:20:17 +04:00
sigframe.c restore: construct sigframe in crtools 2013-05-24 17:39:52 +04:00
signalfd.c show: Remove options args from ->show callback 2013-05-08 00:23:42 +04:00
sk-inet.c show: Remove options args from ->show callback 2013-05-08 00:23:42 +04:00
sk-netlink.c show: Remove options args from ->show callback 2013-05-08 00:23:42 +04:00
sk-packet.c show: Remove options args from ->show callback 2013-05-08 00:23:42 +04:00
sk-queue.c show: Remove options args from ->show callback 2013-05-08 00:23:42 +04:00
sk-tcp.c make: Introduce compile time include/config.h generation 2013-05-20 16:02:14 +04:00
sk-unix.c show: Remove options args from ->show callback 2013-05-08 00:23:42 +04:00
sockets.c Change crtools to criu in comments 2013-05-10 11:02:27 +04:00
stats.c mem/stats: Add stats about memory dumping 2013-05-15 15:46:07 +04:00
sysctl.c sysctl: Don't forget to close fds 2013-04-05 08:23:17 +04:00
tty.c tty: Don't try to restore a group on inherited terminal if session leader present 2013-05-07 22:35:33 +04:00
util.c proc: use vma flags for determing vmas with MAP_GROWSDOWN 2013-05-21 19:03:57 +04:00
uts_ns.c ns: Extend ns_desc to carry the length of the ns name 2013-05-18 03:36:56 +04:00

criu
====

An utility to checkpoint/restore tasks.

Some code snippets are borrowed from

 - Linux kernel (http://kernel.org/)
 - git (http://git-scm.com/)
 - kvm-tools (https://github.com/penberg/linux-kvm)
 - ptrace-parasite (https://code.google.com/p/ptrace-parasite/)

Many thanks to these projects.

Licensed under GPLv2 (http://www.gnu.org/licenses/gpl-2.0.txt)