[CRIU] [PATCH] Add inherit fd support

Pavel Emelyanov xemul at parallels.com
Thu Dec 4 01:58:53 PST 2014


> +int inherit_fd_lookup_id(char *id)
> +{
> +	struct inherit_fd *inh;
> +
> +	list_for_each_entry(inh, &opts.inherit_fds, inh_list) {
> +		if (!strcmp(inh->inh_id, id)) {
> +			pr_info("File identifier %s in inherit fd list\n", id);
> +			return inh->inh_fd;

Ouch, and one more thing. Since you return this fd into files restoring
engine, the latter would then move this descriptor into desired place
and close the old one. Thus, if the descriptor is present two times in
the task's fdtable, the 2nd attempt to inherit one would fail.



More information about the CRIU mailing list