[CRIU] [PATCH 11/78] infect: Place sigchild handler on ictx
Cyrill Gorcunov
gorcunov at openvz.org
Mon Nov 7 08:35:56 PST 2016
From: Pavel Emelyanov <xemul at virtuozzo.com>
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 at virtuozzo.com>
---
criu/include/parasite-syscall.h | 2 ++
criu/parasite-syscall.c | 7 ++++---
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/criu/include/parasite-syscall.h b/criu/include/parasite-syscall.h
index b1ca5024fb77..d0ab8c61d56f 100644
--- a/criu/include/parasite-syscall.h
+++ b/criu/include/parasite-syscall.h
@@ -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() */
diff --git a/criu/parasite-syscall.c b/criu/parasite-syscall.c
index f467ea6205e1..55ef1169d57e 100644
--- a/criu/parasite-syscall.c
+++ b/criu/parasite-syscall.c
@@ -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))
--
2.7.4
More information about the CRIU
mailing list