[CRIU] Re: [PATCH 1/2] sockets: Restore unbound inet sockets v3

Pavel Emelyanov xemul at parallels.com
Thu Jun 28 13:56:46 EDT 2012


On 06/28/2012 09:48 PM, Cyrill Gorcunov wrote:
> On Thu, Jun 28, 2012 at 09:40:53PM +0400, Pavel Emelyanov wrote:
>>
>>> Which value would be appropriate here?
>>
>> zero
> 
> Update is attached.
> 
> 	Cyrill

> +static struct inet_sk_desc *gen_uncon_sk(int lfd, const struct fd_parms *p)
> +{
> +	struct inet_sk_desc *sk;
> +
> +	sk = xzalloc(sizeof(*sk));
> +	sk_collect_one(sk->sd.ino, sk->sd.family, &sk->sd);
> +	return sk;
> +}
> +
...
>  static int dump_one_inet_fd(int lfd, u32 id, const struct fd_parms *p)
>  {
> +	bool should_free_sk = false;
>  
>  	sk = (struct inet_sk_desc *)lookup_socket(p->stat.st_ino);
> +	if (!sk) {
> +		sk = gen_uncon_sk(lfd, p);
> +		if (!sk)
> +			goto err;
> +		should_free_sk = true;
> +	}
...
> +	if (should_free_sk)
> +		xfree(sk);
> +	return ret;
>  }

O_o


More information about the CRIU mailing list