2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-31 06:15:24 +00:00

files: Collect fdinfo-s on per-pstree_item list

Later we'll be able to restore them without re-reading the fdinfo file again.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Pavel Emelyanov
2012-04-18 16:24:08 +04:00
parent 0e57ce29be
commit a72d858652
4 changed files with 11 additions and 5 deletions

View File

@@ -327,7 +327,7 @@ int collect_reg_files(void)
return collect_remaps();
}
static int collect_fd(int pid, struct fdinfo_entry *e)
static int collect_fd(int pid, struct fdinfo_entry *e, struct list_head *fds)
{
int i;
struct fdinfo_list_entry *l, *le = &fdinfo_list[nr_fdinfo_list];
@@ -357,14 +357,17 @@ static int collect_fd(int pid, struct fdinfo_entry *e)
break;
list_add_tail(&le->desc_list, &l->desc_list);
list_add_tail(&le->ps_list, fds);
return 0;
}
int prepare_fd_pid(int pid)
int prepare_fd_pid(int pid, struct rst_info *rst_info)
{
int fdinfo_fd, ret = 0;
u32 type = 0;
INIT_LIST_HEAD(&rst_info->fds);
fdinfo_fd = open_image_ro(CR_FD_FDINFO, pid);
if (fdinfo_fd < 0) {
if (errno == ENOENT)
@@ -380,7 +383,7 @@ int prepare_fd_pid(int pid)
if (ret <= 0)
break;
ret = collect_fd(pid, &e);
ret = collect_fd(pid, &e, &rst_info->fds);
if (ret < 0)
break;
}