2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-30 13:58:34 +00:00

proc: Make parse_maps return the amount of them found

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
This commit is contained in:
Pavel Emelyanov
2012-03-02 19:28:46 +04:00
committed by Cyrill Gorcunov
parent e94c85fe6e
commit fc225709b0
3 changed files with 6 additions and 4 deletions

View File

@@ -75,12 +75,13 @@ static int collect_mappings(pid_t pid, struct list_head *vma_area_list)
pr_info("----------------------------------------\n"); pr_info("----------------------------------------\n");
ret = parse_maps(pid, vma_area_list, true); ret = parse_maps(pid, vma_area_list, true);
if (ret) if (ret < 0)
goto err; goto err;
pr_info_vma_list(vma_area_list); pr_info_vma_list(vma_area_list);
pr_info("----------------------------------------\n"); pr_info("----------------------------------------\n");
ret = 0;
err: err:
return ret; return ret;

View File

@@ -1661,7 +1661,7 @@ static void sigreturn_restore(pid_t pid)
ret = parse_maps(pid, &self_vma_list, false); ret = parse_maps(pid, &self_vma_list, false);
close_pid_proc(); close_pid_proc();
if (ret) if (ret < 0)
goto err; goto err;
/* pr_info_vma_list(&self_vma_list); */ /* pr_info_vma_list(&self_vma_list); */

View File

@@ -23,7 +23,7 @@ int parse_maps(pid_t pid, struct list_head *vma_area_list, bool use_map_files)
unsigned long ino; unsigned long ino;
char r,w,x,s; char r,w,x,s;
int dev_maj, dev_min; int dev_maj, dev_min;
int ret = -1; int ret = -1, nr = 0;
DIR *map_files_dir = NULL; DIR *map_files_dir = NULL;
FILE *maps = 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); list_add_tail(&vma_area->list, vma_area_list);
nr++;
} }
vma_area = NULL; vma_area = NULL;
ret = 0; ret = nr;
err: err:
if (maps) if (maps)