[CRIU] [PATCH 10/18] fd: Helper for local fd dump
Pavel Emelyanov
xemul at virtuozzo.com
Mon Jul 10 12:40:06 MSK 2017
An aux code to dump the received file and report back its
ID and type.
Signed-off-by: Pavel Emelyanov <xemul at virtuozzo.com>
---
criu/files.c | 17 +++++++++++++++++
criu/include/files.h | 1 +
2 files changed, 18 insertions(+)
diff --git a/criu/files.c b/criu/files.c
index a0e40f1..0387803 100644
--- a/criu/files.c
+++ b/criu/files.c
@@ -536,6 +536,23 @@ static int dump_one_file(struct pid *pid, int fd, int lfd, struct fd_opts *opts,
return dump_unsupp_fd(&p, lfd, "unknown", link.name + 1, e);
}
+int dump_my_file(int lfd, u32 *id, int *type)
+{
+ struct pid me = {};
+ struct fd_opts fo = {};
+ FdinfoEntry e = FDINFO_ENTRY__INIT;
+
+ me.real = getpid();
+ me.ns[0].virt = -1; /* FIXME */
+
+ if (dump_one_file(&me, lfd, lfd, &fo, NULL, &e))
+ return -1;
+
+ *id = e.id;
+ *type = e.type;
+ return 0;
+}
+
int dump_task_files_seized(struct parasite_ctl *ctl, struct pstree_item *item,
struct parasite_drain_fd *dfds)
{
diff --git a/criu/include/files.h b/criu/include/files.h
index a96b744..3dc18df 100644
--- a/criu/include/files.h
+++ b/criu/include/files.h
@@ -131,6 +131,7 @@ struct fdtype_ops {
struct cr_img;
+extern int dump_my_file(int lfd, u32 *, int *type);
extern int do_dump_gen_file(struct fd_parms *p, int lfd,
const struct fdtype_ops *ops,
FdinfoEntry *e);
--
2.1.4
More information about the CRIU
mailing list