2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-22 01:51:51 +00:00
criu/images/tty.proto
Cyrill Gorcunov ebc3421df2 tty: Write unread pty buffers on post dump stage
Updated version attached.

>From 6c0e1522e01e01aa89861862fbdf039a0892b89b Mon Sep 17 00:00:00 2001
From: Cyrill Gorcunov <gorcunov@openvz.org>
Date: Tue, 12 Apr 2016 20:00:24 +0300
Subject: [PATCH 1/2] tty: Write unread pty buffers on post dump stage

When unread data present on peers we currently simply ignore it but
actually we can try to fetch it in non(that)destructive way.

For this sake at the end of dump procedure (because fetching
queued data may go wrong and we will have to write it back,
which is heavy, and we need all ttys under our hands)
we walk over all collected TTYs and link PTYs peers which
indices are matching. Note to not overload tty_dump_info we
reuse @list member for new @all_ptys list.

Once link established we literally read queued data and flush
it into new tty-data.img. If something go wrong at this moment,
we stop reading queued data but walk back over already queued
ones and write them back to restore former state. Same applies
if the dump has been requested to leave task alive.

On restore we link peers back and write queued data once
peer back to live.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-05-27 13:39:00 +03:00

80 lines
1.6 KiB
Protocol Buffer

import "opts.proto";
import "fown.proto";
message winsize_entry {
required uint32 ws_row = 1;
required uint32 ws_col = 2;
required uint32 ws_xpixel = 3;
required uint32 ws_ypixel = 4;
};
message termios_entry {
required uint32 c_iflag = 1;
required uint32 c_oflag = 2;
required uint32 c_cflag = 3;
required uint32 c_lflag = 4;
required uint32 c_line = 5;
required uint32 c_ispeed = 6;
required uint32 c_ospeed = 7;
repeated uint32 c_cc = 8;
}
message tty_pty_entry {
required uint32 index = 1;
}
enum TtyType {
UNKNOWN = 0;
PTY = 1;
CONSOLE = 2;
VT = 3;
CTTY = 4;
EXT_TTY = 5;
SERIAL = 6;
}
message tty_data_entry {
required uint32 tty_id = 1;
required bytes data = 2;
}
message tty_info_entry {
required uint32 id = 1;
required TtyType type = 2;
required bool locked = 3; /* Unix98 PTY only */
required bool exclusive = 4;
required bool packet_mode = 5; /* Unix98 PTY only */
required uint32 sid = 6;
required uint32 pgrp = 7;
/*
* Convenient for printing errors and such, with this
* device encoded we can figure out major and minor
* numbers.
*/
required uint32 rdev = 8;
optional termios_entry termios = 9;
optional termios_entry termios_locked = 10;
optional winsize_entry winsize = 11;
/*
* These are optional fields which presense depends on
* TTY type.
*/
optional tty_pty_entry pty = 12;
optional uint32 dev = 13;
};
message tty_file_entry {
required uint32 id = 1;
required uint32 tty_info_id = 2;
required uint32 flags = 3 [(criu).hex = true];
required fown_entry fown = 4;
}