[CRIU] Re: on servie fd handling code

Cyrill Gorcunov gorcunov at openvz.org
Thu Sep 6 06:04:43 EDT 2012


On Thu, Sep 06, 2012 at 01:51:53PM +0400, Pavel Emelyanov wrote:
> > +extern int init_service_fd(void);
> > +extern int get_service_fd(int type);
> 
> Need the is_service_fd() call.

Yeah.

> > +static struct rlimit rlimit;
> 
> Don't cache the whole struct. The rlim_cur value is enough.

Yes, sir, will update.

> > -	if (getrlimit(RLIMIT_NOFILE, &rlimit)) {
> > -		pr_perror("Can't get rlimit");
> > -		return -1;
> > -	}
> > -
> > -	return rlimit.rlim_cur - type;
> > -}
> 
> Leave the whole thing in util.c

Pavel, I've moved this code out to service-fd because, frankly,
our util.c become a mess of various helper functions. What is worse --
the functions are not one-line helpers. For example, i think along with
service-fd code, the code related to /proc handling should be moved
to some proc.[ch] file as well. On the other side -- say copy_file,
is_anon_inode,is_anon_link_type are perfectly fine candidates for
util.c file.

Agreed?

	Cyrill


More information about the CRIU mailing list