[CRIU] [crtools-bot for Pavel Emelyanov ] dump: Sanitize threads dumping

Cyrill Gorcunov gorcunov at openvz.org
Thu Mar 1 10:31:20 EST 2012


The commit is pushed to "master" and will appear on git://github.com/cyrillos/crtools.git
------>
commit 3f256945f2f300c753c0042f2d4ea83ff28c0bcc
Author: Pavel Emelyanov <xemul at parallels.com>
Date:   Thu Mar 1 19:02:03 2012 +0400

    dump: Sanitize threads dumping
    
    Merge two calls into one helper. For future.
    
    Signed-off-by: Pavel Emelyanov <xemul at parallels.com>
    Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 cr-dump.c |   21 ++++++++++++++-------
 1 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/cr-dump.c b/cr-dump.c
index 7d43b74..e490974 100644
--- a/cr-dump.c
+++ b/cr-dump.c
@@ -738,14 +738,14 @@ err:
 	return ret;
 }
 
-static int parse_threads(struct pstree_item *item, pid_t pid)
+static int parse_threads(struct pstree_item *item)
 {
 	struct dirent *de;
 	DIR *dir;
 	u32 *t = NULL;
 	int nr = 1;
 
-	dir = opendir_proc(pid, "task");
+	dir = opendir_proc(item->pid, "task");
 	if (!dir)
 		return -1;
 
@@ -876,6 +876,17 @@ err:
 	return -1;
 }
 
+static int collect_threads(struct pstree_item *item)
+{
+	int ret;
+
+	ret = parse_threads(item);
+	if (!ret)
+		ret = seize_threads(item);
+
+	return ret;
+}
+
 static struct pstree_item *collect_task(pid_t pid, struct list_head *list)
 {
 	int ret;
@@ -909,11 +920,7 @@ static struct pstree_item *collect_task(pid_t pid, struct list_head *list)
 		item->state = TASK_DEAD;
 	}
 
-	ret = parse_threads(item, pid);
-	if (ret < 0)
-		goto err_close;
-
-	ret = seize_threads(item);
+	ret = collect_threads(item);
 	if (ret < 0)
 		goto err_close;
 


More information about the CRIU mailing list