[CRIU] [PATCH 4/5] crtools: dump pstree to image file without pid
number
Kinsbursky Stanislav
skinsbursky at openvz.org
Fri Mar 23 10:42:07 EDT 2012
From: Stanislav Kinsbursky <skinsbursky at openvz.org>
Pid number is redundant - this file is one for the whole tree.
Signed-off-by: Stanislav Kinsbursky <skinsbursky at openvz.org>
---
cr-dump.c | 2 +-
cr-restore.c | 4 ++--
cr-show.c | 12 ++++++++----
include/crtools.h | 2 +-
4 files changed, 12 insertions(+), 8 deletions(-)
-------------- next part --------------
diff --git a/cr-dump.c b/cr-dump.c
index ad32975..8202801 100644
--- a/cr-dump.c
+++ b/cr-dump.c
@@ -1143,7 +1143,7 @@ static int dump_pstree(pid_t pid, const struct list_head *pstree_list)
pr_info("Dumping pstree (pid: %d)\n", pid);
pr_info("----------------------------------------\n");
- pstree_fd = open_image(CR_FD_PSTREE, O_RDWR | O_CREAT | O_EXCL, pid);
+ pstree_fd = open_image(CR_FD_PSTREE, O_RDWR | O_CREAT | O_EXCL);
if (pstree_fd < 0)
return -1;
diff --git a/cr-restore.c b/cr-restore.c
index 22b6afb..fda406b 100644
--- a/cr-restore.c
+++ b/cr-restore.c
@@ -1167,7 +1167,7 @@ static int restore_task_with_children(void *_arg)
pr_info("%d: Starting restore\n", me->pid);
- fd = open_image_ro_nocheck(FMT_FNAME_PSTREE, pstree_pid);
+ fd = open_image_ro_nocheck(FMT_FNAME_PSTREE);
if (fd < 0) {
pr_perror("%d: Can't reopen pstree image", me->pid);
exit(1);
@@ -1291,7 +1291,7 @@ static int restore_all_tasks(pid_t pid, struct cr_options *opts)
int pstree_fd = -1;
u32 type = 0;
- pstree_fd = open_image_ro(CR_FD_PSTREE, pstree_pid);
+ pstree_fd = open_image_ro(CR_FD_PSTREE);
if (pstree_fd < 0)
return -1;
diff --git a/cr-show.c b/cr-show.c
index cefd317..4898a87 100644
--- a/cr-show.c
+++ b/cr-show.c
@@ -521,16 +521,20 @@ static int cr_show_all(unsigned long pid, struct cr_options *opts)
struct cr_fdset *cr_fdset = NULL;
struct pstree_item *item = NULL;
LIST_HEAD(pstree_list);
- int i, ret = -1;
+ int i, ret = -1, pstree_fd;
- cr_fdset = cr_show_fdset_open(pid, CR_FD_DESC_PSTREE | CR_FD_DESC_SK_QUEUES);
- if (!cr_fdset)
+ pstree_fd = open_image_ro(CR_FD_PSTREE);
+ if (pstree_fd)
goto out;
- ret = show_pstree(cr_fdset->fds[CR_FD_PSTREE], &pstree_list);
+ ret = show_pstree(pstree_fd, &pstree_list);
if (ret)
goto out;
+ cr_fdset = cr_show_fdset_open(pid, CR_FD_DESC_SK_QUEUES);
+ if (!cr_fdset)
+ goto out;
+
ret = show_sk_queues(cr_fdset->fds[CR_FD_SK_QUEUES]);
if (ret)
goto out;
diff --git a/include/crtools.h b/include/crtools.h
index 6048840..42f7f2f 100644
--- a/include/crtools.h
+++ b/include/crtools.h
@@ -80,7 +80,7 @@ extern struct cr_fd_desc_tmpl fdset_template[CR_FD_MAX];
#define FMT_FNAME_CORE "core-%d.img"
#define FMT_FNAME_VMAS "vmas-%d.img"
#define FMT_FNAME_PIPES "pipes-%d.img"
-#define FMT_FNAME_PSTREE "pstree-%d.img"
+#define FMT_FNAME_PSTREE "pstree.img"
#define FMT_FNAME_SIGACTS "sigacts-%d.img"
#define FMT_FNAME_UNIXSK "unixsk-%d.img"
#define FMT_FNAME_INETSK "inetsk-%d.img"
More information about the CRIU
mailing list