[CRIU] [PATCH 2/5] uffd: Relax reading the pstree image

Pavel Emelyanov xemul at virtuozzo.com
Mon Nov 21 03:26:26 PST 2016


The uffd code only needs the pstree items themselves, not
any IDs and relations they might have.

Signed-off-by: Pavel Emelyanov <xemul at virtuozzo.com>
---
 criu/include/pstree.h | 1 +
 criu/pstree.c         | 2 +-
 criu/uffd.c           | 4 +++-
 3 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/criu/include/pstree.h b/criu/include/pstree.h
index 5768b64..71fd696 100644
--- a/criu/include/pstree.h
+++ b/criu/include/pstree.h
@@ -85,6 +85,7 @@ extern struct pstree_item *pstree_item_next(struct pstree_item *item);
 
 extern bool restore_before_setsid(struct pstree_item *child);
 extern int prepare_pstree(void);
+extern int read_pstree_image(pid_t *pid_max);
 
 extern int dump_pstree(struct pstree_item *root_item);
 
diff --git a/criu/pstree.c b/criu/pstree.c
index 943518d..bc58b38 100644
--- a/criu/pstree.c
+++ b/criu/pstree.c
@@ -472,7 +472,7 @@ static int read_pstree_ids(struct pstree_item *pi)
 	return 0;
 }
 
-static int read_pstree_image(pid_t *pid_max)
+int read_pstree_image(pid_t *pid_max)
 {
 	int ret = 0, i;
 	struct cr_img *img;
diff --git a/criu/uffd.c b/criu/uffd.c
index f3b4f4a..2d09e66 100644
--- a/criu/uffd.c
+++ b/criu/uffd.c
@@ -790,6 +790,8 @@ out:
 
 static int lazy_pages_prepare_pstree(void)
 {
+	pid_t dummy = 0;
+
 	if (check_img_inventory() == -1)
 		return -1;
 
@@ -797,7 +799,7 @@ static int lazy_pages_prepare_pstree(void)
 	if (prepare_task_entries() == -1)
 		return -1;
 
-	if (prepare_pstree() == -1)
+	if (read_pstree_image(&dummy) == -1)
 		return -1;
 
 	return 0;
-- 
2.5.0



More information about the CRIU mailing list