2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-22 09:58:09 +00:00
criu/images/fdinfo.proto

85 lines
1.9 KiB
Protocol Buffer
Raw Permalink Normal View History

// SPDX-License-Identifier: MIT
syntax = "proto2";
import "regfile.proto";
import "sk-inet.proto";
import "ns.proto";
import "packet-sock.proto";
import "sk-netlink.proto";
import "eventfd.proto";
import "eventpoll.proto";
import "signalfd.proto";
import "tun.proto";
import "timerfd.proto";
import "fsnotify.proto";
import "ext-file.proto";
import "sk-unix.proto";
import "fifo.proto";
import "pipe.proto";
import "pidfd.proto";
import "tty.proto";
import "memfd.proto";
import "bpfmap-file.proto";
enum fd_types {
UND = 0;
REG = 1;
PIPE = 2;
FIFO = 3;
INETSK = 4;
UNIXSK = 5;
EVENTFD = 6;
EVENTPOLL = 7;
INOTIFY = 8;
SIGNALFD = 9;
PACKETSK = 10;
tty: Add checkpoint/restore for unix terminals v6 Usually the PTYs represent a pair of links -- master peer and slave peer. Master peer must be opened before slave. Internally, when kernel creates master peer it also generates a slave interface in a form of /dev/pts/N, where N is that named pty "index". Master/slave connection unambiguously identified by this index. Still, one master can carry multiple slaves -- for example a user opens one master via /dev/ptmx and appropriate /dev/pts/N in sequence. The result will be the following master `- slave 1 `- slave 2 both slave will have same master index but different file descriptors. Still inside the kernel pty parameters are same for both slaves. Thus only one slave parameters should be restored, there is no need to carry all parameters for every slave peer we've found. Not yet addressed problems: - At moment of restore the master peer might be already closed for any reason so to resolve such problem we need to open a fake master peer with proper index and hook a slave on it, then we close master peer. - Need to figure out how to deal with ttys which have some data in buffers not yet flushed, at moment this data will be simply lost during c/r - Need to restore control terminals - Need to fetch tty flags such as exclusive/packet-mode, this can't be done without kernel patching [ avagin@: - ideas on contol terminals restore - overall code redesign and simplification ] v4: - drop redundant pid from dump_chrdev - make sure optional fown is passed on regular ptys - add a comments about zeroifying termios - get rid of redundant empty line in files.c v5 (by avagin@): - complete rework of tty image format, now we have two files -- tty.img and tty-info.img. The idea behind to reduce data being stored. v6 (by xemul@): - packet mode should be set to true in image, until properly fetched from the kernel - verify image data on retrieval Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org> CC: Andrey Vagin <avagin@openvz.org> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-09-12 20:00:54 +04:00
TTY = 11;
FANOTIFY = 12;
NETLINKSK = 13;
NS = 14;
TUNF = 15;
EXT = 16;
TIMERFD = 17;
MEMFD = 18;
BPFMAP = 19;
PIDFD = 20;
/* Any number above the real used. Not stored to image */
CTL_TTY = 65534;
AUTOFS_PIPE = 65535;
}
message fdinfo_entry {
required uint32 id = 1;
required uint32 flags = 2;
required fd_types type = 3;
required uint32 fd = 4;
optional string xattr_security_selinux = 5;
}
message file_entry {
required fd_types type = 1;
required uint32 id = 2;
optional reg_file_entry reg = 3;
optional inet_sk_entry isk = 4;
optional ns_file_entry nsf = 5;
optional packet_sock_entry psk = 6;
optional netlink_sk_entry nlsk = 7;
optional eventfd_file_entry efd = 8;
optional eventpoll_file_entry epfd = 9;
optional signalfd_entry sgfd = 10;
optional tunfile_entry tunf = 11;
optional timerfd_entry tfd = 12;
optional inotify_file_entry ify = 13;
optional fanotify_file_entry ffy = 14;
optional ext_file_entry ext = 15;
optional unix_sk_entry usk = 16;
optional fifo_entry fifo = 17;
optional pipe_entry pipe = 18;
optional tty_file_entry tty = 19;
optional memfd_file_entry memfd = 20;
optional bpfmap_file_entry bpf = 21;
optional pidfd_entry pidfd = 22;
}