[CRIU] [PATCH 1/7] tty: Save task current terminal if present

Pavel Emelyanov xemul at virtuozzo.com
Wed Feb 8 00:30:24 PST 2017


On 02/02/2017 11:02 AM, Cyrill Gorcunov wrote:
> We will need it to restore access to /dev/tty
> (which is supported only partially by now).
> 
> This information is reserved for future use
> and will be addressed soon, so need to be
> merged.
> 
> Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> ---
>  criu/cr-dump.c    | 7 +++++++
>  images/core.proto | 7 +++++++
>  2 files changed, 14 insertions(+)
> 
> diff --git a/criu/cr-dump.c b/criu/cr-dump.c
> index 0130893d686a..4178bcb8af68 100644
> --- a/criu/cr-dump.c
> +++ b/criu/cr-dump.c
> @@ -728,6 +728,13 @@ static int dump_task_core_all(struct parasite_ctl *ctl,
>  	core->tc->task_state = item->pid->state;
>  	core->tc->exit_code = 0;
>  
> +	if (stat->tty_nr) {
> +		core->tc->has_tty_nr = true;
> +		core->tc->has_tty_pgrp = true;
> +		core->tc->tty_nr = stat->tty_nr;
> +		core->tc->tty_pgrp = stat->tty_pgrp;
> +	}
> +
>  	ret = parasite_dump_thread_leader_seized(ctl, pid, core);
>  	if (ret)
>  		goto err;
> diff --git a/images/core.proto b/images/core.proto
> index 14f13f8b9a4f..7b6ad409f518 100644
> --- a/images/core.proto
> +++ b/images/core.proto
> @@ -45,6 +45,13 @@ message task_core_entry {
>  	optional uint32			loginuid	= 13;
>  
>  	optional int32			oom_score_adj	= 14;
> +	/*
> +	 * Next two will be needed for handling
> +	 * /dev/tty inheritance. Rarther reserved for
> +	 * future use.
> +	 */
> +	optional int32			tty_nr		= 15;
> +	optional int32			tty_pgrp	= 16;

Yet again. If you need the numbers to be reserved, add them as comments
into .proto file.

>  }
>  
>  message task_kobj_ids_entry {
> 



More information about the CRIU mailing list