criu/include
Cyrill Gorcunov 89a7a45d37 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
..
atomic.h atomic: add atomic_dec_and_test 2012-09-11 17:55:23 +04:00
bitops.h headers: mark functions as inline 2012-05-18 19:01:44 +04:00
compiler.h files: Use sys_kcmp to find file descriptor duplicates v4 2012-02-28 19:13:47 +04:00
crtools.h tty: Add checkpoint/restore for unix terminals v6 2012-09-12 20:00:54 +04:00
eventfd.h dump: Move per-type dump opts into respective .c files 2012-05-04 15:34:55 +04:00
eventpoll.h dump: Move per-type dump opts into respective .c files 2012-05-04 15:34:55 +04:00
fifo.h fifo: Add checkpoint restore for fifos v4 2012-07-01 17:15:48 +04:00
file-ids.h protobuf: Start switching our image entries to Google's protobuf 2012-07-17 07:10:41 +04:00
files-reg.h restore: auto-unlink for ghost files (v2) 2012-09-11 17:59:59 +04:00
files.h files: place the state POST_CREATE after the state RECV 2012-09-12 17:50:22 +04:00
image.h tty: Add checkpoint/restore for unix terminals v6 2012-09-12 20:00:54 +04:00
inet_diag.h Trivial whitespace cleanup 2012-01-30 21:29:42 +04:00
inotify.h dump: Move per-type dump opts into respective .c files 2012-05-04 15:34:55 +04:00
ipc_ns.h show: Introduce ->show callback for fdset 2012-03-27 12:01:14 +04:00
kcmp-ids.h kcmp: Introduce generic object ID generator 2012-04-09 18:01:18 +04:00
libnetlink.h libnetlink: More helpers 2012-08-10 17:21:34 +04:00
linkage.h parasite: Move bootstrap code into parasite-head-x86-64.S 2012-04-18 18:22:52 +04:00
list.h list: Cleanup spaces/tabs mess 2012-02-01 14:38:49 +04:00
lock.h crtools: add a separate type for atomic variables 2012-09-11 17:55:15 +04:00
log-levels.h Introduce log-levels.h 2012-09-03 14:43:51 +04:00
log.h log: Add log_get_loglevel() helper 2012-09-03 14:44:01 +04:00
memcpy_64.h Add builtin_memcpy helper 2012-03-29 15:14:06 +04:00
mount.h mount: Add abstraction layer for dumping file systems (v2) 2012-08-09 16:27:30 +04:00
namespaces.h ns: Add ability to save original ns and restoring it back while switcing 2012-08-02 07:55:05 +04:00
net.h net: add ability to set names for outside links of veth devices 2012-09-02 01:07:32 +04:00
netfilter.h net: Add code for locking a tcp connection with netfilter 2012-04-28 17:59:21 +04:00
packet_diag.h packet: Update diag header with fanout and rings 2012-08-20 15:32:25 +04:00
parasite-syscall.h crtools: use pit_t for PIDs 2012-09-07 19:16:35 +04:00
parasite.h parasite: get a file descriptor for procfs from a target pidns (v2) 2012-09-07 19:16:33 +04:00
pipes.h protobuf: Convert struct pipe_data_entry to PB engine 2012-07-17 14:50:23 +04:00
proc_parse.h mount: Add abstraction layer for dumping file systems (v2) 2012-08-09 16:27:30 +04:00
processor-flags.h Add processor-flags.h 2012-02-14 17:18:08 +04:00
protobuf.h tty: Add checkpoint/restore for unix terminals v6 2012-09-12 20:00:54 +04:00
pstree.h pstree: move all code about pstree in a separate file 2012-06-27 21:07:30 +04:00
ptrace.h Helper for si_code event extraction. 2012-04-25 21:35:40 +04:00
rbtree.h headers: mark functions as inline 2012-05-18 19:01:44 +04:00
restorer-log.h log, restorer: Make write_ log helpers to honor logging level 2012-09-05 17:16:38 +04:00
restorer.h restorer: Pass current log level to the arguments 2012-09-03 14:44:09 +04:00
shmem.h shmem: Get rid of static array of dumped shmem areas 2012-08-17 00:20:58 +04:00
signalfd.h signalfd: Dumping and restoring 2012-08-02 12:26:35 +04:00
sk-inet.h restore: disable repair mode in post_open() 2012-08-27 23:16:50 +04:00
sk-packet.h packet: Rings support 2012-08-20 15:32:55 +04:00
sk-queue.h sk-queue: Move struct sk_packet to C file 2012-07-16 07:05:06 +04:00
sockets.h sk-unix: connect unix sockets in post_open 2012-08-20 17:50:16 +04:00
syscall-types.h syscalls: Add futex robust list helpers 2012-08-10 12:23:03 +04:00
syscall-x86-64.def parasite: get a file descriptor for procfs from a target pidns (v2) 2012-09-07 19:16:33 +04:00
sysctl.h show: Use pr_msg for showing contents on console 2012-03-02 11:12:59 +04:00
tty.h tty: Add checkpoint/restore for unix terminals v6 2012-09-12 20:00:54 +04:00
types.h crtools: add a separate type for atomic variables 2012-09-11 17:55:15 +04:00
unix_diag.h sockets: Update unix_diag.h 2012-01-10 17:26:50 +04:00
util-net.h fown: get pid and uid-s from parasite 2012-09-05 16:41:14 +04:00
util.h util: add ability to change a file descriptor on procfs (v2) 2012-09-07 19:16:34 +04:00
uts_ns.h show: Introduce ->show callback for fdset 2012-03-27 12:01:14 +04:00