File manager - Edit - /home/proidvn/site.proid.vn/wp-includes/js/codemirror/criu.tar
Back
rpc.proto 0000644 00000014255 15220533627 0006431 0 ustar 00 // SPDX-License-Identifier: MIT syntax = "proto2"; message criu_page_server_info { optional string address = 1; optional int32 port = 2; optional int32 pid = 3; optional int32 fd = 4; } message criu_veth_pair { required string if_in = 1; required string if_out = 2; }; message ext_mount_map { required string key = 1; required string val = 2; }; message join_namespace { required string ns = 1; required string ns_file = 2; optional string extra_opt = 3; } message inherit_fd { required string key = 1; required int32 fd = 2; }; message cgroup_root { optional string ctrl = 1; required string path = 2; }; message unix_sk { required uint32 inode = 1; }; enum criu_cg_mode { IGNORE = 0; CG_NONE = 1; PROPS = 2; SOFT = 3; FULL = 4; STRICT = 5; DEFAULT = 6; }; enum criu_network_lock_method { IPTABLES = 1; NFTABLES = 2; SKIP = 3; }; enum criu_pre_dump_mode { SPLICE = 1; VM_READ = 2; }; message criu_opts { required int32 images_dir_fd = 1 [default = -1]; optional string images_dir = 68; /* used only if images_dir_fd == -1 */ optional int32 pid = 2; /* if not set on dump, will dump requesting process */ optional bool leave_running = 3; optional bool ext_unix_sk = 4; optional bool tcp_established = 5; optional bool evasive_devices = 6; optional bool shell_job = 7; optional bool file_locks = 8; optional int32 log_level = 9 [default = 2]; optional string log_file = 10; /* No subdirs are allowed. Consider using work-dir */ optional criu_page_server_info ps = 11; optional bool notify_scripts = 12; optional string root = 13; optional string parent_img = 14; optional bool track_mem = 15; optional bool auto_dedup = 16; optional int32 work_dir_fd = 17; optional bool link_remap = 18; repeated criu_veth_pair veths = 19; /* DEPRECATED, use external instead */ optional uint32 cpu_cap = 20 [default = 0xffffffff]; optional bool force_irmap = 21; repeated string exec_cmd = 22; repeated ext_mount_map ext_mnt = 23; /* DEPRECATED, use external instead */ optional bool manage_cgroups = 24; /* backward compatibility */ repeated cgroup_root cg_root = 25; optional bool rst_sibling = 26; /* swrk only */ repeated inherit_fd inherit_fd = 27; /* swrk only */ optional bool auto_ext_mnt = 28; optional bool ext_sharing = 29; optional bool ext_masters = 30; repeated string skip_mnt = 31; repeated string enable_fs = 32; repeated unix_sk unix_sk_ino = 33; /* DEPRECATED, use external instead */ optional criu_cg_mode manage_cgroups_mode = 34; optional uint32 ghost_limit = 35 [default = 0x100000]; repeated string irmap_scan_paths = 36; repeated string external = 37; optional uint32 empty_ns = 38; repeated join_namespace join_ns = 39; optional string cgroup_props = 41; optional string cgroup_props_file = 42; repeated string cgroup_dump_controller = 43; optional string freeze_cgroup = 44; optional uint32 timeout = 45; optional bool tcp_skip_in_flight = 46; optional bool weak_sysctls = 47; optional bool lazy_pages = 48; optional int32 status_fd = 49; optional bool orphan_pts_master = 50; optional string config_file = 51; optional bool tcp_close = 52; optional string lsm_profile = 53; optional string tls_cacert = 54; optional string tls_cacrl = 55; optional string tls_cert = 56; optional string tls_key = 57; optional bool tls = 58; optional bool tls_no_cn_verify = 59; optional string cgroup_yard = 60; optional criu_pre_dump_mode pre_dump_mode = 61 [default = SPLICE]; optional int32 pidfd_store_sk = 62; optional string lsm_mount_context = 63; optional criu_network_lock_method network_lock = 64 [default = IPTABLES]; optional bool mntns_compat_mode = 65; optional bool skip_file_rwx_check = 66; optional bool unprivileged = 67; optional bool leave_stopped = 69; optional bool display_stats = 70; optional bool log_to_stderr = 71; /* CloudLinux LVE: match CLI --root-only (see cr_options.h / config.c) */ optional bool root_only = 72; /* optional bool check_mounts = 128; */ } message criu_dump_resp { optional bool restored = 1; } message criu_restore_resp { required int32 pid = 1; } message criu_notify { optional string script = 1; optional int32 pid = 2; } enum criu_req_type { EMPTY = 0; DUMP = 1; RESTORE = 2; CHECK = 3; PRE_DUMP = 4; PAGE_SERVER = 5; NOTIFY = 6; CPUINFO_DUMP = 7; CPUINFO_CHECK = 8; FEATURE_CHECK = 9; VERSION = 10; WAIT_PID = 11; PAGE_SERVER_CHLD = 12; SINGLE_PRE_DUMP = 13; } /* * List of features which can queried via * CRIU_REQ_TYPE__FEATURE_CHECK */ message criu_features { optional bool mem_track = 1; optional bool lazy_pages = 2; optional bool pidfd_store = 3; } /* * Request -- each type corresponds to must-be-there * request arguments of respective type */ message criu_req { required criu_req_type type = 1; optional criu_opts opts = 2; optional bool notify_success = 3; /* * When set service won't close the connection but * will wait for more req-s to appear. Works not * for all request types. */ optional bool keep_open = 4; /* * 'features' can be used to query which features * are supported by the installed criu/kernel * via RPC. */ optional criu_features features = 5; /* 'pid' is used for WAIT_PID */ optional uint32 pid = 6; } /* * Response -- it states whether the request was served * and additional request-specific information */ message criu_resp { required criu_req_type type = 1; required bool success = 2; optional criu_dump_resp dump = 3; optional criu_restore_resp restore = 4; optional criu_notify notify = 5; optional criu_page_server_info ps = 6; optional int32 cr_errno = 7; optional criu_features features = 8; optional string cr_errmsg = 9; optional criu_version version = 10; optional int32 status = 11; } /* Answer for criu_req_type.VERSION requests */ message criu_version { required int32 major_number = 1; required int32 minor_number = 2; optional string gitid = 3; optional int32 sublevel = 4; optional int32 extra = 5; optional string name = 6; } rpc.pb-c.h 0000644 00000064652 15220533627 0006343 0 ustar 00 /* Generated by the protocol buffer compiler. DO NOT EDIT! */ /* Generated from: rpc.proto */ #ifndef PROTOBUF_C_rpc_2eproto__INCLUDED #define PROTOBUF_C_rpc_2eproto__INCLUDED #include <protobuf-c/protobuf-c.h> PROTOBUF_C__BEGIN_DECLS #if PROTOBUF_C_VERSION_NUMBER < 1000000 # error This file was generated by a newer version of protoc-c which is incompatible with your libprotobuf-c headers. Please update your headers. #elif 1003003 < PROTOBUF_C_MIN_COMPILER_VERSION # error This file was generated by an older version of protoc-c which is incompatible with your libprotobuf-c headers. Please regenerate this file with a newer version of protoc-c. #endif typedef struct _CriuPageServerInfo CriuPageServerInfo; typedef struct _CriuVethPair CriuVethPair; typedef struct _ExtMountMap ExtMountMap; typedef struct _JoinNamespace JoinNamespace; typedef struct _InheritFd InheritFd; typedef struct _CgroupRoot CgroupRoot; typedef struct _UnixSk UnixSk; typedef struct _CriuOpts CriuOpts; typedef struct _CriuDumpResp CriuDumpResp; typedef struct _CriuRestoreResp CriuRestoreResp; typedef struct _CriuNotify CriuNotify; typedef struct _CriuFeatures CriuFeatures; typedef struct _CriuReq CriuReq; typedef struct _CriuResp CriuResp; typedef struct _CriuVersion CriuVersion; /* --- enums --- */ typedef enum _CriuCgMode { CRIU_CG_MODE__IGNORE = 0, CRIU_CG_MODE__CG_NONE = 1, CRIU_CG_MODE__PROPS = 2, CRIU_CG_MODE__SOFT = 3, CRIU_CG_MODE__FULL = 4, CRIU_CG_MODE__STRICT = 5, CRIU_CG_MODE__DEFAULT = 6 PROTOBUF_C__FORCE_ENUM_TO_BE_INT_SIZE(CRIU_CG_MODE) } CriuCgMode; typedef enum _CriuNetworkLockMethod { CRIU_NETWORK_LOCK_METHOD__IPTABLES = 1, CRIU_NETWORK_LOCK_METHOD__NFTABLES = 2, CRIU_NETWORK_LOCK_METHOD__SKIP = 3 PROTOBUF_C__FORCE_ENUM_TO_BE_INT_SIZE(CRIU_NETWORK_LOCK_METHOD) } CriuNetworkLockMethod; typedef enum _CriuPreDumpMode { CRIU_PRE_DUMP_MODE__SPLICE = 1, CRIU_PRE_DUMP_MODE__VM_READ = 2 PROTOBUF_C__FORCE_ENUM_TO_BE_INT_SIZE(CRIU_PRE_DUMP_MODE) } CriuPreDumpMode; typedef enum _CriuReqType { CRIU_REQ_TYPE__EMPTY = 0, CRIU_REQ_TYPE__DUMP = 1, CRIU_REQ_TYPE__RESTORE = 2, CRIU_REQ_TYPE__CHECK = 3, CRIU_REQ_TYPE__PRE_DUMP = 4, CRIU_REQ_TYPE__PAGE_SERVER = 5, CRIU_REQ_TYPE__NOTIFY = 6, CRIU_REQ_TYPE__CPUINFO_DUMP = 7, CRIU_REQ_TYPE__CPUINFO_CHECK = 8, CRIU_REQ_TYPE__FEATURE_CHECK = 9, CRIU_REQ_TYPE__VERSION = 10, CRIU_REQ_TYPE__WAIT_PID = 11, CRIU_REQ_TYPE__PAGE_SERVER_CHLD = 12, CRIU_REQ_TYPE__SINGLE_PRE_DUMP = 13 PROTOBUF_C__FORCE_ENUM_TO_BE_INT_SIZE(CRIU_REQ_TYPE) } CriuReqType; /* --- messages --- */ struct _CriuPageServerInfo { ProtobufCMessage base; char *address; protobuf_c_boolean has_port; int32_t port; protobuf_c_boolean has_pid; int32_t pid; protobuf_c_boolean has_fd; int32_t fd; }; #define CRIU_PAGE_SERVER_INFO__INIT \ { PROTOBUF_C_MESSAGE_INIT (&criu_page_server_info__descriptor) \ , NULL, 0, 0, 0, 0, 0, 0 } struct _CriuVethPair { ProtobufCMessage base; char *if_in; char *if_out; }; #define CRIU_VETH_PAIR__INIT \ { PROTOBUF_C_MESSAGE_INIT (&criu_veth_pair__descriptor) \ , NULL, NULL } struct _ExtMountMap { ProtobufCMessage base; char *key; char *val; }; #define EXT_MOUNT_MAP__INIT \ { PROTOBUF_C_MESSAGE_INIT (&ext_mount_map__descriptor) \ , NULL, NULL } struct _JoinNamespace { ProtobufCMessage base; char *ns; char *ns_file; char *extra_opt; }; #define JOIN_NAMESPACE__INIT \ { PROTOBUF_C_MESSAGE_INIT (&join_namespace__descriptor) \ , NULL, NULL, NULL } struct _InheritFd { ProtobufCMessage base; char *key; int32_t fd; }; #define INHERIT_FD__INIT \ { PROTOBUF_C_MESSAGE_INIT (&inherit_fd__descriptor) \ , NULL, 0 } struct _CgroupRoot { ProtobufCMessage base; char *ctrl; char *path; }; #define CGROUP_ROOT__INIT \ { PROTOBUF_C_MESSAGE_INIT (&cgroup_root__descriptor) \ , NULL, NULL } struct _UnixSk { ProtobufCMessage base; uint32_t inode; }; #define UNIX_SK__INIT \ { PROTOBUF_C_MESSAGE_INIT (&unix_sk__descriptor) \ , 0 } struct _CriuOpts { ProtobufCMessage base; int32_t images_dir_fd; /* * used only if images_dir_fd == -1 */ char *images_dir; /* * if not set on dump, will dump requesting process */ protobuf_c_boolean has_pid; int32_t pid; protobuf_c_boolean has_leave_running; protobuf_c_boolean leave_running; protobuf_c_boolean has_ext_unix_sk; protobuf_c_boolean ext_unix_sk; protobuf_c_boolean has_tcp_established; protobuf_c_boolean tcp_established; protobuf_c_boolean has_evasive_devices; protobuf_c_boolean evasive_devices; protobuf_c_boolean has_shell_job; protobuf_c_boolean shell_job; protobuf_c_boolean has_file_locks; protobuf_c_boolean file_locks; protobuf_c_boolean has_log_level; int32_t log_level; /* * No subdirs are allowed. Consider using work-dir */ char *log_file; CriuPageServerInfo *ps; protobuf_c_boolean has_notify_scripts; protobuf_c_boolean notify_scripts; char *root; char *parent_img; protobuf_c_boolean has_track_mem; protobuf_c_boolean track_mem; protobuf_c_boolean has_auto_dedup; protobuf_c_boolean auto_dedup; protobuf_c_boolean has_work_dir_fd; int32_t work_dir_fd; protobuf_c_boolean has_link_remap; protobuf_c_boolean link_remap; /* * DEPRECATED, use external instead */ size_t n_veths; CriuVethPair **veths; protobuf_c_boolean has_cpu_cap; uint32_t cpu_cap; protobuf_c_boolean has_force_irmap; protobuf_c_boolean force_irmap; size_t n_exec_cmd; char **exec_cmd; /* * DEPRECATED, use external instead */ size_t n_ext_mnt; ExtMountMap **ext_mnt; /* * backward compatibility */ protobuf_c_boolean has_manage_cgroups; protobuf_c_boolean manage_cgroups; size_t n_cg_root; CgroupRoot **cg_root; /* * swrk only */ protobuf_c_boolean has_rst_sibling; protobuf_c_boolean rst_sibling; /* * swrk only */ size_t n_inherit_fd; InheritFd **inherit_fd; protobuf_c_boolean has_auto_ext_mnt; protobuf_c_boolean auto_ext_mnt; protobuf_c_boolean has_ext_sharing; protobuf_c_boolean ext_sharing; protobuf_c_boolean has_ext_masters; protobuf_c_boolean ext_masters; size_t n_skip_mnt; char **skip_mnt; size_t n_enable_fs; char **enable_fs; /* * DEPRECATED, use external instead */ size_t n_unix_sk_ino; UnixSk **unix_sk_ino; protobuf_c_boolean has_manage_cgroups_mode; CriuCgMode manage_cgroups_mode; protobuf_c_boolean has_ghost_limit; uint32_t ghost_limit; size_t n_irmap_scan_paths; char **irmap_scan_paths; size_t n_external; char **external; protobuf_c_boolean has_empty_ns; uint32_t empty_ns; size_t n_join_ns; JoinNamespace **join_ns; char *cgroup_props; char *cgroup_props_file; size_t n_cgroup_dump_controller; char **cgroup_dump_controller; char *freeze_cgroup; protobuf_c_boolean has_timeout; uint32_t timeout; protobuf_c_boolean has_tcp_skip_in_flight; protobuf_c_boolean tcp_skip_in_flight; protobuf_c_boolean has_weak_sysctls; protobuf_c_boolean weak_sysctls; protobuf_c_boolean has_lazy_pages; protobuf_c_boolean lazy_pages; protobuf_c_boolean has_status_fd; int32_t status_fd; protobuf_c_boolean has_orphan_pts_master; protobuf_c_boolean orphan_pts_master; char *config_file; protobuf_c_boolean has_tcp_close; protobuf_c_boolean tcp_close; char *lsm_profile; char *tls_cacert; char *tls_cacrl; char *tls_cert; char *tls_key; protobuf_c_boolean has_tls; protobuf_c_boolean tls; protobuf_c_boolean has_tls_no_cn_verify; protobuf_c_boolean tls_no_cn_verify; char *cgroup_yard; protobuf_c_boolean has_pre_dump_mode; CriuPreDumpMode pre_dump_mode; protobuf_c_boolean has_pidfd_store_sk; int32_t pidfd_store_sk; char *lsm_mount_context; protobuf_c_boolean has_network_lock; CriuNetworkLockMethod network_lock; protobuf_c_boolean has_mntns_compat_mode; protobuf_c_boolean mntns_compat_mode; protobuf_c_boolean has_skip_file_rwx_check; protobuf_c_boolean skip_file_rwx_check; protobuf_c_boolean has_unprivileged; protobuf_c_boolean unprivileged; protobuf_c_boolean has_leave_stopped; protobuf_c_boolean leave_stopped; protobuf_c_boolean has_display_stats; protobuf_c_boolean display_stats; protobuf_c_boolean has_log_to_stderr; protobuf_c_boolean log_to_stderr; /* * CloudLinux LVE: match CLI --root-only (see cr_options.h / config.c) */ /* * optional bool check_mounts = 128; */ protobuf_c_boolean has_root_only; protobuf_c_boolean root_only; }; #define CRIU_OPTS__INIT \ { PROTOBUF_C_MESSAGE_INIT (&criu_opts__descriptor) \ , -1, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, NULL, NULL, 0, 0, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0,NULL, 0, 4294967295u, 0, 0, 0,NULL, 0,NULL, 0, 0, 0,NULL, 0, 0, 0,NULL, 0, 0, 0, 0, 0, 0, 0,NULL, 0,NULL, 0,NULL, 0, CRIU_CG_MODE__IGNORE, 0, 1048576u, 0,NULL, 0,NULL, 0, 0, 0,NULL, NULL, NULL, 0,NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, 0, 0, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, NULL, 0, CRIU_PRE_DUMP_MODE__SPLICE, 0, 0, NULL, 0, CRIU_NETWORK_LOCK_METHOD__IPTABLES, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } struct _CriuDumpResp { ProtobufCMessage base; protobuf_c_boolean has_restored; protobuf_c_boolean restored; }; #define CRIU_DUMP_RESP__INIT \ { PROTOBUF_C_MESSAGE_INIT (&criu_dump_resp__descriptor) \ , 0, 0 } struct _CriuRestoreResp { ProtobufCMessage base; int32_t pid; }; #define CRIU_RESTORE_RESP__INIT \ { PROTOBUF_C_MESSAGE_INIT (&criu_restore_resp__descriptor) \ , 0 } struct _CriuNotify { ProtobufCMessage base; char *script; protobuf_c_boolean has_pid; int32_t pid; }; #define CRIU_NOTIFY__INIT \ { PROTOBUF_C_MESSAGE_INIT (&criu_notify__descriptor) \ , NULL, 0, 0 } /* * List of features which can queried via * CRIU_REQ_TYPE__FEATURE_CHECK */ struct _CriuFeatures { ProtobufCMessage base; protobuf_c_boolean has_mem_track; protobuf_c_boolean mem_track; protobuf_c_boolean has_lazy_pages; protobuf_c_boolean lazy_pages; protobuf_c_boolean has_pidfd_store; protobuf_c_boolean pidfd_store; }; #define CRIU_FEATURES__INIT \ { PROTOBUF_C_MESSAGE_INIT (&criu_features__descriptor) \ , 0, 0, 0, 0, 0, 0 } struct _CriuReq { ProtobufCMessage base; CriuReqType type; CriuOpts *opts; protobuf_c_boolean has_notify_success; protobuf_c_boolean notify_success; /* * When set service won't close the connection but * will wait for more req-s to appear. Works not * for all request types. */ protobuf_c_boolean has_keep_open; protobuf_c_boolean keep_open; /* * 'features' can be used to query which features * are supported by the installed criu/kernel * via RPC. */ CriuFeatures *features; /* * 'pid' is used for WAIT_PID */ protobuf_c_boolean has_pid; uint32_t pid; }; #define CRIU_REQ__INIT \ { PROTOBUF_C_MESSAGE_INIT (&criu_req__descriptor) \ , CRIU_REQ_TYPE__EMPTY, NULL, 0, 0, 0, 0, NULL, 0, 0 } struct _CriuResp { ProtobufCMessage base; CriuReqType type; protobuf_c_boolean success; CriuDumpResp *dump; CriuRestoreResp *restore; CriuNotify *notify; CriuPageServerInfo *ps; protobuf_c_boolean has_cr_errno; int32_t cr_errno; CriuFeatures *features; char *cr_errmsg; CriuVersion *version; protobuf_c_boolean has_status; int32_t status; }; #define CRIU_RESP__INIT \ { PROTOBUF_C_MESSAGE_INIT (&criu_resp__descriptor) \ , CRIU_REQ_TYPE__EMPTY, 0, NULL, NULL, NULL, NULL, 0, 0, NULL, NULL, NULL, 0, 0 } /* * Answer for criu_req_type.VERSION requests */ struct _CriuVersion { ProtobufCMessage base; int32_t major_number; int32_t minor_number; char *gitid; protobuf_c_boolean has_sublevel; int32_t sublevel; protobuf_c_boolean has_extra; int32_t extra; char *name; }; #define CRIU_VERSION__INIT \ { PROTOBUF_C_MESSAGE_INIT (&criu_version__descriptor) \ , 0, 0, NULL, 0, 0, 0, 0, NULL } /* CriuPageServerInfo methods */ void criu_page_server_info__init (CriuPageServerInfo *message); size_t criu_page_server_info__get_packed_size (const CriuPageServerInfo *message); size_t criu_page_server_info__pack (const CriuPageServerInfo *message, uint8_t *out); size_t criu_page_server_info__pack_to_buffer (const CriuPageServerInfo *message, ProtobufCBuffer *buffer); CriuPageServerInfo * criu_page_server_info__unpack (ProtobufCAllocator *allocator, size_t len, const uint8_t *data); void criu_page_server_info__free_unpacked (CriuPageServerInfo *message, ProtobufCAllocator *allocator); /* CriuVethPair methods */ void criu_veth_pair__init (CriuVethPair *message); size_t criu_veth_pair__get_packed_size (const CriuVethPair *message); size_t criu_veth_pair__pack (const CriuVethPair *message, uint8_t *out); size_t criu_veth_pair__pack_to_buffer (const CriuVethPair *message, ProtobufCBuffer *buffer); CriuVethPair * criu_veth_pair__unpack (ProtobufCAllocator *allocator, size_t len, const uint8_t *data); void criu_veth_pair__free_unpacked (CriuVethPair *message, ProtobufCAllocator *allocator); /* ExtMountMap methods */ void ext_mount_map__init (ExtMountMap *message); size_t ext_mount_map__get_packed_size (const ExtMountMap *message); size_t ext_mount_map__pack (const ExtMountMap *message, uint8_t *out); size_t ext_mount_map__pack_to_buffer (const ExtMountMap *message, ProtobufCBuffer *buffer); ExtMountMap * ext_mount_map__unpack (ProtobufCAllocator *allocator, size_t len, const uint8_t *data); void ext_mount_map__free_unpacked (ExtMountMap *message, ProtobufCAllocator *allocator); /* JoinNamespace methods */ void join_namespace__init (JoinNamespace *message); size_t join_namespace__get_packed_size (const JoinNamespace *message); size_t join_namespace__pack (const JoinNamespace *message, uint8_t *out); size_t join_namespace__pack_to_buffer (const JoinNamespace *message, ProtobufCBuffer *buffer); JoinNamespace * join_namespace__unpack (ProtobufCAllocator *allocator, size_t len, const uint8_t *data); void join_namespace__free_unpacked (JoinNamespace *message, ProtobufCAllocator *allocator); /* InheritFd methods */ void inherit_fd__init (InheritFd *message); size_t inherit_fd__get_packed_size (const InheritFd *message); size_t inherit_fd__pack (const InheritFd *message, uint8_t *out); size_t inherit_fd__pack_to_buffer (const InheritFd *message, ProtobufCBuffer *buffer); InheritFd * inherit_fd__unpack (ProtobufCAllocator *allocator, size_t len, const uint8_t *data); void inherit_fd__free_unpacked (InheritFd *message, ProtobufCAllocator *allocator); /* CgroupRoot methods */ void cgroup_root__init (CgroupRoot *message); size_t cgroup_root__get_packed_size (const CgroupRoot *message); size_t cgroup_root__pack (const CgroupRoot *message, uint8_t *out); size_t cgroup_root__pack_to_buffer (const CgroupRoot *message, ProtobufCBuffer *buffer); CgroupRoot * cgroup_root__unpack (ProtobufCAllocator *allocator, size_t len, const uint8_t *data); void cgroup_root__free_unpacked (CgroupRoot *message, ProtobufCAllocator *allocator); /* UnixSk methods */ void unix_sk__init (UnixSk *message); size_t unix_sk__get_packed_size (const UnixSk *message); size_t unix_sk__pack (const UnixSk *message, uint8_t *out); size_t unix_sk__pack_to_buffer (const UnixSk *message, ProtobufCBuffer *buffer); UnixSk * unix_sk__unpack (ProtobufCAllocator *allocator, size_t len, const uint8_t *data); void unix_sk__free_unpacked (UnixSk *message, ProtobufCAllocator *allocator); /* CriuOpts methods */ void criu_opts__init (CriuOpts *message); size_t criu_opts__get_packed_size (const CriuOpts *message); size_t criu_opts__pack (const CriuOpts *message, uint8_t *out); size_t criu_opts__pack_to_buffer (const CriuOpts *message, ProtobufCBuffer *buffer); CriuOpts * criu_opts__unpack (ProtobufCAllocator *allocator, size_t len, const uint8_t *data); void criu_opts__free_unpacked (CriuOpts *message, ProtobufCAllocator *allocator); /* CriuDumpResp methods */ void criu_dump_resp__init (CriuDumpResp *message); size_t criu_dump_resp__get_packed_size (const CriuDumpResp *message); size_t criu_dump_resp__pack (const CriuDumpResp *message, uint8_t *out); size_t criu_dump_resp__pack_to_buffer (const CriuDumpResp *message, ProtobufCBuffer *buffer); CriuDumpResp * criu_dump_resp__unpack (ProtobufCAllocator *allocator, size_t len, const uint8_t *data); void criu_dump_resp__free_unpacked (CriuDumpResp *message, ProtobufCAllocator *allocator); /* CriuRestoreResp methods */ void criu_restore_resp__init (CriuRestoreResp *message); size_t criu_restore_resp__get_packed_size (const CriuRestoreResp *message); size_t criu_restore_resp__pack (const CriuRestoreResp *message, uint8_t *out); size_t criu_restore_resp__pack_to_buffer (const CriuRestoreResp *message, ProtobufCBuffer *buffer); CriuRestoreResp * criu_restore_resp__unpack (ProtobufCAllocator *allocator, size_t len, const uint8_t *data); void criu_restore_resp__free_unpacked (CriuRestoreResp *message, ProtobufCAllocator *allocator); /* CriuNotify methods */ void criu_notify__init (CriuNotify *message); size_t criu_notify__get_packed_size (const CriuNotify *message); size_t criu_notify__pack (const CriuNotify *message, uint8_t *out); size_t criu_notify__pack_to_buffer (const CriuNotify *message, ProtobufCBuffer *buffer); CriuNotify * criu_notify__unpack (ProtobufCAllocator *allocator, size_t len, const uint8_t *data); void criu_notify__free_unpacked (CriuNotify *message, ProtobufCAllocator *allocator); /* CriuFeatures methods */ void criu_features__init (CriuFeatures *message); size_t criu_features__get_packed_size (const CriuFeatures *message); size_t criu_features__pack (const CriuFeatures *message, uint8_t *out); size_t criu_features__pack_to_buffer (const CriuFeatures *message, ProtobufCBuffer *buffer); CriuFeatures * criu_features__unpack (ProtobufCAllocator *allocator, size_t len, const uint8_t *data); void criu_features__free_unpacked (CriuFeatures *message, ProtobufCAllocator *allocator); /* CriuReq methods */ void criu_req__init (CriuReq *message); size_t criu_req__get_packed_size (const CriuReq *message); size_t criu_req__pack (const CriuReq *message, uint8_t *out); size_t criu_req__pack_to_buffer (const CriuReq *message, ProtobufCBuffer *buffer); CriuReq * criu_req__unpack (ProtobufCAllocator *allocator, size_t len, const uint8_t *data); void criu_req__free_unpacked (CriuReq *message, ProtobufCAllocator *allocator); /* CriuResp methods */ void criu_resp__init (CriuResp *message); size_t criu_resp__get_packed_size (const CriuResp *message); size_t criu_resp__pack (const CriuResp *message, uint8_t *out); size_t criu_resp__pack_to_buffer (const CriuResp *message, ProtobufCBuffer *buffer); CriuResp * criu_resp__unpack (ProtobufCAllocator *allocator, size_t len, const uint8_t *data); void criu_resp__free_unpacked (CriuResp *message, ProtobufCAllocator *allocator); /* CriuVersion methods */ void criu_version__init (CriuVersion *message); size_t criu_version__get_packed_size (const CriuVersion *message); size_t criu_version__pack (const CriuVersion *message, uint8_t *out); size_t criu_version__pack_to_buffer (const CriuVersion *message, ProtobufCBuffer *buffer); CriuVersion * criu_version__unpack (ProtobufCAllocator *allocator, size_t len, const uint8_t *data); void criu_version__free_unpacked (CriuVersion *message, ProtobufCAllocator *allocator); /* --- per-message closures --- */ typedef void (*CriuPageServerInfo_Closure) (const CriuPageServerInfo *message, void *closure_data); typedef void (*CriuVethPair_Closure) (const CriuVethPair *message, void *closure_data); typedef void (*ExtMountMap_Closure) (const ExtMountMap *message, void *closure_data); typedef void (*JoinNamespace_Closure) (const JoinNamespace *message, void *closure_data); typedef void (*InheritFd_Closure) (const InheritFd *message, void *closure_data); typedef void (*CgroupRoot_Closure) (const CgroupRoot *message, void *closure_data); typedef void (*UnixSk_Closure) (const UnixSk *message, void *closure_data); typedef void (*CriuOpts_Closure) (const CriuOpts *message, void *closure_data); typedef void (*CriuDumpResp_Closure) (const CriuDumpResp *message, void *closure_data); typedef void (*CriuRestoreResp_Closure) (const CriuRestoreResp *message, void *closure_data); typedef void (*CriuNotify_Closure) (const CriuNotify *message, void *closure_data); typedef void (*CriuFeatures_Closure) (const CriuFeatures *message, void *closure_data); typedef void (*CriuReq_Closure) (const CriuReq *message, void *closure_data); typedef void (*CriuResp_Closure) (const CriuResp *message, void *closure_data); typedef void (*CriuVersion_Closure) (const CriuVersion *message, void *closure_data); /* --- services --- */ /* --- descriptors --- */ extern const ProtobufCEnumDescriptor criu_cg_mode__descriptor; extern const ProtobufCEnumDescriptor criu_network_lock_method__descriptor; extern const ProtobufCEnumDescriptor criu_pre_dump_mode__descriptor; extern const ProtobufCEnumDescriptor criu_req_type__descriptor; extern const ProtobufCMessageDescriptor criu_page_server_info__descriptor; extern const ProtobufCMessageDescriptor criu_veth_pair__descriptor; extern const ProtobufCMessageDescriptor ext_mount_map__descriptor; extern const ProtobufCMessageDescriptor join_namespace__descriptor; extern const ProtobufCMessageDescriptor inherit_fd__descriptor; extern const ProtobufCMessageDescriptor cgroup_root__descriptor; extern const ProtobufCMessageDescriptor unix_sk__descriptor; extern const ProtobufCMessageDescriptor criu_opts__descriptor; extern const ProtobufCMessageDescriptor criu_dump_resp__descriptor; extern const ProtobufCMessageDescriptor criu_restore_resp__descriptor; extern const ProtobufCMessageDescriptor criu_notify__descriptor; extern const ProtobufCMessageDescriptor criu_features__descriptor; extern const ProtobufCMessageDescriptor criu_req__descriptor; extern const ProtobufCMessageDescriptor criu_resp__descriptor; extern const ProtobufCMessageDescriptor criu_version__descriptor; PROTOBUF_C__END_DECLS #endif /* PROTOBUF_C_rpc_2eproto__INCLUDED */ version.h 0000644 00000000337 15220533627 0006412 0 ustar 00 /* Autogenerated, do not edit */ #ifndef __CR_VERSION_H__ #define __CR_VERSION_H__ #define CRIU_VERSION "4.2" #define CRIU_VERSION_MAJOR 4 #define CRIU_VERSION_MINOR 2 #define CRIU_GITID "0" #endif /* __CR_VERSION_H__ */ criu-log.h 0000644 00000003003 15220533627 0006437 0 ustar 00 /* This file defines types and macros for CRIU plugins. Copyright (C) 2013 Parallels, Inc This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef __CRIU_LOG_H__ #define __CRIU_LOG_H__ #include "log.h" #include <sys/types.h> extern int log_init(const char *output); extern void log_fini(void); extern int log_init_by_pid(pid_t pid); extern int log_keep_err(void); extern char *log_first_err(void); extern void log_set_fd(int fd); extern int log_get_fd(void); extern void log_set_loglevel(unsigned int loglevel); extern unsigned int log_get_loglevel(void); struct timeval; extern void log_get_logstart(struct timeval *); extern int write_pidfile(int pid); #define DEFAULT_LOG_FILENAME "criu.log" static inline int pr_quelled(unsigned int loglevel) { return log_get_loglevel() < loglevel && loglevel != LOG_MSG; } #endif /* __CR_LOG_LEVELS_H__ */ criu.h 0000644 00000033113 15220533627 0005665 0 ustar 00 /* * (C) Copyright 2013 Parallels, Inc. (www.parallels.com). * * All rights reserved. This program and the accompanying materials * are made available under the terms of the GNU Lesser General Public License * (LGPL) version 2.1 which accompanies this distribution, and is available at * http://www.gnu.org/licenses/lgpl-2.1.html * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, you can find it here: * www.gnu.org/licenses/lgpl.html */ #ifndef __CRIU_LIB_H__ #define __CRIU_LIB_H__ #include <stdbool.h> #include "version.h" #include "rpc.pb-c.h" #ifdef __GNUG__ extern "C" { #endif #define CRIU_LOG_UNSET (-1) #define CRIU_LOG_MSG (0) /* Print message regardless of log level */ #define CRIU_LOG_ERROR (1) /* Errors only */ #define CRIU_LOG_WARN (2) /* Warnings */ #define CRIU_LOG_INFO (3) /* Informative */ #define CRIU_LOG_DEBUG (4) /* Debug only */ enum criu_service_comm { CRIU_COMM_SK, CRIU_COMM_FD, CRIU_COMM_BIN }; enum criu_cg_mode { CRIU_CG_MODE_IGNORE, CRIU_CG_MODE_NONE, CRIU_CG_MODE_PROPS, CRIU_CG_MODE_SOFT, CRIU_CG_MODE_FULL, CRIU_CG_MODE_STRICT, CRIU_CG_MODE_DEFAULT, }; enum criu_network_lock_method { CRIU_NETWORK_LOCK_IPTABLES = 1, CRIU_NETWORK_LOCK_NFTABLES = 2, CRIU_NETWORK_LOCK_SKIP = 3, }; enum criu_pre_dump_mode { CRIU_PRE_DUMP_SPLICE = 1, CRIU_PRE_DUMP_READ = 2 }; int criu_set_service_address(const char *path); void criu_set_service_fd(int fd); int criu_set_service_binary(const char *path); void criu_set_service_comm(enum criu_service_comm comm); void criu_set_root_only(bool root_only); /* * Set opts to defaults. _Must_ be called first before using any functions from * the list down below. 0 on success, -1 on fail. */ int criu_init_opts(void); void criu_free_opts(void); void criu_set_pid(int pid); void criu_set_images_dir_fd(int fd); /* must be set for dump/restore */ int criu_set_parent_images(const char *path); void criu_set_work_dir_fd(int fd); void criu_set_leave_running(bool leave_running); void criu_set_ext_unix_sk(bool ext_unix_sk); int criu_add_unix_sk(unsigned int inode); void criu_set_tcp_established(bool tcp_established); void criu_set_tcp_skip_in_flight(bool tcp_skip_in_flight); void criu_set_tcp_close(bool tcp_close); void criu_set_weak_sysctls(bool val); void criu_set_evasive_devices(bool evasive_devices); void criu_set_shell_job(bool shell_job); void criu_set_skip_file_rwx_check(bool skip_file_rwx_check); void criu_set_unprivileged(bool unprivileged); void criu_set_orphan_pts_master(bool orphan_pts_master); void criu_set_file_locks(bool file_locks); void criu_set_track_mem(bool track_mem); void criu_set_auto_dedup(bool auto_dedup); void criu_set_force_irmap(bool force_irmap); void criu_set_link_remap(bool link_remap); void criu_set_log_level(int log_level); int criu_set_log_file(const char *log_file); void criu_set_cpu_cap(unsigned int cap); int criu_set_root(const char *root); void criu_set_manage_cgroups(bool manage); void criu_set_manage_cgroups_mode(enum criu_cg_mode mode); int criu_set_freeze_cgroup(const char *name); int criu_set_lsm_profile(const char *name); int criu_set_lsm_mount_context(const char *name); void criu_set_timeout(unsigned int timeout); void criu_set_auto_ext_mnt(bool val); void criu_set_ext_sharing(bool val); void criu_set_ext_masters(bool val); int criu_set_exec_cmd(int argc, char *argv[]); int criu_add_ext_mount(const char *key, const char *val); int criu_add_veth_pair(const char *in, const char *out); int criu_add_cg_root(const char *ctrl, const char *path); int criu_add_enable_fs(const char *fs); int criu_add_skip_mnt(const char *mnt); void criu_set_ghost_limit(unsigned int limit); int criu_add_irmap_path(const char *path); int criu_add_inherit_fd(int fd, const char *key); int criu_add_external(const char *key); int criu_set_page_server_address_port(const char *address, int port); int criu_set_pre_dump_mode(enum criu_pre_dump_mode mode); void criu_set_pidfd_store_sk(int sk); int criu_set_network_lock(enum criu_network_lock_method method); int criu_join_ns_add(const char *ns, const char *ns_file, const char *extra_opt); void criu_set_mntns_compat_mode(bool val); int criu_set_config_file(const char *path); /* * The criu_notify_arg_t na argument is an opaque * value that callbacks (cb-s) should pass into * criu_notify_xxx() calls to fetch arbitrary values * from notification. If the value is not available * some non-existing one is reported. */ typedef CriuNotify *criu_notify_arg_t; void criu_set_notify_cb(int (*cb)(char *action, criu_notify_arg_t na)); /* Get pid of root task. 0 if not available */ int criu_notify_pid(criu_notify_arg_t na); /* * If CRIU sends and FD in the case of 'orphan-pts-master', * this FD can be retrieved with criu_get_orphan_pts_master_fd(). * * If no FD has been received this will return -1. * * To make sure the FD returned is valid this function has to be * called after the callback with the 'action' 'orphan-pts-master'. */ int criu_get_orphan_pts_master_fd(void); /* Here is a table of return values and errno's of functions * from the list down below. * * Return value errno Description * ---------------------------------------------------------------------------- * 0 undefined Success. * * >0 undefined Success(criu_restore() only). * * -BADE rpc err (0 for now) RPC has returned fail. * * -ECONNREFUSED errno Unable to connect to CRIU. * * -ECOMM errno Unable to send/recv msg to/from CRIU. * * -EINVAL undefined CRIU doesn't support this type of request. * You should probably update CRIU. * * -EBADMSG undefined Unexpected response from CRIU. * You should probably update CRIU. */ int criu_check(void); int criu_dump(void); int criu_pre_dump(void); int criu_restore(void); int criu_restore_child(void); /* * Perform dumping but with preliminary iterations. Each * time an iteration ends the ->more callback is called. * The callback's return value is * - positive -- one more iteration starts * - zero -- final dump is performed and call exits * - negative -- dump is aborted, the value is returned * back from criu_dump_iters * * The @pi argument is an opaque value that caller may * use to request pre-dump statistics (not yet implemented). */ typedef void *criu_predump_info; int criu_dump_iters(int (*more)(criu_predump_info pi)); /* * Get the version of the actual binary used for RPC. * * As this library is just forwarding all tasks to an * independent (of this library) CRIU binary, the actual * version of the CRIU binary can be different then the * hardcoded values in the library (version.h). * To be able to easily check the version of the CRIU binary * the function criu_get_version() returns the version * in the following format: * * (major * 10000) + (minor * 100) + sublevel * * If the CRIU binary has been built from a git checkout * minor will increased by one. */ int criu_get_version(void); /* * Check if the version of the CRIU binary is at least * 'minimum'. Version has to be in the same format as * described for criu_get_version(). * * Returns 1 if CRIU is at least 'minimum'. * Returns 0 if CRIU is too old. * Returns < 0 if there was an error. */ int criu_check_version(int minimum); /* * Same as the list above, but lets you have your very own options * structure and lets you set individual options in it. */ typedef struct criu_opts criu_opts; int criu_local_init_opts(criu_opts **opts); void criu_local_free_opts(criu_opts *opts); void criu_local_set_root_only(criu_opts *opts, bool root_only); int criu_local_set_service_address(criu_opts *opts, const char *path); void criu_local_set_service_fd(criu_opts *opts, int fd); void criu_local_set_service_fd(criu_opts *opts, int fd); void criu_local_set_pid(criu_opts *opts, int pid); void criu_local_set_images_dir_fd(criu_opts *opts, int fd); /* must be set for dump/restore */ int criu_local_set_parent_images(criu_opts *opts, const char *path); int criu_local_set_service_binary(criu_opts *opts, const char *path); void criu_local_set_work_dir_fd(criu_opts *opts, int fd); void criu_local_set_leave_running(criu_opts *opts, bool leave_running); void criu_local_set_ext_unix_sk(criu_opts *opts, bool ext_unix_sk); int criu_local_add_unix_sk(criu_opts *opts, unsigned int inode); void criu_local_set_tcp_established(criu_opts *opts, bool tcp_established); void criu_local_set_tcp_skip_in_flight(criu_opts *opts, bool tcp_skip_in_flight); void criu_local_set_tcp_close(criu_opts *opts, bool tcp_close); void criu_local_set_weak_sysctls(criu_opts *opts, bool val); void criu_local_set_evasive_devices(criu_opts *opts, bool evasive_devices); void criu_local_set_shell_job(criu_opts *opts, bool shell_job); void criu_local_set_skip_file_rwx_check(criu_opts *opts, bool skip_file_rwx_check); void criu_local_set_orphan_pts_master(criu_opts *opts, bool orphan_pts_master); void criu_local_set_file_locks(criu_opts *opts, bool file_locks); void criu_local_set_track_mem(criu_opts *opts, bool track_mem); void criu_local_set_auto_dedup(criu_opts *opts, bool auto_dedup); void criu_local_set_force_irmap(criu_opts *opts, bool force_irmap); void criu_local_set_link_remap(criu_opts *opts, bool link_remap); void criu_local_set_log_level(criu_opts *opts, int log_level); int criu_local_set_log_file(criu_opts *opts, const char *log_file); void criu_local_set_cpu_cap(criu_opts *opts, unsigned int cap); int criu_local_set_root(criu_opts *opts, const char *root); void criu_local_set_manage_cgroups(criu_opts *opts, bool manage); void criu_local_set_manage_cgroups_mode(criu_opts *opts, enum criu_cg_mode mode); int criu_local_set_freeze_cgroup(criu_opts *opts, const char *name); int criu_local_set_lsm_profile(criu_opts *opts, const char *name); int criu_local_set_lsm_mount_context(criu_opts *opts, const char *name); void criu_local_set_timeout(criu_opts *opts, unsigned int timeout); void criu_local_set_auto_ext_mnt(criu_opts *opts, bool val); void criu_local_set_ext_sharing(criu_opts *opts, bool val); void criu_local_set_ext_masters(criu_opts *opts, bool val); int criu_local_set_exec_cmd(criu_opts *opts, int argc, char *argv[]); int criu_local_add_ext_mount(criu_opts *opts, const char *key, const char *val); int criu_local_add_veth_pair(criu_opts *opts, const char *in, const char *out); int criu_local_add_cg_root(criu_opts *opts, const char *ctrl, const char *path); int criu_local_add_enable_fs(criu_opts *opts, const char *fs); int criu_local_add_skip_mnt(criu_opts *opts, const char *mnt); void criu_local_set_ghost_limit(criu_opts *opts, unsigned int limit); int criu_local_add_irmap_path(criu_opts *opts, const char *path); int criu_local_add_cg_props(criu_opts *opts, const char *stream); int criu_local_add_cg_props_file(criu_opts *opts, const char *path); int criu_local_add_cg_dump_controller(criu_opts *opts, const char *name); int criu_local_add_cg_yard(criu_opts *opts, const char *path); int criu_local_add_inherit_fd(criu_opts *opts, int fd, const char *key); int criu_local_add_external(criu_opts *opts, const char *key); int criu_local_set_page_server_address_port(criu_opts *opts, const char *address, int port); int criu_local_set_pre_dump_mode(criu_opts *opts, enum criu_pre_dump_mode mode); void criu_local_set_pidfd_store_sk(criu_opts *opts, int sk); int criu_local_set_network_lock(criu_opts *opts, enum criu_network_lock_method method); int criu_local_join_ns_add(criu_opts *opts, const char *ns, const char *ns_file, const char *extra_opt); void criu_local_set_mntns_compat_mode(criu_opts *opts, bool val); int criu_local_set_config_file(criu_opts *opts, const char *path); void criu_local_set_notify_cb(criu_opts *opts, int (*cb)(char *action, criu_notify_arg_t na)); int criu_local_check(criu_opts *opts); int criu_local_dump(criu_opts *opts); int criu_local_pre_dump(criu_opts *opts); int criu_local_restore(criu_opts *opts); int criu_local_restore_child(criu_opts *opts); int criu_local_dump_iters(criu_opts *opts, int (*more)(criu_predump_info pi)); int criu_local_get_version(criu_opts *opts); int criu_local_check_version(criu_opts *opts, int minimum); /* * Feature checking allows the user to check if CRIU supports * certain features. There are CRIU features which do not depend * on the version of CRIU but on kernel features or architecture. * * One example is memory tracking. Memory tracking can be disabled * in the kernel or there are architectures which do not support * it (aarch64 for example). By using the feature check a libcriu * user can easily query CRIU if a certain feature is available. * * The features which should be checked can be marked in the * structure 'struct criu_feature_check'. Each structure member * that is set to true will result in CRIU checking for the * availability of that feature in the current combination of * CRIU/kernel/architecture. * * Available features will be set to true when the function * returns successfully. Missing features will be set to false. */ struct criu_feature_check { bool mem_track; bool lazy_pages; bool pidfd_store; }; int criu_feature_check(struct criu_feature_check *features, size_t size); int criu_local_feature_check(criu_opts *opts, struct criu_feature_check *features, size_t size); void criu_local_set_empty_ns(criu_opts *opts, int namespaces); void criu_set_empty_ns(int namespaces); #ifdef __GNUG__ } #endif #endif /* __CRIU_LIB_H__ */ criu-plugin.h 0000644 00000012733 15220533627 0007166 0 ustar 00 /* * This file defines types and macros for CRIU plugins. * Copyright (C) 2013-2014 Parallels, Inc * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef __CRIU_PLUGIN_H__ #define __CRIU_PLUGIN_H__ #include <limits.h> #include <stdbool.h> #include <stdint.h> #include <sys/stat.h> #define CRIU_PLUGIN_GEN_VERSION(a, b, c) (((a) << 16) + ((b) << 8) + (c)) #define CRIU_PLUGIN_VERSION_MAJOR 0 #define CRIU_PLUGIN_VERSION_MINOR 2 #define CRIU_PLUGIN_VERSION_SUBLEVEL 0 #define CRIU_PLUGIN_VERSION_OLD CRIU_PLUGIN_GEN_VERSION(0, 1, 0) #define CRIU_PLUGIN_VERSION \ CRIU_PLUGIN_GEN_VERSION(CRIU_PLUGIN_VERSION_MAJOR, CRIU_PLUGIN_VERSION_MINOR, CRIU_PLUGIN_VERSION_SUBLEVEL) /* * Plugin hook points and their arguments in hooks. */ enum { CR_PLUGIN_HOOK__DUMP_UNIX_SK = 0, CR_PLUGIN_HOOK__RESTORE_UNIX_SK = 1, CR_PLUGIN_HOOK__DUMP_EXT_FILE = 2, CR_PLUGIN_HOOK__RESTORE_EXT_FILE = 3, CR_PLUGIN_HOOK__DUMP_EXT_MOUNT = 4, CR_PLUGIN_HOOK__RESTORE_EXT_MOUNT = 5, CR_PLUGIN_HOOK__DUMP_EXT_LINK = 6, CR_PLUGIN_HOOK__HANDLE_DEVICE_VMA = 7, CR_PLUGIN_HOOK__UPDATE_VMA_MAP = 8, CR_PLUGIN_HOOK__RESUME_DEVICES_LATE = 9, CR_PLUGIN_HOOK__PAUSE_DEVICES = 10, CR_PLUGIN_HOOK__CHECKPOINT_DEVICES = 11, CR_PLUGIN_HOOK__POST_FORKING = 12, CR_PLUGIN_HOOK__MAX }; #define DECLARE_PLUGIN_HOOK_ARGS(__hook, ...) typedef int(__hook##_t)(__VA_ARGS__) DECLARE_PLUGIN_HOOK_ARGS(CR_PLUGIN_HOOK__DUMP_UNIX_SK, int fd, int id); DECLARE_PLUGIN_HOOK_ARGS(CR_PLUGIN_HOOK__RESTORE_UNIX_SK, int id); DECLARE_PLUGIN_HOOK_ARGS(CR_PLUGIN_HOOK__DUMP_EXT_FILE, int fd, int id); DECLARE_PLUGIN_HOOK_ARGS(CR_PLUGIN_HOOK__RESTORE_EXT_FILE, int id); DECLARE_PLUGIN_HOOK_ARGS(CR_PLUGIN_HOOK__DUMP_EXT_MOUNT, char *mountpoint, int id); DECLARE_PLUGIN_HOOK_ARGS(CR_PLUGIN_HOOK__RESTORE_EXT_MOUNT, int id, char *mountpoint, char *old_root, int *is_file); DECLARE_PLUGIN_HOOK_ARGS(CR_PLUGIN_HOOK__DUMP_EXT_LINK, int index, int type, char *kind); DECLARE_PLUGIN_HOOK_ARGS(CR_PLUGIN_HOOK__HANDLE_DEVICE_VMA, int fd, const struct stat *stat); DECLARE_PLUGIN_HOOK_ARGS(CR_PLUGIN_HOOK__UPDATE_VMA_MAP, const char *path, const uint64_t addr, const uint64_t old_pgoff, uint64_t *new_pgoff, int *plugin_fd); DECLARE_PLUGIN_HOOK_ARGS(CR_PLUGIN_HOOK__RESUME_DEVICES_LATE, int pid); DECLARE_PLUGIN_HOOK_ARGS(CR_PLUGIN_HOOK__PAUSE_DEVICES, int pid); DECLARE_PLUGIN_HOOK_ARGS(CR_PLUGIN_HOOK__CHECKPOINT_DEVICES, int pid); DECLARE_PLUGIN_HOOK_ARGS(CR_PLUGIN_HOOK__POST_FORKING, void); enum { CR_PLUGIN_STAGE__DUMP, CR_PLUGIN_STAGE__PRE_DUMP, CR_PLUGIN_STAGE__RESTORE, CR_PLUGIN_STAGE_MAX }; /* * Plugin descriptor. */ typedef struct { const char *name; int (*init)(int stage); void (*exit)(int stage, int ret); unsigned int version; unsigned int max_hooks; void *hooks[CR_PLUGIN_HOOK__MAX]; } cr_plugin_desc_t; extern cr_plugin_desc_t CR_PLUGIN_DESC; #define CR_PLUGIN_REGISTER(___name, ___init, ___exit) \ cr_plugin_desc_t CR_PLUGIN_DESC = { \ .name = ___name, \ .init = ___init, \ .exit = ___exit, \ .version = CRIU_PLUGIN_VERSION, \ .max_hooks = CR_PLUGIN_HOOK__MAX, \ }; static inline int cr_plugin_dummy_init(int stage) { return 0; } static inline void cr_plugin_dummy_exit(int stage, int ret) { } #define CR_PLUGIN_REGISTER_DUMMY(___name) \ cr_plugin_desc_t CR_PLUGIN_DESC = { \ .name = ___name, \ .init = cr_plugin_dummy_init, \ .exit = cr_plugin_dummy_exit, \ .version = CRIU_PLUGIN_VERSION, \ .max_hooks = CR_PLUGIN_HOOK__MAX, \ }; #define CR_PLUGIN_REGISTER_HOOK(__hook, __func) \ static void __attribute__((constructor)) cr_plugin_register_hook_##__func(void) \ { \ CR_PLUGIN_DESC.hooks[__hook] = (void *)__func; \ } /* Public API */ extern int criu_get_image_dir(void); /* * Deprecated, will be removed in next version. */ typedef int(cr_plugin_init_t)(void); typedef void(cr_plugin_fini_t)(void); typedef int(cr_plugin_dump_unix_sk_t)(int fd, int id); typedef int(cr_plugin_restore_unix_sk_t)(int id); typedef int(cr_plugin_dump_file_t)(int fd, int id); typedef int(cr_plugin_restore_file_t)(int id); typedef int(cr_plugin_dump_ext_mount_t)(char *mountpoint, int id); typedef int(cr_plugin_restore_ext_mount_t)(int id, char *mountpoint, char *old_root, int *is_file); typedef int(cr_plugin_dump_ext_link_t)(int index, int type, char *kind); typedef int(cr_plugin_handle_device_vma_t)(int fd, const struct stat *stat); typedef int(cr_plugin_update_vma_map_t)(const char *path, const uint64_t addr, const uint64_t old_pgoff, uint64_t *new_pgoff, int *plugin_fd); typedef int(cr_plugin_resume_devices_late_t)(int pid); typedef int(cr_plugin_post_forking_t)(void); #endif /* __CRIU_PLUGIN_H__ */
| ver. 1.4 |
Github
|
.
| PHP 8.0.30 | Generation time: 0.17 |
proxy
|
phpinfo
|
Settings