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

Cyrill Gorcunov gorcunov at openvz.org
Wed Sep 12 11:54:15 EDT 2012


On Wed, Sep 12, 2012 at 07:44:23PM +0400, Cyrill Gorcunov wrote:
> 
> The idea behind is pretty simple -- once we find
> that there is a controlling terminal present we
> do call ioctl on appropriate /dev/pts/N.
> 
...
>  int prepare_fd_pid(int pid, struct rst_info *rst_info)
>  {
>  	int fdinfo_fd, ret = 0;
> @@ -358,6 +377,9 @@ static int post_open_fd(int pid, FdinfoEntry *fe, struct file_desc *d)
>  	if (!d->ops->post_open)
>  		return 0;
>  
> +	if (fe->fd == get_service_fd(CTL_TTY_OFF))
> +		return d->ops->post_open(d, fe->fd);
> +
>  	fle = file_master(d);
>  	if ((fle->pid != pid) || (fe->fd != fle->fe->fd))
>  		return 0;
> @@ -397,7 +419,6 @@ static int open_fd(int pid, FdinfoEntry *fe, struct file_desc *d)
>  			ret = send_fd_to_self(fe->fd, fle, &sock);
>  		else
>  			ret = send_fd_to_peer(fe->fd, fle, sock);
> -
>  		if (ret) {
>  			pr_err("Can't sent fd %d to %d\n", fe->fd, fle->pid);
>  			return -1;

Pavel this "-" empty line came from a bunch of rebasing I've had to do.
I can update this patch if needed.


More information about the CRIU mailing list