2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-09-05 00:35:23 +00:00

dump: Images opening rework

Rename prep_cr_fdset_for_dump into cr_fdset_open and make it reentable, i.e.
every next enter will open more files in the same fdset. Required for zombies
and makes the code cleaner.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
This commit is contained in:
Pavel Emelyanov
2012-01-22 20:15:11 +04:00
committed by Cyrill Gorcunov
parent cfbb9239ec
commit cf0550ce61
3 changed files with 20 additions and 12 deletions

View File

@@ -106,20 +106,23 @@ static struct cr_fdset *alloc_cr_fdset(void)
return cr_fdset;
}
struct cr_fdset *prep_cr_fdset_for_dump(int pid, unsigned long use_mask)
struct cr_fdset *cr_fdset_open(int pid, unsigned long use_mask, struct cr_fdset *cr_fdset)
{
unsigned int i;
int ret = -1;
char path[PATH_MAX];
struct cr_fdset *cr_fdset;
cr_fdset = alloc_cr_fdset();
if (!cr_fdset)
goto err;
if (cr_fdset == NULL) {
cr_fdset = alloc_cr_fdset();
if (!cr_fdset)
goto err;
}
for (i = 0; i < CR_FD_MAX; i++) {
if (!(use_mask & CR_FD_DESC_USE(i)))
continue;
if (cr_fdset->fds[i] != -1)
continue;
ret = get_image_path(path, sizeof(path),
fdset_template[i].fmt, pid);