mirror of
https://github.com/checkpoint-restore/criu
synced 2025-09-01 06:45:35 +00:00
pstree: Store task's netns on pstree-item
Will be needed for parasite sockets. Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
15
image.c
15
image.c
@@ -67,7 +67,10 @@ int write_img_inventory(void)
|
||||
{
|
||||
struct cr_img *img;
|
||||
InventoryEntry he = INVENTORY_ENTRY__INIT;
|
||||
struct pstree_item crt = { };
|
||||
struct {
|
||||
struct pstree_item i;
|
||||
struct dmp_info d;
|
||||
} crt = { };
|
||||
|
||||
pr_info("Writing image inventory (version %u)\n", CRTOOLS_IMAGES_V1);
|
||||
|
||||
@@ -81,9 +84,9 @@ int write_img_inventory(void)
|
||||
he.ns_per_id = true;
|
||||
he.has_ns_per_id = true;
|
||||
|
||||
crt.state = TASK_ALIVE;
|
||||
crt.pid.real = getpid();
|
||||
if (get_task_ids(&crt)) {
|
||||
crt.i.state = TASK_ALIVE;
|
||||
crt.i.pid.real = getpid();
|
||||
if (get_task_ids(&crt.i)) {
|
||||
close_image(img);
|
||||
return -1;
|
||||
}
|
||||
@@ -92,12 +95,12 @@ int write_img_inventory(void)
|
||||
if (dump_task_cgroup(NULL, &he.root_cg_set))
|
||||
return -1;
|
||||
|
||||
he.root_ids = crt.ids;
|
||||
he.root_ids = crt.i.ids;
|
||||
|
||||
if (pb_write_one(img, &he, PB_INVENTORY) < 0)
|
||||
return -1;
|
||||
|
||||
xfree(crt.ids);
|
||||
xfree(crt.i.ids);
|
||||
close_image(img);
|
||||
return 0;
|
||||
}
|
||||
|
@@ -36,7 +36,9 @@ static inline struct rst_info *rsti(struct pstree_item *i)
|
||||
return (struct rst_info *)(i + 1);
|
||||
}
|
||||
|
||||
struct ns_id;
|
||||
struct dmp_info {
|
||||
struct ns_id *netns;
|
||||
};
|
||||
|
||||
static inline struct dmp_info *dmpi(struct pstree_item *i)
|
||||
|
@@ -372,7 +372,7 @@ int dump_task_ns_ids(struct pstree_item *item)
|
||||
}
|
||||
|
||||
ids->has_net_ns_id = true;
|
||||
ids->net_ns_id = get_ns_id(pid, &net_ns_desc);
|
||||
ids->net_ns_id = __get_ns_id(pid, &net_ns_desc, &dmpi(item)->netns);
|
||||
if (!ids->net_ns_id) {
|
||||
pr_err("Can't make netns id\n");
|
||||
return -1;
|
||||
|
Reference in New Issue
Block a user