Commit 0ee0b197 authored by Andrey Vagin's avatar Andrey Vagin Committed by Pavel Emelyanov

dump: split real_pid and pid in struct pid (v2)

Now pid is dumped from pid ns, it's gotted from parasite.

v2: fail if a zombie is in PIDNS
Signed-off-by: 's avatarAndrey Vagin <avagin@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 634dd10b
...@@ -998,6 +998,7 @@ static int parse_threads(const struct pstree_item *item, struct pid **_t, int *_ ...@@ -998,6 +998,7 @@ static int parse_threads(const struct pstree_item *item, struct pid **_t, int *_
} }
t = tmp; t = tmp;
t[nr - 1].real_pid = atoi(de->d_name); t[nr - 1].real_pid = atoi(de->d_name);
t[nr - 1].pid = -1;
nr++; nr++;
} }
...@@ -1086,6 +1087,8 @@ struct pstree_item *__alloc_pstree_item(bool rst) ...@@ -1086,6 +1087,8 @@ struct pstree_item *__alloc_pstree_item(bool rst)
INIT_LIST_HEAD(&item->children); INIT_LIST_HEAD(&item->children);
item->threads = NULL; item->threads = NULL;
item->nr_threads = 0; item->nr_threads = 0;
item->pid.pid = -1;
item->pid.real_pid = -1;
return item; return item;
} }
...@@ -1580,8 +1583,18 @@ static int dump_one_task(struct pstree_item *item) ...@@ -1580,8 +1583,18 @@ static int dump_one_task(struct pstree_item *item)
if (ret < 0) if (ret < 0)
goto err; goto err;
if (item->state == TASK_DEAD) if (item->state == TASK_DEAD) {
/* FIXME don't support zombie in pid name space*/
if (root_item->pid.pid == 1) {
pr_err("Can't dump a zombie %d in PIDNS", item->pid.real_pid);
ret = -1;
goto err;
}
item->pid.pid = item->pid.real_pid;
BUG_ON(!list_empty(&item->children));
return dump_one_zombie(item, &pps_buf); return dump_one_zombie(item, &pps_buf);
}
ret = collect_mappings(pid, &vma_area_list); ret = collect_mappings(pid, &vma_area_list);
if (ret) { if (ret) {
......
...@@ -177,10 +177,8 @@ struct rst_info { ...@@ -177,10 +177,8 @@ struct rst_info {
struct pid struct pid
{ {
union { /* They will be splitted, when crtools will support pid ns */
u32 real_pid; u32 real_pid;
u32 pid; u32 pid;
};
}; };
struct pstree_item { struct pstree_item {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment