mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-01-23 02:14:37 +00:00
libcriu: enable setting of RPC config file
Container runtimes that use libcriu (e.g., crun) need to specify a CRIU configuration file that allows to overwrite default options set via RPC. This is particularly useful to set options such as `--tcp-established` via `/etc/criu/runc.conf` in Kubernetes. Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>
This commit is contained in:
parent
07ad2473f2
commit
2878faa74c
2 changed files with 21 additions and 0 deletions
19
lib/c/criu.c
19
lib/c/criu.c
|
|
@ -2041,3 +2041,22 @@ void criu_set_empty_ns(int namespaces)
|
|||
{
|
||||
criu_local_set_empty_ns(global_opts, namespaces);
|
||||
}
|
||||
|
||||
int criu_local_set_config_file(criu_opts *opts, const char *path)
|
||||
{
|
||||
char *new;
|
||||
|
||||
new = strdup(path);
|
||||
if (!new)
|
||||
return -ENOMEM;
|
||||
|
||||
free(opts->rpc->config_file);
|
||||
opts->rpc->config_file = new;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int criu_set_config_file(const char *path)
|
||||
{
|
||||
return criu_local_set_config_file(global_opts, path);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -116,6 +116,7 @@ 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
|
||||
|
|
@ -281,6 +282,7 @@ 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));
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue