mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-31 14:25:49 +00:00
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: Pavel Emelyanov <xemul@virtuozzo.com> Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
This commit is contained in:
committed by
Andrei Vagin
parent
7745501409
commit
3569b51eef
@@ -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))
|
||||
|
Reference in New Issue
Block a user