mirror of
https://github.com/checkpoint-restore/criu
synced 2025-09-04 08:15:37 +00:00
rpc: add constants for cgroups modes
Signed-off-by: Ruslan Kuprieiev <rkuprieiev@cloudlinux.com> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
committed by
Pavel Emelyanov
parent
22378ea3bc
commit
46e8aeed12
33
cr-service.c
33
cr-service.c
@@ -401,8 +401,37 @@ static int setup_opts_from_req(int sk, CriuOpts *req)
|
|||||||
opts.manage_cgroups = req->manage_cgroups ? CG_MODE_SOFT : CG_MODE_IGNORE;
|
opts.manage_cgroups = req->manage_cgroups ? CG_MODE_SOFT : CG_MODE_IGNORE;
|
||||||
|
|
||||||
/* Override the manage_cgroup if mode is set explicitly */
|
/* Override the manage_cgroup if mode is set explicitly */
|
||||||
if (req->has_manage_cgroups_mode)
|
if (req->has_manage_cgroups_mode) {
|
||||||
opts.manage_cgroups = req->manage_cgroups_mode;
|
unsigned int mode;
|
||||||
|
|
||||||
|
switch (req->manage_cgroups_mode) {
|
||||||
|
case CRIU_CG_MODE__IGNORE:
|
||||||
|
mode = CG_MODE_IGNORE;
|
||||||
|
break;
|
||||||
|
case CRIU_CG_MODE__NONE:
|
||||||
|
mode = CG_MODE_NONE;
|
||||||
|
break;
|
||||||
|
case CRIU_CG_MODE__PROPS:
|
||||||
|
mode = CG_MODE_PROPS;
|
||||||
|
break;
|
||||||
|
case CRIU_CG_MODE__SOFT:
|
||||||
|
mode = CG_MODE_SOFT;
|
||||||
|
break;
|
||||||
|
case CRIU_CG_MODE__FULL:
|
||||||
|
mode = CG_MODE_FULL;
|
||||||
|
break;
|
||||||
|
case CRIU_CG_MODE__STRICT:
|
||||||
|
mode = CG_MODE_STRICT;
|
||||||
|
break;
|
||||||
|
case CRIU_CG_MODE__DEFAULT:
|
||||||
|
mode = CG_MODE_DEFAULT;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
|
||||||
|
opts.manage_cgroups = mode;
|
||||||
|
}
|
||||||
|
|
||||||
if (req->has_auto_ext_mnt)
|
if (req->has_auto_ext_mnt)
|
||||||
opts.autodetect_ext_mounts = req->auto_ext_mnt;
|
opts.autodetect_ext_mounts = req->auto_ext_mnt;
|
||||||
|
@@ -375,13 +375,13 @@ void criu_set_manage_cgroups(bool manage)
|
|||||||
criu_local_set_manage_cgroups(global_opts, manage);
|
criu_local_set_manage_cgroups(global_opts, manage);
|
||||||
}
|
}
|
||||||
|
|
||||||
void criu_local_set_manage_cgroups_mode(criu_opts *opts, unsigned int mode)
|
void criu_local_set_manage_cgroups_mode(criu_opts *opts, enum criu_cg_mode mode)
|
||||||
{
|
{
|
||||||
opts->rpc->has_manage_cgroups_mode = true;
|
opts->rpc->has_manage_cgroups_mode = true;
|
||||||
opts->rpc->manage_cgroups_mode = mode;
|
opts->rpc->manage_cgroups_mode = (CriuCgMode)mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
void criu_set_manage_cgroups_mode(unsigned int mode)
|
void criu_set_manage_cgroups_mode(enum criu_cg_mode mode)
|
||||||
{
|
{
|
||||||
criu_local_set_manage_cgroups_mode(global_opts, mode);
|
criu_local_set_manage_cgroups_mode(global_opts, mode);
|
||||||
}
|
}
|
||||||
|
14
lib/criu.h
14
lib/criu.h
@@ -31,6 +31,16 @@ enum criu_service_comm {
|
|||||||
CRIU_COMM_BIN
|
CRIU_COMM_BIN
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum criu_cg_mode {
|
||||||
|
CRIU_CG_MODE_IGNORE = 0,
|
||||||
|
CRIU_CG_MODE_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
|
||||||
|
};
|
||||||
|
|
||||||
void criu_set_service_address(char *path);
|
void criu_set_service_address(char *path);
|
||||||
void criu_set_service_fd(int fd);
|
void criu_set_service_fd(int fd);
|
||||||
void criu_set_service_binary(char *path);
|
void criu_set_service_binary(char *path);
|
||||||
@@ -67,7 +77,7 @@ void criu_set_log_file(char *log_file);
|
|||||||
void criu_set_cpu_cap(unsigned int cap);
|
void criu_set_cpu_cap(unsigned int cap);
|
||||||
void criu_set_root(char *root);
|
void criu_set_root(char *root);
|
||||||
void criu_set_manage_cgroups(bool manage);
|
void criu_set_manage_cgroups(bool manage);
|
||||||
void criu_set_manage_cgroups_mode(unsigned int mode);
|
void criu_set_manage_cgroups_mode(enum criu_cg_mode mode);
|
||||||
void criu_set_auto_ext_mnt(bool val);
|
void criu_set_auto_ext_mnt(bool val);
|
||||||
void criu_set_ext_sharing(bool val);
|
void criu_set_ext_sharing(bool val);
|
||||||
void criu_set_ext_masters(bool val);
|
void criu_set_ext_masters(bool val);
|
||||||
@@ -167,7 +177,7 @@ void criu_local_set_log_file(criu_opts *opts, char *log_file);
|
|||||||
void criu_local_set_cpu_cap(criu_opts *opts, unsigned int cap);
|
void criu_local_set_cpu_cap(criu_opts *opts, unsigned int cap);
|
||||||
void criu_local_set_root(criu_opts *opts, char *root);
|
void criu_local_set_root(criu_opts *opts, char *root);
|
||||||
void criu_local_set_manage_cgroups(criu_opts *opts, bool manage);
|
void criu_local_set_manage_cgroups(criu_opts *opts, bool manage);
|
||||||
void criu_local_set_manage_cgroups_mode(criu_opts *opts, unsigned int mode);
|
void criu_local_set_manage_cgroups_mode(criu_opts *opts, enum criu_cg_mode mode);
|
||||||
void criu_local_set_auto_ext_mnt(criu_opts *opts, bool val);
|
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_sharing(criu_opts *opts, bool val);
|
||||||
void criu_local_set_ext_masters(criu_opts *opts, bool val);
|
void criu_local_set_ext_masters(criu_opts *opts, bool val);
|
||||||
|
@@ -29,6 +29,16 @@ message unix_sk {
|
|||||||
required uint32 inode = 1;
|
required uint32 inode = 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum criu_cg_mode {
|
||||||
|
IGNORE = 0;
|
||||||
|
NONE = 1;
|
||||||
|
PROPS = 2;
|
||||||
|
SOFT = 3;
|
||||||
|
FULL = 4;
|
||||||
|
STRICT = 5;
|
||||||
|
DEFAULT = 6;
|
||||||
|
};
|
||||||
|
|
||||||
message criu_opts {
|
message criu_opts {
|
||||||
required int32 images_dir_fd = 1;
|
required int32 images_dir_fd = 1;
|
||||||
optional int32 pid = 2; /* if not set on dump, will dump requesting process */
|
optional int32 pid = 2; /* if not set on dump, will dump requesting process */
|
||||||
@@ -75,7 +85,7 @@ message criu_opts {
|
|||||||
|
|
||||||
repeated unix_sk unix_sk_ino = 33;
|
repeated unix_sk unix_sk_ino = 33;
|
||||||
|
|
||||||
optional uint32 manage_cgroups_mode = 34;
|
optional criu_cg_mode manage_cgroups_mode = 34;
|
||||||
}
|
}
|
||||||
|
|
||||||
message criu_dump_resp {
|
message criu_dump_resp {
|
||||||
|
Reference in New Issue
Block a user