[CRIU] Re: [PATCH 5/5] tty: Add restoration of controlling terminal v2

Pavel Emelyanov xemul at parallels.com
Wed Sep 12 05:53:29 EDT 2012


On 09/12/2012 11:58 AM, Cyrill Gorcunov wrote:
> On Wed, Sep 12, 2012 at 11:16:46AM +0400, Pavel Emelyanov wrote:
>>> +int tty_restore_ctl_terminal(struct file_desc *d)
>>> +{
>>> +	struct tty_info *info = container_of(d, struct tty_info, d);
>>> +
>>> +	BUG_ON(!(pty_is_master(info)) || !info->tie->sid);
>>
>> This equals to BUG_ON(!is_master && info->sid). Why non master must NOT have sids?
> 
> As far as I know nonmasters do not have sids.

OK. The write it as BUG_ON(non master has sid) instead of
BUG_ON(master or sid-leess tty is false)

>>> @@ -424,6 +443,12 @@ static int receive_fd(int pid, FdinfoEntry *fe, struct file_desc *d)
>>>  	if (reopen_fd_as(fe->fd, tmp) < 0)
>>>  		return -1;
>>>  
>>> +	if (fe->fd == get_service_fd(CTL_TTY_OFF)) {
>>> +		tty_restore_ctl_terminal(d);
>>> +		close(fle->fe->fd);
>>> +		return 0;
>>> +	}
>>> +
>>>  	fcntl(tmp, F_SETFD, fe->flags);
>>>  	return 0;
>>>  }
>>
>> Why not in post_open?
> 
> I'll reply to this a bit late (checking if I'm not missed something).
> 
>>
>>> @@ -131,7 +131,7 @@ static int prepare_shared(void)
>>>  		if (ret < 0)
>>>  			break;
>>>  
>>> -		ret = prepare_fd_pid(pi->pid.virt, pi->rst);
>>> +		ret = prepare_fd_pid(pi->pid.virt, pi->rst, pi->ctl_tty_id);
>>>  		if (ret < 0)
>>>  			break;
>>>  	}
>>
>> Better introduce prepare_ctl_tty() call.
> 
> OK
> 
> 	Cyrill
> .
> 



More information about the CRIU mailing list