[CRIU] Re: [PATCH] tty: Rework tty_find_restoring_task

Cyrill Gorcunov gorcunov at openvz.org
Tue Oct 30 02:50:50 EDT 2012


On Tue, Oct 30, 2012 at 09:01:13AM +0400, Andrew Vagin wrote:
> On Mon, Oct 29, 2012 at 11:28:32PM +0400, Cyrill Gorcunov wrote:
> > It's being found that we fail to restore tasks which
> > are not session leaders but have controlling terminals.
> > 
> > This patch reworks tty_find_restoring_task logic and
> > fixes the problem.
> > 
> > https://bugzilla.openvz.org/show_bug.cgi?id=2409
> > 
> > Reported-by: Andrey Vagin <avagin at openvz.org>
> > Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> > ---
> >  tty.c |  100 ++++++++++++++++++++++++++++++++++++++++++++++++----------------
> >  1 files changed, 75 insertions(+), 25 deletions(-)
> > 
> > diff --git a/tty.c b/tty.c
> > index dd78ee2..88857b5 100644
> > --- a/tty.c
> > +++ b/tty.c
> > @@ -395,7 +395,15 @@ static bool pty_is_master(struct tty_info *info)
> >  
> >  static bool pty_is_hung(struct tty_info *info)
> >  {
> > -	return info->tie->sid == 0 && info->tie->termios == NULL;
> > +	return info->tie->termios == NULL;
> > +}
> > +
> > +static bool tty_has_active_pair(struct tty_info *info)
> > +{
> > +	int d = pty_is_master(info) ? -1 : + 1;
> Do we have three bits for each tty pair? May you mean 0, 1?

No. The odd ids are master peers and the even are slave Look,
imagine you have a master id 7 then appropriate slave id will
be 6, in turn if the slave id 6 passed here, the appropriate
master id is 7 and so on :-)


More information about the CRIU mailing list