[CRIU] Re: [PATCH 0/5] TTY c/r without controlling terminal

Pavel Emelyanov xemul at parallels.com
Wed Sep 12 09:38:25 EDT 2012


On 09/12/2012 04:55 PM, Cyrill Gorcunov wrote:
> On Wed, Sep 12, 2012 at 03:36:08PM +0400, Cyrill Gorcunov wrote:
>> On Wed, Sep 12, 2012 at 03:23:49PM +0400, Cyrill Gorcunov wrote:
>>> On Wed, Sep 12, 2012 at 03:21:15PM +0400, Pavel Emelyanov wrote:
>>>>
>>>> OK, fix control ttys restore and I'll commit this.
>>>
>>> Yeah, i'll post the final last patch in reply.
>>
>> Andrew, could you please check if I'm not missed anything
>> in our file engine? Pavel, the post-open is not used simply
>> because we might receive-fd for controlling terminal if only
>> i've not missed anything.
> 
> Here is one with debug prints out ripped off.

> @@ -386,6 +405,12 @@ static int open_fd(int pid, FdinfoEntry *fe, struct file_desc *d)
>  				return -1;
>  			}
>  
> +			if (fle->fe->fd == get_service_fd(CTL_TTY_OFF)) {
> +				tty_restore_ctl_terminal(d);
> +				close(fle->fe->fd);
> +				continue;
> +			}
> +
>  			fcntl(fle->fe->fd, F_SETFD, fle->fe->flags);
>  
>  			continue;
> @@ -397,6 +422,11 @@ static int open_fd(int pid, FdinfoEntry *fe, struct file_desc *d)
>  		}
>  	}
>  
> +	if (fe->fd == get_service_fd(CTL_TTY_OFF)) {
> +		tty_restore_ctl_terminal(d);
> +		close(fe->fd);
> +	}
> +
>  	close(sock);
>  	return 0;
>  }
> @@ -423,6 +453,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(fe->fd);
> +		return 0;
> +	}
> +
>  	fcntl(tmp, F_SETFD, fe->flags);
>  	return 0;
>  }

Why is this thing hangs in the generic code? What's wrong in having it in
->open/->post_open callbacks?


More information about the CRIU mailing list