[CRIU] [PATCH 1/2] tty: Add restoration of locked/exclusive ptys

Cyrill Gorcunov gorcunov at openvz.org
Wed Sep 5 12:55:58 EDT 2012


On Wed, Sep 05, 2012 at 08:47:47PM +0400, Pavel Emelyanov wrote:
> > +
> > +	/*
> > +	 * Bits
> > +	 *  0 - locked
> > +	 *  1 - exclusive
> > +	 */
> >  	required uint32			tty_flags	=  8;
> 
> Better make it
> 
> required bool locked;
> required bool exclusive;

ok

> Hm... This is VERY nice, but we need to add crtools check checker for this
> being true.

I see. Sure, I'll add appropriate code for "check" command.

> > +	if (info->tfe->tty_flags & TTY_LOCKED)
> > +		lock_pty_master(master);
> > +	else if (info->tfe->tty_flags & TTY_EXCLUSIVE)
> > +		set_exclusive_pty_master(master);
> 
> Can't they be set simultaneously?

Strictly speaking, yes. You're right. I rather need to check
this bits in two calls

 - check for being locked
 - if locked, unlock it and check for excl. bit, will update

> > +		/*
> > +		 * Also figure out the flags master pty has.
> > +		 */
> 
> Stupid comment, don't you think?

Was not looking that stupid when i've been typing it,
but now... indeed ;)

> >  		if (sid) {
> > +			if (e.tty_flags & TTY_LOCKED)
> > +				unlock_pty_master(lfd);
> 
> What for?

If master is locked we can't open slave for dumping
(to dump control terminal we re-open slave peer). Probably
I should rework this approach. I'll think about it.

	Cyrill


More information about the CRIU mailing list