[CRIU] [PATCH 22/28] dump: return id after collecting vma files

Kinsbursky Stanislav skinsbursky at openvz.org
Thu Mar 22 13:59:59 EDT 2012


From: Stanislav Kinsbursky <skinsbursky at openvz.org>

This id will be used for searching file on restore

Signed-off-by: Stanislav Kinsbursky <skinsbursky at openvz.org>
---
 cr-dump.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
-------------- next part --------------
diff --git a/cr-dump.c b/cr-dump.c
index ff08ce3..2a4edbc 100644
--- a/cr-dump.c
+++ b/cr-dump.c
@@ -154,6 +154,8 @@ static int dump_one_reg_file(struct file_entry *p, pid_t pid,
 	e.addr = target_fd;
 	if (write_img(cr_fdset->fds[CR_FD_FDINFO], &e))
 		return -1;
+	if (fd_is_special(fde))
+		return id;
 	return 0;
 }
 
@@ -466,13 +468,18 @@ static int dump_filemap(pid_t pid, struct vma_entry *vma, int file_fd,
 		.id		= FD_ID_INVALID,
 		.type		= FDINFO_MAP,
 	};
+	long id;
 
 	if ((vma->prot & PROT_WRITE) && vma_entry_is(vma, VMA_FILE_SHARED))
 		p.flags = O_RDWR;
 	else
 		p.flags = O_RDONLY;
 
-	return dump_one_reg_file(&p, pid, file_fd, vma->start, fdset, 0);
+	id = dump_one_reg_file(&p, pid, file_fd, vma->start, fdset, 0);
+	if (id < 0)
+		return -1;
+	vma->shmid = id;
+	return 0;
 }
 
 static int dump_task_mappings(pid_t pid, const struct list_head *vma_area_list,


More information about the CRIU mailing list