2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-31 14:25:49 +00:00

fifo: Add checkpoint restore for fifos v4

Checkpoint and restore of fifo is similar to
pipes c/r except the pipe end-points are named
file.

Because the fifo has a name we use regular files
facility for fifo path c/r.

Still there is a trick used to "open" fifo:
the opening procedure migh sleep if a fifo's peer
is not yet opened, so before doing a real open
we yield a fake open procedure (with O_RDWR flag)
which prevents us from sleeping even if peer
is not yet ready. Also we need writable fifo
end to restore data queued.

v2:
 - add open/priv members to reg_file_info
 - make open_fifo_fd to use open_fe_fd
 - comment on pipe_id
 - make sure the fifo data is not restored twice

v3:
 - drop useless fixme comment and add sane one
v4:
 - Use restore_data flag to escape data restore duplication
 - Use S_ISREG for file contents copying

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Cyrill Gorcunov
2012-06-26 02:36:13 +04:00
committed by Pavel Emelyanov
parent 18145c50c1
commit ea1ce8e472
11 changed files with 297 additions and 22 deletions

View File

@@ -17,6 +17,8 @@
#define VMAS_MAGIC 0x54123737 /* Tula */
#define PIPES_MAGIC 0x56513555 /* Tver */
#define PIPES_DATA_MAGIC 0x56453709 /* Dubna */
#define FIFO_MAGIC 0x58364939 /* Kirov */
#define FIFO_DATA_MAGIC 0x59333054 /* Tosno */
#define SIGACT_MAGIC 0x55344201 /* Murom */
#define UNIXSK_MAGIC 0x54373943 /* Ryazan */
#define INETSK_MAGIC 0x56443851 /* Pereslavl */
@@ -45,6 +47,7 @@ enum fd_types {
FDINFO_UND,
FDINFO_REG,
FDINFO_PIPE,
FDINFO_FIFO,
FDINFO_INETSK,
FDINFO_UNIXSK,
FDINFO_EVENTFD,
@@ -162,6 +165,11 @@ struct pipe_data_entry {
u8 data[0];
} __packed;
struct fifo_entry {
u32 id;
u32 pipe_id;
} __packed;
/*
* splice() connect cache pages to pipe buffer, so
* some part of pages may be loosed if data are not