[CRIU] [PATCH 07/18] tty: Generate unique ID for satellite regfile entry
Pavel Emelyanov
xemul at virtuozzo.com
Mon Jul 10 12:39:19 MSK 2017
Same thing as for fifo-s.
Signed-off-by: Pavel Emelyanov <xemul at virtuozzo.com>
---
criu/tty.c | 18 ++++++++++++++----
images/tty.proto | 1 +
2 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/criu/tty.c b/criu/tty.c
index a967ee3..b42e54a 100644
--- a/criu/tty.c
+++ b/criu/tty.c
@@ -1619,7 +1619,8 @@ static int collect_one_tty(void *obj, ProtobufCMessage *msg, struct cr_img *i)
* reg file rectord because they are inherited from
* command line on restore.
*/
- info->reg_d = try_collect_special_file(info->tfe->id, 1);
+ info->reg_d = try_collect_special_file( info->tfe->has_regf_id ?
+ info->tfe->regf_id : info->tfe->id, 1);
if (!info->reg_d) {
if (info->driver->type != TTY_TYPE__EXT_TTY) {
if (!deprecated_ok("TTY w/o regfile"))
@@ -1908,14 +1909,23 @@ static int dump_one_tty(int lfd, u32 id, const struct fd_parms *p)
return -1;
}
- if (driver->type != TTY_TYPE__EXT_TTY && dump_one_reg_file(lfd, id, p))
- return -1;
-
e.id = id;
e.tty_info_id = tty_gen_id(driver, index);
e.flags = p->flags;
e.fown = (FownEntry *)&p->fown;
+ if (driver->type != TTY_TYPE__EXT_TTY) {
+ u32 rf_id;
+
+ fd_id_generate_special(NULL, &rf_id);
+ if (dump_one_reg_file(lfd, rf_id, p))
+ return -1;
+
+ e.has_regf_id = true;
+ e.regf_id = rf_id;
+ }
+
+
/*
* FIXME
*
diff --git a/images/tty.proto b/images/tty.proto
index 8ae804a..12c6166 100644
--- a/images/tty.proto
+++ b/images/tty.proto
@@ -87,4 +87,5 @@ message tty_file_entry {
required fown_entry fown = 4;
// optional sint32 mnt_id = 5 [default = 0];
+ optional uint32 regf_id = 6;
}
--
2.1.4
More information about the CRIU
mailing list