mirror of
https://github.com/checkpoint-restore/criu
synced 2025-09-04 00:05:26 +00:00
dump: Make VMA parsing to handle absence of map_files
Needed in testing purposes. Also make free_mappings being a global one (will need it in restorer). Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
This commit is contained in:
@@ -56,7 +56,7 @@ static void free_pstree(struct list_head *pstree_list)
|
|||||||
INIT_LIST_HEAD(pstree_list);
|
INIT_LIST_HEAD(pstree_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void free_mappings(struct list_head *vma_area_list)
|
void free_mappings(struct list_head *vma_area_list)
|
||||||
{
|
{
|
||||||
struct vma_area *vma_area, *p;
|
struct vma_area *vma_area, *p;
|
||||||
|
|
||||||
@@ -78,7 +78,7 @@ static int collect_mappings(pid_t pid, struct list_head *vma_area_list)
|
|||||||
pr_info("Collecting mappings (pid: %d)\n", pid);
|
pr_info("Collecting mappings (pid: %d)\n", pid);
|
||||||
pr_info("----------------------------------------\n");
|
pr_info("----------------------------------------\n");
|
||||||
|
|
||||||
ret = parse_maps(pid, vma_area_list);
|
ret = parse_maps(pid, vma_area_list, true);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
|
@@ -76,6 +76,8 @@ int prep_cr_fdset_for_restore(struct cr_fdset *cr_fdset,
|
|||||||
void close_cr_fdset(struct cr_fdset *cr_fdset);
|
void close_cr_fdset(struct cr_fdset *cr_fdset);
|
||||||
void free_cr_fdset(struct cr_fdset **cr_fdset);
|
void free_cr_fdset(struct cr_fdset **cr_fdset);
|
||||||
|
|
||||||
|
void free_mappings(struct list_head *vma_area_list);
|
||||||
|
|
||||||
struct vma_area {
|
struct vma_area {
|
||||||
struct list_head list;
|
struct list_head list;
|
||||||
struct vma_entry vma;
|
struct vma_entry vma;
|
||||||
|
@@ -151,7 +151,7 @@ void printk_vma(struct vma_area *vma_area);
|
|||||||
#define pr_info_siginfo(siginfo) printk_siginfo(siginfo)
|
#define pr_info_siginfo(siginfo) printk_siginfo(siginfo)
|
||||||
|
|
||||||
int reopen_fd_as(int new_fd, int old_fd);
|
int reopen_fd_as(int new_fd, int old_fd);
|
||||||
int parse_maps(pid_t pid, struct list_head *vma_list);
|
int parse_maps(pid_t pid, struct list_head *vma_area_list, bool use_map_files);
|
||||||
int close_safe(int *fd);
|
int close_safe(int *fd);
|
||||||
|
|
||||||
void hex_dump(void *addr, unsigned long len);
|
void hex_dump(void *addr, unsigned long len);
|
||||||
|
4
util.c
4
util.c
@@ -231,7 +231,7 @@ int reopen_fd_as(int new_fd, int old_fd)
|
|||||||
return new_fd;
|
return new_fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
int parse_maps(pid_t pid, struct list_head *vma_area_list)
|
int parse_maps(pid_t pid, struct list_head *vma_area_list, bool use_map_files)
|
||||||
{
|
{
|
||||||
struct vma_area *vma_area = NULL;
|
struct vma_area *vma_area = NULL;
|
||||||
u64 start, end, pgoff;
|
u64 start, end, pgoff;
|
||||||
@@ -260,7 +260,7 @@ int parse_maps(pid_t pid, struct list_head *vma_area_list)
|
|||||||
* I'm debugging it on old kernel ;)
|
* I'm debugging it on old kernel ;)
|
||||||
*/
|
*/
|
||||||
map_files_dir = opendir(map_files_path);
|
map_files_dir = opendir(map_files_path);
|
||||||
if (!map_files_dir) {
|
if (use_map_files && !map_files_dir) {
|
||||||
pr_err("Can't open %s, old kernel?\n",
|
pr_err("Can't open %s, old kernel?\n",
|
||||||
map_files_path);
|
map_files_path);
|
||||||
goto err;
|
goto err;
|
||||||
|
Reference in New Issue
Block a user