From 72bf807cfb028970ae0d1cc2faff3208acadca43 Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Tue, 11 Feb 2014 09:53:32 +0400 Subject: [PATCH] rpc: Report PID of restore task on setup-namespaces script This is the first time restorer gets info back from CRIU service. At that time it makes perfect sense to report what PID we're working with. Signed-off-by: Pavel Emelyanov --- cr-service.c | 10 ++++++++++ protobuf/rpc.proto | 1 + 2 files changed, 11 insertions(+) diff --git a/cr-service.c b/cr-service.c index 26dd3e275..1dec4afb3 100644 --- a/cr-service.c +++ b/cr-service.c @@ -125,6 +125,16 @@ int send_criu_rpc_script(char *script, int fd) msg.notify = &cn; cn.script = script; + if (!strcmp(script, "setup-namespaces")) { + /* + * FIXME pid is required only once on + * restore. Need some more sane way of + * checking this. + */ + cn.has_pid = true; + cn.pid = root_item->pid.real; + } + ret = send_criu_msg(fd, &msg); if (ret < 0) return ret; diff --git a/protobuf/rpc.proto b/protobuf/rpc.proto index 23a9f01de..90f9dc206 100644 --- a/protobuf/rpc.proto +++ b/protobuf/rpc.proto @@ -39,6 +39,7 @@ message criu_restore_resp { message criu_notify { optional string script = 1; + optional int32 pid = 2; } enum criu_req_type {