[CRIU] [PATCH 21/22] cr-restore.c: Introduced the macro CONFIG_DEBUG_RESTORE to stop restoration after a fork.

Alexander Kartashov alekskartashov at parallels.com
Thu Dec 27 01:51:12 EST 2012


Signed-off-by: Alexander Kartashov <alekskartashov at parallels.com>
---
 cr-restore.c |   14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/cr-restore.c b/cr-restore.c
index abdd6e2..fe405a2 100644
--- a/cr-restore.c
+++ b/cr-restore.c
@@ -992,6 +992,13 @@ static int restore_task_with_children(void *_arg)
 	int ret;
 	sigset_t blockmask;
 
+#ifdef CONFIG_DEBUG_RESTORE
+	if (kill(getpid(), SIGSTOP) < 0) {
+		pr_err("Failed to stop oneself: %d\n", errno);
+		return -1;
+	}
+#endif
+
 	close_safe(&ca->fd);
 
 	current = ca->item;
@@ -1114,6 +1121,8 @@ static int restore_switch_stage(int next_stage)
 static int restore_root_task(struct pstree_item *init, struct cr_options *opts)
 {
 	int ret;
+
+#ifndef CONFIG_DEBUG_RESTORE
 	struct sigaction act, old_act;
 
 	ret = sigaction(SIGCHLD, NULL, &act);
@@ -1132,6 +1141,7 @@ static int restore_root_task(struct pstree_item *init, struct cr_options *opts)
 		pr_perror("sigaction() failed\n");
 		return -1;
 	}
+#endif
 
 	/*
 	 * FIXME -- currently we assume that all the tasks live
@@ -1177,12 +1187,16 @@ static int restore_root_task(struct pstree_item *init, struct cr_options *opts)
 
 	futex_wait_until(&task_entries->nr_in_progress, 0);
 
+
+#ifndef CONFIG_DEBUG_RESTORE
 	/* Restore SIGCHLD here to skip SIGCHLD from a network sctip */
+
 	ret = sigaction(SIGCHLD, &old_act, NULL);
 	if (ret < 0) {
 		pr_perror("sigaction() failed\n");
 		goto out;
 	}
+#endif
 
 	network_unlock();
 out:
-- 
1.7.10.4



More information about the CRIU mailing list