criu/include/cr_options.h
Pavel Emelyanov 84eb0a1927 criu: Restore tasks as siblings in swrk
Andrey validly pointed out, that restoring pdeath_sig is not
compatible with criu_restore_child() call -- after criu restore
children, it will exit and fire the pdeath_sig into restored
tree root, potentially killing it.

The fix for that could be -- when started in swrk more, criu can
restore tree not as children tasks, but as siblings, using the
CLONE_PARENT flag when fork()-ing the root task.

With this we should also take care about errors handing -- right
now criu catches the SIGCHILD from dying children tasks, and
since we plan to create them be children of the criu parent (the
library caller) we will not be able to catch them. To do so we
SEIZE the root task in advance thus causing all SIGCHLD-s go to
criu, not to its parent.

Having this done we no longer need the SUBREAPER trick in the
library call -- tasks get restored right as callers kids :)

Some thoughts for future -- using this trick we can finally make
"natural" restoration of shell jobs. I.e. -- make criu restore
some subtree right under bash, w/o leaving itself as intermediate
task and w/o re-parenting the subtree to init after restore.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Andrey Vagin <avagin@parallels.com>
2014-07-01 16:16:07 +04:00

60 lines
1.1 KiB
C

#ifndef __CR_OPTIONS_H__
#define __CR_OPTIONS_H__
#include <stdbool.h>
#include "list.h"
struct script {
struct list_head node;
char *path;
int arg;
};
#define SCRIPT_RPC_NOTIFY (char *)0x1
/*
* CPU capability options.
*/
#define CPU_CAP_FPU (1u)
#define CPU_CAP_ALL (-1u)
struct cr_options {
int final_state;
char *show_dump_file;
char *show_fmt;
bool check_ms_kernel;
bool show_pages_content;
bool restore_detach;
bool ext_unix_sk;
bool shell_job;
bool handle_file_locks;
bool tcp_established_ok;
bool evasive_devices;
bool link_remap_ok;
unsigned int rst_namespaces_flags;
bool log_file_per_pid;
bool swrk_restore;
char *output;
char *root;
char *pidfile;
struct list_head veth_pairs;
struct list_head scripts;
struct list_head ext_mounts;
char *libdir;
bool use_page_server;
unsigned short ps_port;
char *addr;
bool track_mem;
char *img_parent;
bool auto_dedup;
unsigned int cpu_cap;
bool force_irmap;
char **exec_cmd;
};
extern struct cr_options opts;
extern void init_opts(void);
#endif /* __CR_OPTIONS_H__ */