diff --git a/cr-service.c b/cr-service.c index 1f903b611..00dc17d4f 100644 --- a/cr-service.c +++ b/cr-service.c @@ -381,6 +381,10 @@ static int setup_opts_from_req(int sk, CriuOpts *req) goto err; } + for (i = 0; i < req->n_external; i++) + if (add_external(req->external[i])) + goto err; + for (i = 0; i < req->n_cg_root; i++) { if (new_cg_root_add(req->cg_root[i]->ctrl, req->cg_root[i]->path)) diff --git a/crtools.c b/crtools.c index 7e692397a..d5cb20eb6 100644 --- a/crtools.c +++ b/crtools.c @@ -193,6 +193,19 @@ static size_t parse_size(char *optarg) return (size_t)atol(optarg); } +int add_external(char *key) +{ + struct external *ext; + + ext = xmalloc(sizeof(*ext)); + if (!ext) + return -1; + ext->id = key; + list_add(&ext->node, &opts.external); + + return 0; +} + int main(int argc, char *argv[], char *envp[]) { pid_t pid = 0, tree_id = 0; @@ -526,15 +539,8 @@ int main(int argc, char *argv[], char *envp[]) } break; case 1073: - { - struct external *ext; - - ext = xmalloc(sizeof(*ext)); - if (!ext) - return 1; - ext->id = optarg; - list_add(&ext->node, &opts.external); - } + if (add_external(optarg)) + return 1; break; case 'V': pr_msg("Version: %s\n", CRIU_VERSION); diff --git a/include/cr_options.h b/include/cr_options.h index 3f14b43d5..5c0e6332e 100644 --- a/include/cr_options.h +++ b/include/cr_options.h @@ -112,4 +112,6 @@ extern struct cr_options opts; extern void init_opts(void); +extern int add_external(char *key); + #endif /* __CR_OPTIONS_H__ */ diff --git a/protobuf/rpc.proto b/protobuf/rpc.proto index 30235a0a0..4f6ed8df1 100644 --- a/protobuf/rpc.proto +++ b/protobuf/rpc.proto @@ -88,6 +88,7 @@ message criu_opts { 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; } message criu_dump_resp {