[CRIU] Re: [PATCH 4/4] tty, restore: Migrate tty slave peer connection if --shell-job passed

Pavel Emelyanov xemul at parallels.com
Thu Oct 18 05:58:21 EDT 2012


On 10/17/2012 09:13 PM, Cyrill Gorcunov wrote:
> 
> In case if we've dumped a slave peer only (say a user dumped `top'
> application) we should migrate it on current active terminal, which
> barely an own standart stream prepared for us by the file engine.
> 
> Note only one external slave peer is allowed simply because
> otherwise we can't distinguish which indices should be used
> for each of them.
> 
> The patch basically does the following things
> 
>  - Check if the SID present on peer exist in current
>    process tree, we need to be sure that we can restore
>    peer parameters and controlling terminal if present
> 
>  - Rename pty_open_fake_ptmx to pty_open_unpaired_slave
>    because we might be inheriting SELF_STDIN_OFF instead
>    of opening fake master peer
> 
>  - Do inherit SELF_STDIN_OFF and restore tty group if
>    we are restoring external tty
> 
> Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> ---
>  tty.c |  110 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------
>  1 files changed, 95 insertions(+), 15 deletions(-)
> 


> @@ -86,6 +86,8 @@ static LIST_HEAD(all_tty_info_entries);
>  static LIST_HEAD(all_ttys);
>  static int self_stdin = -1;
>  
> +#define INHERIT_SID			(-1)
> +
>  /*
>   * Usually an application has not that many ttys opened.
>   * If this won't be enough in future we simply need to

Last question -- why not make the tty's sid/pgid logic the same as it is
for task sids and pgids, i.e. -- save IDs as is, but fix them up on restore?


More information about the CRIU mailing list