criu/include
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
..
asm-generic asm: Add builtin_memcpy, builtin_memcmp generic helpers 2013-05-23 16:51:14 +04:00
bug.h clang: add an exception for BUG_ON_HANDLER 2013-04-04 14:00:21 +04:00
compiler.h include/compiler.h: Cleanup 2013-02-15 17:34:38 +04:00
cpu.h cpu: Make cpu routines being per-acrh 2013-02-18 18:42:08 +04:00
crtools.h protobuf: Prepare scaffolds for procfs NS entries 2013-05-18 03:37:00 +04:00
err.h headers: Add err.h header 2013-04-02 20:27:51 +04:00
eventfd.h show: Remove options args from ->show callback 2013-05-08 00:23:42 +04:00
eventpoll.h show: Remove options args from ->show callback 2013-05-08 00:23:42 +04:00
fifo.h files: pass a file descriptor on an fdinfo image instead of cr_fdset 2013-01-11 14:47:09 +04:00
file-ids.h headers: Change "../protobuf/" to "protobuf/" 2013-02-15 17:33:06 +04:00
file-lock.h lock: Show long option in log message about using one 2013-03-27 20:17:59 +04:00
files-reg.h headers: Change "../protobuf/" to "protobuf/" 2013-02-15 17:33:06 +04:00
files.h ns: Add c/r for /proc/$pid/ns/$ids references 2013-05-18 04:00:05 +04:00
fsnotify.h show: Remove options args from ->show callback 2013-05-08 00:23:42 +04:00
image.h headers: image.h -- Drop asm/types.h inclusion 2013-04-02 20:29:15 +04:00
inet_diag.h headers: Unify include guards (in comments) and a few fixes 2012-12-25 22:40:24 +04:00
ipc_ns.h show: Remove options args from ->show callback 2013-05-08 00:23:42 +04:00
kcmp-ids.h headers: Unify include guards (in comments) and a few fixes 2012-12-25 22:40:24 +04:00
kerndat.h soft-dirty: Check that kernel reports soft-dirty bits 2013-04-15 13:24:32 +04:00
libnetlink.h headers: Unify include guards (in comments) and a few fixes 2012-12-25 22:40:24 +04:00
list.h headers: list.h -- Add hlist helpers 2013-04-02 20:29:25 +04:00
lock.h locks: add futex_wait_while_eq 2013-05-24 16:43:26 +04:00
log-levels.h headers: Unify include guards (in comments) and a few fixes 2012-12-25 22:40:24 +04:00
log.h log: Make pr_err_once to use pr_err 2013-01-14 14:26:07 +04:00
magic.h protobuf: Prepare scaffolds for procfs NS entries 2013-05-18 03:37:00 +04:00
mem.h mem: Add PME_ bits for page frame retrieval 2013-05-23 12:51:27 +04:00
mount.h show: Remove options args from ->show callback 2013-05-08 00:23:42 +04:00
namespaces.h ns: Add c/r for /proc/$pid/ns/$ids references 2013-05-18 04:00:05 +04:00
net.h show: Remove options args from ->show callback 2013-05-08 00:23:42 +04:00
netfilter.h headers: Unify include guards (in comments) and a few fixes 2012-12-25 22:40:24 +04:00
netlink_diag.h crtools: add netlink_diag.h 2013-03-26 00:23:13 +04:00
packet_diag.h headers: Unify include guards (in comments) and a few fixes 2012-12-25 22:40:24 +04:00
page-pipe.h mem: Comment page-read, page-xfer and page-pipe 2013-04-16 11:34:53 +04:00
page-read.h mem: Comment page-read, page-xfer and page-pipe 2013-04-16 11:34:53 +04:00
page-xfer.h page-server: allow to execute page-server in the background (v2) 2013-05-20 15:00:40 +04:00
parasite-syscall.h parasite-syscall: Add "trap" postfix to parasite execute functions 2013-05-24 19:57:55 +04:00
parasite.h parasite: Prepare structures for daemon mode 2013-05-24 20:09:39 +04:00
pipes.h headers: Change "../protobuf/" to "protobuf/" 2013-02-15 17:33:06 +04:00
proc_parse.h mount: free all parts of mnt entries 2013-04-10 01:26:59 +04:00
protobuf.h protobuf: Prepare scaffolds for procfs NS entries 2013-05-18 03:37:00 +04:00
pstree.h parasite: use transparent thread indexes 2013-05-24 18:47:11 +04:00
ptrace.h crtools: dump pending signals (v4) 2013-03-25 23:43:37 +04:00
rbtree.h x86: moved x86-specific files into the directory arch/x86. 2013-01-09 17:02:47 +04:00
restorer.h restore: construct sigframe in crtools 2013-05-24 17:39:52 +04:00
shmem.h headers: Change "../protobuf/" to "protobuf/" 2013-02-15 17:33:06 +04:00
sigframe.h restore: construct sigframe in crtools 2013-05-24 17:39:52 +04:00
signalfd.h show: Remove options args from ->show callback 2013-05-08 00:23:42 +04:00
sk-inet.h show: Remove options args from ->show callback 2013-05-08 00:23:42 +04:00
sk-packet.h show: Remove options args from ->show callback 2013-05-08 00:23:42 +04:00
sk-queue.h show: Remove options args from ->show callback 2013-05-08 00:23:42 +04:00
sockets.h show: Remove options args from ->show callback 2013-05-08 00:23:42 +04:00
stats.h mem/stats: Add stats about memory dumping 2013-05-15 15:46:07 +04:00
syscall-types.h x86: syscall -- Add sys_prlimit64 call 2013-05-23 15:12:57 +04:00
sysctl.h headers: Unify include guards (in comments) and a few fixes 2012-12-25 22:40:24 +04:00
tty.h tty: More descriptive log message about --shell-job requirement 2013-03-27 20:11:00 +04:00
unix_diag.h x86: moved x86-specific files into the directory arch/x86. 2013-01-09 17:02:47 +04:00
util-net.h headers: Unify include guards (in comments) and a few fixes 2012-12-25 22:40:24 +04:00
util.h proc: use vma flags for determing vmas with MAP_GROWSDOWN 2013-05-21 19:03:57 +04:00
uts_ns.h show: Remove options args from ->show callback 2013-05-08 00:23:42 +04:00
vdso.h vdso: Add vdso_put_mark helper 2013-05-24 16:39:41 +04:00
xmalloc.h headers: util.h -- Move memory helpers to xmalloc.h 2013-04-02 21:15:27 +04:00