[CRIU] Re: [PATCH 2/3] tty: Mark living peers in tty_active_pairs bitmap

Pavel Emelyanov xemul at parallels.com
Tue Sep 18 10:55:36 EDT 2012


On 09/18/2012 04:34 PM, Cyrill Gorcunov wrote:
> Will need it to verify that live tty pairs exist.
> 
> Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> ---
>  tty.c |   11 +++++++++++
>  1 files changed, 11 insertions(+), 0 deletions(-)
> 
> diff --git a/tty.c b/tty.c
> index 6f23a1a..0b38d06 100644
> --- a/tty.c
> +++ b/tty.c
> @@ -91,6 +91,7 @@ static LIST_HEAD(all_ttys);
>   */
>  #define MAX_TTYS 1024
>  static DECLARE_BITMAP(tty_bitmap, (MAX_TTYS << 1));
> +static DECLARE_BITMAP(tty_active_pairs, (MAX_TTYS << 1));
>  
>  /*
>   * /dev/ptmx is a shared resource between all tasks
> @@ -923,6 +924,16 @@ static int dump_pty_info(int lfd, u32 id, const struct fd_parms *p, int major, i
>  	if (hangup)
>  		return pb_write_one(fdset_fd(glob_fdset, CR_FD_TTY_INFO), &info, PB_TTY_INFO);
>  
> +	/*
> +	 * Now trace the paired/unpaired ttys. For example
> +	 * the task might have slave peer assigned but no
> +	 * master peer. Such "detached" master peers are
> +	 * not yet supported by our tool and better to
> +	 * inform a user about such situatio,
> +	 */
> +	if (!hangup || major == TTYAUX_MAJOR)

Can this _ever_ be false?

> +		tty_test_and_set(id, tty_active_pairs);
> +
>  	if (pty_get_flags(lfd, major, index, &info))
>  		goto out;
>  



More information about the CRIU mailing list