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

Cyrill Gorcunov gorcunov at openvz.org
Sat Jan 21 05:11:23 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 555814b238cc..3699477c21d3 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