Commit 2e944f72 authored by Pavel Emelyanov's avatar Pavel Emelyanov Committed by Andrei Vagin

infect: Add log_fd on ictx

This is the descriptor to be used by parasite code for
messages. In pure compel environment this will have to
be some file provided by caller or a pipe from which
libcompel will pull messages.
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent 2a014c09
...@@ -109,6 +109,8 @@ struct infect_ctx { ...@@ -109,6 +109,8 @@ struct infect_ctx {
void (*child_handler)(int, siginfo_t *, void *); /* hander for SIGCHLD deaths */ void (*child_handler)(int, siginfo_t *, void *); /* hander for SIGCHLD deaths */
open_proc_fn open_proc; open_proc_fn open_proc;
int log_fd; /* fd for parasite code to send messages to */
}; };
extern struct infect_ctx *compel_infect_ctx(struct parasite_ctl *); extern struct infect_ctx *compel_infect_ctx(struct parasite_ctl *);
......
...@@ -575,7 +575,7 @@ static int parasite_init_daemon(struct parasite_ctl *ctl) ...@@ -575,7 +575,7 @@ static int parasite_init_daemon(struct parasite_ctl *ctl)
if (accept_tsock(ctl) < 0) if (accept_tsock(ctl) < 0)
goto err; goto err;
if (compel_util_send_fd(ctl, log_get_fd())) if (compel_util_send_fd(ctl, ctl->ictx.log_fd))
goto err; goto err;
pr_info("Wait for parasite being daemonized...\n"); pr_info("Wait for parasite being daemonized...\n");
...@@ -768,6 +768,9 @@ int compel_infect(struct parasite_ctl *ctl, unsigned long nr_threads, unsigned l ...@@ -768,6 +768,9 @@ int compel_infect(struct parasite_ctl *ctl, unsigned long nr_threads, unsigned l
int ret; int ret;
unsigned long p, map_exchange_size, parasite_size = 0; unsigned long p, map_exchange_size, parasite_size = 0;
if (ctl->ictx.log_fd < 0)
goto err;
if (!arch_can_dump_task(ctl)) if (!arch_can_dump_task(ctl))
goto err; goto err;
...@@ -858,6 +861,7 @@ struct parasite_ctl *compel_prepare(int pid) ...@@ -858,6 +861,7 @@ struct parasite_ctl *compel_prepare(int pid)
} }
ctl->tsock = -1; ctl->tsock = -1;
ctl->ictx.log_fd = -1;
if (compel_prepare_thread(pid, &ctl->orig)) if (compel_prepare_thread(pid, &ctl->orig))
goto err; goto err;
......
...@@ -562,6 +562,8 @@ struct parasite_ctl *parasite_infect_seized(pid_t pid, struct pstree_item *item, ...@@ -562,6 +562,8 @@ struct parasite_ctl *parasite_infect_seized(pid_t pid, struct pstree_item *item,
if (kdat.has_compat_sigreturn) if (kdat.has_compat_sigreturn)
ictx->flags |= INFECT_HAS_COMPAT_SIGRETURN; ictx->flags |= INFECT_HAS_COMPAT_SIGRETURN;
ictx->log_fd = log_get_fd();
parasite_ensure_args_size(dump_pages_args_size(vma_area_list)); parasite_ensure_args_size(dump_pages_args_size(vma_area_list));
parasite_ensure_args_size(aio_rings_args_size(vma_area_list)); parasite_ensure_args_size(aio_rings_args_size(vma_area_list));
......
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