[CRIU] Re: [PATCH 5/6] util-net: Add send_fds and recv_fds

Cyrill Gorcunov gorcunov at openvz.org
Wed Mar 21 07:42:00 EDT 2012


On Wed, Mar 21, 2012 at 02:38:43PM +0400, Pavel Emelyanov wrote:
...
> >  
> > +#include "util-net.h"
> > +
> > +static void scm_fdset_update(struct scm_fdset *fdset, int nr_fds)
> 
> scm_fdset_init_chunk
> 
> > +{
> > +	int min_fd = min(nr_fds, CR_SCM_MAX_FD);
> > +	struct cmsghdr *cmsg;
> > +
> > +	cmsg				= CMSG_FIRSTHDR(&fdset->hdr);
> > +	fdset->hdr.msg_controllen	= CMSG_LEN(sizeof(int) * min_fd);
> > +	cmsg->cmsg_len			= fdset->hdr.msg_controllen;
> > +	fdset->nr_fds			= min_fd;
> > +}

...

> > +
> > +
> > +	cmsg				= CMSG_FIRSTHDR(&fdset->hdr);
> > +	cmsg->cmsg_len			= fdset->hdr.msg_controllen;
> > +	cmsg->cmsg_level		= SOL_SOCKET;
> > +	cmsg->cmsg_type			= SCM_RIGHTS;
> 
> These tree are re-set by scm_fdset_update every loop cycle. No need in doing it here.

Btw, I believe you misread the patch a bit, the scm_fdset_update do update
cmsg->cmsg_len only, while _init do set _level and _type once and never
poke it again. So this is needed.

	Cyrill


More information about the CRIU mailing list