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

Cyrill Gorcunov gorcunov at openvz.org
Thu Jan 19 14:15:57 PST 2017


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 | 2 ++
 2 files changed, 9 insertions(+)

diff --git a/criu/cr-dump.c b/criu/cr-dump.c
index b6a9c9b63c26..1abb4e31fc0a 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..34576ec54852 100644
--- a/images/core.proto
+++ b/images/core.proto
@@ -45,6 +45,8 @@ message task_core_entry {
 	optional uint32			loginuid	= 13;
 
 	optional int32			oom_score_adj	= 14;
+	optional int32			tty_nr		= 15;
+	optional int32			tty_pgrp	= 16;
 }
 
 message task_kobj_ids_entry {
-- 
2.7.4



More information about the CRIU mailing list