[CRIU] [PATCH 08/21] dump: dumping signals when a task is stopped

Andrey Vagin avagin at openvz.org
Fri May 24 08:20:11 EDT 2013


Currently it's always stopped, but it will be changed, when a parasite
will be executed as a daemon.

Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
 cr-dump.c | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/cr-dump.c b/cr-dump.c
index 95be08e..73e021d 100644
--- a/cr-dump.c
+++ b/cr-dump.c
@@ -1146,6 +1146,8 @@ static int dump_signal_queue(pid_t tid, int fd, bool group)
 	siginfo_t siginfo[32]; /* One page or all non-rt signals */
 	int ret, i = 0, j, nr;
 
+	pr_debug("Dump %s signals of %d\n", group ? "shared" : "private", tid);
+
 	arg.nr = sizeof(siginfo) / sizeof(siginfo_t);
 	arg.flags = 0;
 	if (group)
@@ -1206,14 +1208,11 @@ static int dump_task_threads(struct parasite_ctl *parasite_ctl,
 
 	for (i = 0; i < item->nr_threads; i++) {
 		/* Leader is already dumped */
-		if (item->pid.real == item->threads[i].real)
+		if (item->pid.real == item->threads[i].real) {
 			item->threads[i].virt = item->pid.virt;
-		else {
-			if (dump_task_thread(parasite_ctl, item, i))
-				return -1;
+			continue;
 		}
-
-		if (dump_thread_signals(&item->threads[i]))
+		if (dump_task_thread(parasite_ctl, item, i))
 			return -1;
 	}
 
@@ -1389,7 +1388,7 @@ static int dump_one_task(struct pstree_item *item)
 	pid_t pid = item->pid.real;
 	struct vm_area_list vmas;
 	struct parasite_ctl *parasite_ctl;
-	int ret = -1;
+	int i, ret = -1;
 	struct parasite_dump_misc misc;
 	struct cr_fdset *cr_fdset = NULL;
 	struct parasite_drain_fd *dfds;
@@ -1557,6 +1556,12 @@ static int dump_one_task(struct pstree_item *item)
 		goto err_cure;
 	}
 
+	for (i = 0; i < item->nr_threads; i++) {
+		ret = dump_thread_signals(&item->threads[i]);
+		if (ret)
+			goto err;
+	}
+
 	close_cr_fdset(&cr_fdset);
 err:
 	close_pid_proc();
-- 
1.8.2



More information about the CRIU mailing list