[CRIU] [crtools-bot for Pavel Emelyanov ] proc: Make parse_maps return the amount of them found

Cyrill Gorcunov gorcunov at openvz.org
Fri Mar 2 12:31:35 EST 2012


The commit is pushed to "master" and will appear on git://github.com/cyrillos/crtools.git
------>
commit fc225709b0422b42d189ddcf2f99124cc40fffdc
Author: Pavel Emelyanov <xemul at parallels.com>
Date:   Fri Mar 2 19:28:46 2012 +0400

    proc: Make parse_maps return the amount of them found
    
    Signed-off-by: Pavel Emelyanov <xemul at parallels.com>
    Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 cr-dump.c    |    3 ++-
 cr-restore.c |    2 +-
 proc_parse.c |    5 +++--
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/cr-dump.c b/cr-dump.c
index 229804d..ee0d981 100644
--- a/cr-dump.c
+++ b/cr-dump.c
@@ -75,12 +75,13 @@ static int collect_mappings(pid_t pid, struct list_head *vma_area_list)
 	pr_info("----------------------------------------\n");
 
 	ret = parse_maps(pid, vma_area_list, true);
-	if (ret)
+	if (ret < 0)
 		goto err;
 
 	pr_info_vma_list(vma_area_list);
 
 	pr_info("----------------------------------------\n");
+	ret = 0;
 
 err:
 	return ret;
diff --git a/cr-restore.c b/cr-restore.c
index 11c2c46..7ae5152 100644
--- a/cr-restore.c
+++ b/cr-restore.c
@@ -1661,7 +1661,7 @@ static void sigreturn_restore(pid_t pid)
 
 	ret = parse_maps(pid, &self_vma_list, false);
 	close_pid_proc();
-	if (ret)
+	if (ret < 0)
 		goto err;
 
 	/* pr_info_vma_list(&self_vma_list); */
diff --git a/proc_parse.c b/proc_parse.c
index d65a11d..7c35264 100644
--- a/proc_parse.c
+++ b/proc_parse.c
@@ -23,7 +23,7 @@ int parse_maps(pid_t pid, struct list_head *vma_area_list, bool use_map_files)
 	unsigned long ino;
 	char r,w,x,s;
 	int dev_maj, dev_min;
-	int ret = -1;
+	int ret = -1, nr = 0;
 
 	DIR *map_files_dir = NULL;
 	FILE *maps = NULL;
@@ -157,10 +157,11 @@ int parse_maps(pid_t pid, struct list_head *vma_area_list, bool use_map_files)
 		}
 
 		list_add_tail(&vma_area->list, vma_area_list);
+		nr++;
 	}
 
 	vma_area = NULL;
-	ret = 0;
+	ret = nr;
 
 err:
 	if (maps)


More information about the CRIU mailing list