[CRIU] Re: [PATCH] service-fd: Rework it to use in hight performance code

Cyrill Gorcunov gorcunov at openvz.org
Fri Sep 7 08:44:49 EDT 2012


On Fri, Sep 07, 2012 at 04:38:21PM +0400, Pavel Emelyanov wrote:
> > +
> > +int is_service_fd(int fd, int type)
> > +{
> > +	if (type > SERVICE_FD_OFF_MIN)
> > +		return fd == get_service_fd(type);
> > +
> > +	return fd > service_fd_rlim_min;
> 
> int is_service_fd(int fd)
> {
> 	return fd > serice_fd_rlim_cur - SERVICE_FD_OFF_MAX;
> }
> 

Pavel, this is not enough for my tty restore code. For control
terminals I need to know that fd _is_ CTL_TTY_OFF, not just arbitrary
fd from service range. What happen when we need some other service fd
in file engine?

Lets do a deal: two helpers

is_any_service_fd(int fd)
{
	return fd > serice_fd_rlim_cur - SERVICE_FD_OFF_MAX;
}

is_service_fd(int fd, int type)
{
	return fd == get_service_fd(type);
}

agreed?


More information about the CRIU mailing list