[CRIU] [PATCH 6/9] epoll: Pass drained fds to dump_one_file
Cyrill Gorcunov
gorcunov at gmail.com
Wed Jun 20 20:01:44 MSK 2018
In epoll dumping we will need the whole set of fds to investigate
the targets, so pass this parameter down to epoll code.
Signed-off-by: Cyrill Gorcunov <gorcunov at gmail.com>
---
criu/files.c | 8 +++++---
criu/include/files.h | 2 ++
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/criu/files.c b/criu/files.c
index 130a5e8b5593..4c5808af4282 100644
--- a/criu/files.c
+++ b/criu/files.c
@@ -487,7 +487,8 @@ static int dump_chrdev(struct fd_parms *p, int lfd, FdinfoEntry *e)
}
static int dump_one_file(struct pid *pid, int fd, int lfd, struct fd_opts *opts,
- struct parasite_ctl *ctl, FdinfoEntry *e)
+ struct parasite_ctl *ctl, FdinfoEntry *e,
+ struct parasite_drain_fd *dfds)
{
struct fd_parms p = FD_PARMS_INIT;
const struct fdtype_ops *ops;
@@ -510,6 +511,7 @@ static int dump_one_file(struct pid *pid, int fd, int lfd, struct fd_opts *opts,
}
p.fd_ctl = ctl; /* Some dump_opts require this to talk to parasite */
+ p.dfds = dfds; /* epoll needs to verify if target fd exist */
if (S_ISSOCK(p.stat.st_mode))
return dump_socket(&p, lfd, e);
@@ -584,7 +586,7 @@ int dump_my_file(int lfd, u32 *id, int *type)
me.real = getpid();
me.ns[0].virt = -1; /* FIXME */
- if (dump_one_file(&me, lfd, lfd, &fo, NULL, &e))
+ if (dump_one_file(&me, lfd, lfd, &fo, NULL, &e, NULL))
return -1;
*id = e.id;
@@ -631,7 +633,7 @@ int dump_task_files_seized(struct parasite_ctl *ctl, struct pstree_item *item,
FdinfoEntry e = FDINFO_ENTRY__INIT;
ret = dump_one_file(item->pid, dfds->fds[i + off],
- lfds[i], opts + i, ctl, &e);
+ lfds[i], opts + i, ctl, &e, dfds);
if (ret)
break;
diff --git a/criu/include/files.h b/criu/include/files.h
index fbd48640a240..052222b4fc56 100644
--- a/criu/include/files.h
+++ b/criu/include/files.h
@@ -15,6 +15,7 @@
#include "images/fown.pb-c.h"
#include "images/vma.pb-c.h"
+struct parasite_drain_fd;
struct pstree_item;
struct file_desc;
struct cr_imgset;
@@ -51,6 +52,7 @@ struct fd_parms {
int mnt_id;
struct parasite_ctl *fd_ctl;
+ struct parasite_drain_fd *dfds;
};
#define FD_PARMS_INIT \
--
2.14.4
More information about the CRIU
mailing list