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

Submitted by Cyrill Gorcunov on Feb. 2, 2017, 8:02 a.m.

Details

Message ID 1486022529-1901-2-git-send-email-gorcunov@openvz.org
State New
Series "tty: Add support for multiple devpts instances"
Headers show

Commit Message

Cyrill Gorcunov Feb. 2, 2017, 8:02 a.m.
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@openvz.org>
---
 criu/cr-dump.c    | 7 +++++++
 images/core.proto | 7 +++++++
 2 files changed, 14 insertions(+)

Patch hide | download patch | download mbox

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;
 }
 
 message task_kobj_ids_entry {

Comments

Pavel Emelianov Feb. 8, 2017, 8:30 a.m.
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@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 {
>
Cyrill Gorcunov Feb. 8, 2017, 8:48 a.m.
On Wed, Feb 08, 2017 at 11:30:24AM +0300, Pavel Emelyanov wrote:
> >  
> >  	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.

They are _not_ just reserved. They are dumped too, because I want
these numbers to be in image already. The key moment is that I
didnt yet implemented inheritance, but it's another issue.