[CRIU] [PATCH 1/4] parasite: transfer numbers of parasite descirptors to the criu process

Andrey Vagin avagin at openvz.org
Thu Mar 31 22:53:25 PDT 2016


From: Andrew Vagin <avagin at virtuozzo.com>

We are going to collect descriptors when a parasite is injected,
so we need to know which descriptors should not be dumped.

Signed-off-by: Andrew Vagin <avagin at virtuozzo.com>
---
 criu/include/parasite-syscall.h | 2 ++
 criu/include/parasite.h         | 2 ++
 criu/parasite-syscall.c         | 2 ++
 criu/pie/parasite.c             | 4 +++-
 4 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/criu/include/parasite-syscall.h b/criu/include/parasite-syscall.h
index 04d2602..0251a3f 100644
--- a/criu/include/parasite-syscall.h
+++ b/criu/include/parasite-syscall.h
@@ -53,6 +53,8 @@ struct parasite_ctl {
 	unsigned long		args_size;
 	int			tsock;					/* transport socket for transfering fds */
 
+	int			ptsock, plogfd;				/* tsock and logfd in a target process */
+
 	struct list_head	pre_list;
 	struct page_pipe	*mem_pp;
 };
diff --git a/criu/include/parasite.h b/criu/include/parasite.h
index 341a8e5..1319cb6 100644
--- a/criu/include/parasite.h
+++ b/criu/include/parasite.h
@@ -74,6 +74,8 @@ struct parasite_init_args {
 	struct rt_sigframe	*sigframe;
 
 	void			*sigreturn_addr;
+
+	int tsock, logfd;
 };
 
 struct parasite_unmap_args {
diff --git a/criu/parasite-syscall.c b/criu/parasite-syscall.c
index 8866965..8fd6203 100644
--- a/criu/parasite-syscall.c
+++ b/criu/parasite-syscall.c
@@ -534,6 +534,8 @@ static int parasite_init_daemon(struct parasite_ctl *ctl, struct ns_id *net)
 
 	ctl->sigreturn_addr = args->sigreturn_addr;
 	ctl->daemonized = true;
+	ctl->ptsock = args->tsock;
+	ctl->plogfd = args->logfd;
 	pr_info("Parasite %d has been switched to daemon mode\n", pid);
 	return 0;
 err:
diff --git a/criu/pie/parasite.c b/criu/pie/parasite.c
index 5b45048..6ec2a17 100644
--- a/criu/pie/parasite.c
+++ b/criu/pie/parasite.c
@@ -752,10 +752,12 @@ static noinline __used int parasite_init_daemon(void *data)
 	if (ret >= 0) {
 		log_set_fd(ret);
 		log_set_loglevel(args->log_level);
-		ret = 0;
 	} else
 		goto err;
 
+	args->tsock = tsock;
+	args->logfd = ret;
+
 	parasite_daemon(data);
 
 err:
-- 
2.5.0



More information about the CRIU mailing list