[CRIU] Re: [PATCH 2/6] tty: Squash tty_get_sid, tty_get_pgrp into tty_get_sid_pgrp

Cyrill Gorcunov gorcunov at openvz.org
Fri Sep 14 07:06:38 EDT 2012


On Fri, Sep 14, 2012 at 03:00:24PM +0400, Pavel Emelyanov wrote:
> On 09/14/2012 02:38 PM, Cyrill Gorcunov wrote:
> > 
> > This patch squashes tty_get_sid, tty_get_pgrp into
> > one tty_get_sid_pgrp helper (which allows to detect
> > if dumping terminal is hanging up, the real use of
> > this ability will be addressed in next patch).
> > 
> > Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> > ---
> >  tty.c |   49 +++++++++++++++++++++++++------------------------
> >  1 files changed, 25 insertions(+), 24 deletions(-)
> > 
> 
> > +
> > +	*hangup = false;
> > +	return 0;
> > +
> > +err:
> > +	if (errno != EIO) {
> 
> I can find zero places where TIOCGPGRP or TIOCGSID may result in EIO.
> Point one to me.

When master get closed

pty_close
  tty_vhangup(tty->link) (link is the slave tty)
    __tty_hangup
      filp->f_op = &hung_up_tty_fops;

static const struct file_operations hung_up_tty_fops = {
	...
	.unlocked_ioctl	= hung_up_tty_ioctl,
	...
}

static long hung_up_tty_ioctl(struct file *file, unsigned int cmd,
		unsigned long arg)
{
	return cmd == TIOCSPGRP ? -ENOTTY : -EIO;
}

	Cyrill


More information about the CRIU mailing list