[CRIU] [PATCH 06/12] tty: Carry @minor in tty_info and tty_dump_info

Cyrill Gorcunov gorcunov at openvz.org
Fri Oct 3 00:49:59 PDT 2014


We will need them to properly recognize the type
of tty when printing their type and on verification.

Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 tty.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/tty.c b/tty.c
index c9dfed4fcb63..3958c16e56bb 100644
--- a/tty.c
+++ b/tty.c
@@ -85,6 +85,7 @@ struct tty_info {
 
 	struct list_head		sibling;
 	int				major;
+	int				minor;
 
 	bool				create;
 	bool				inherit;
@@ -98,6 +99,7 @@ struct tty_dump_info {
 	pid_t				pgrp;
 	int				fd;
 	int				major;
+	int				minor;
 };
 
 static LIST_HEAD(all_tty_info_entries);
@@ -974,6 +976,7 @@ static int collect_one_tty(void *obj, ProtobufCMessage *msg)
 
 	INIT_LIST_HEAD(&info->sibling);
 	info->major = major(info->tie->rdev);
+	info->minor = minor(info->tie->rdev);
 	info->create = (info->major == TTYAUX_MAJOR);
 	info->inherit = false;
 
@@ -1056,7 +1059,7 @@ int dump_verify_tty_sids(void)
 	return ret;
 }
 
-static int dump_pty_info(int lfd, u32 id, const struct fd_parms *p, int major, int index)
+static int dump_pty_info(int lfd, u32 id, const struct fd_parms *p, int major, int minor, int index)
 {
 	TtyInfoEntry info		= TTY_INFO_ENTRY__INIT;
 	TermiosEntry termios		= TERMIOS_ENTRY__INIT;
@@ -1092,6 +1095,7 @@ static int dump_pty_info(int lfd, u32 id, const struct fd_parms *p, int major, i
 	dinfo->pgrp		= pti->pgrp;
 	dinfo->fd		= p->fd;
 	dinfo->major		= major;
+	dinfo->minor		= minor;
 
 	list_add_tail(&dinfo->list, &all_ttys);
 
@@ -1201,7 +1205,7 @@ static int dump_one_pty(int lfd, u32 id, const struct fd_parms *p, int major, in
 	 */
 
 	if (!tty_test_and_set(e.tty_info_id, tty_bitmap))
-		ret = dump_pty_info(lfd, e.tty_info_id, p, major, index);
+		ret = dump_pty_info(lfd, e.tty_info_id, p, major, minor, index);
 
 	if (!ret)
 		ret = pb_write_one(img_from_set(glob_imgset, CR_FD_TTY_FILES), &e, PB_TTY_FILE);
-- 
1.9.3



More information about the CRIU mailing list