[CRIU] [PATCH 2/2] remap: add a dead pid /proc remap

Pavel Emelyanov xemul at parallels.com
Wed Sep 10 08:21:55 PDT 2014


> @@ -227,6 +228,28 @@ static int open_remap_linked(struct reg_file_info *rfi,
>  	return 0;
>  }
>  
> +static int open_remap_dead_process(struct reg_file_info *rfi,
> +		RemapFilePathEntry *rfe)
> +{
> +	struct pstree_item *helper;
> +
> +	helper = alloc_pstree_item_with_rst();
> +	if (!helper)
> +		return -1;
> +
> +	helper->sid = root_item->sid;
> +	helper->pgid = root_item->sid;
> +	helper->pid.virt = rfe->remap_id;

BTW, a helper with such pid may already be in the tree. E.g.
you have a dead task with pid 20 and living task with pgid 20.
In this case CRIU would create a helper with pid 20 to make
the pgid restore for the latter one work.

> +	helper->state = TASK_HELPER;
> +	helper->parent = root_item;
> +	list_add_tail(&helper->sibling, &root_item->children);
> +	task_entries->nr_helpers++;
> +
> +	pr_info("Added a helper for restoring /proc/%d\n", helper->pid.virt);
> +
> +	return 0;
> +}
> +
>  static int collect_one_remap(void *obj, ProtobufCMessage *msg)
>  {
>  	int ret = -1;



More information about the CRIU mailing list