[CRIU] [PATCH 5/5] tty: Use regular files engine to save paths to the peers, v3

Cyrill Gorcunov gorcunov at gmail.com
Wed Oct 15 02:59:39 PDT 2014


On Wed, Oct 15, 2014 at 01:53:21PM +0400, Pavel Emelyanov wrote:
> On 10/13/2014 07:51 PM, Cyrill Gorcunov wrote:
> 
> > @@ -242,18 +247,182 @@ static int tty_test_and_set(int bit, unsigned long *bitmap)
> >  	return ret;
> >  }
> >  
> > -static int pty_open_ptmx_index(int flags, int index)
> > +/*
> > + * Generate a regular file object in case if such is missed
> > + * in the image file, ie obsolete interface has been used on
> > + * checkpoint.
> > + */
> > +static struct file_desc *pty_alloc_fake_reg_d(struct tty_info *info, bool add)
> 
> I'm not sure I understand the idea behind this alloc_fake. Can you elaborate?

If there are images created with older criu -- there won't be reg-files records
but I need to the rest of code to use reg-files engine (ie the code will be unified)
so for such case I create "fake" reg-files entries.

> > +static int do_open_pty_reg(int ns_root_fd, struct reg_file_info *rfi, void *v)
> 
> This duplicates the do_open_reg_noseek_flags().

I know. I simply don't want to touch reg-files code as much as possible at least
for the first tty series. Once it's known to work well I'll simplify it.

> > +	/*
> > +	 * Slave PTYs without master might have
> > +	 * been postfixed as deleted, strip this
> > +	 * part, we will need a valid path on their
> > +	 * opening.
> > +	 */
> 
> This should be done on dump side. We have a problem right now with these
> "(deleted)" for link remaps and ghosts. Just introduce the function that
> strips this part for those and call the same for PTYs on dump.

Could you explain what problems we're facing with this postfix?

> 
> > +	if (info->type == TTY_TYPE_PTS)
> > +		pty_undelete_reg(info);
> > +
> >  	/*
> >  	 * The tty peers which have no @termios are hung up,
> >  	 * so don't mark them as active, we create them with
> 

	Cyrill


More information about the CRIU mailing list