Commit 3569b51e authored by Pavel Emelyanov's avatar Pavel Emelyanov Committed by Andrei Vagin

infect: Place sigchild handler on ictx

To track victim health state criu sets up the sigchild handler.
So will have to do the compel, but the ability to request for
own handler would be required.
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent 77455014
......@@ -29,6 +29,8 @@ struct thread_ctx {
struct infect_ctx {
int *p_sock;
unsigned long flags; /* fine-tune (e.g. faults) */
void (*child_handler)(int, siginfo_t *, void *); /* hander for SIGCHLD deaths */
};
#define INFECT_NO_MEMFD 0x1 /* don't use memfd() */
......
......@@ -411,10 +411,10 @@ static void sigchld_handler(int signal, siginfo_t *siginfo, void *data)
exit(1);
}
static int setup_child_handler()
static int setup_child_handler(struct parasite_ctl *ctl)
{
struct sigaction sa = {
.sa_sigaction = sigchld_handler,
.sa_sigaction = ctl->ictx.child_handler,
.sa_flags = SA_SIGINFO | SA_RESTART,
};
......@@ -524,7 +524,7 @@ static int parasite_init_daemon(struct parasite_ctl *ctl)
goto err;
/* after this we can catch parasite errors in chld handler */
if (setup_child_handler())
if (setup_child_handler(ctl))
goto err;
regs = ctl->orig.regs;
......@@ -1480,6 +1480,7 @@ struct parasite_ctl *parasite_infect_seized(pid_t pid, struct pstree_item *item,
if (!ctl)
return NULL;
ctl->ictx.child_handler = sigchld_handler;
ctl->ictx.p_sock = &dmpi(item)->netns->net.seqsk;
if (fault_injected(FI_NO_MEMFD))
......
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