[CRIU] [PATCH 1/5] rpc: add self_dump field
Ruslan Kuprieiev
kupruser at gmail.com
Tue Dec 3 08:20:35 PST 2013
This is more clear, than pid value magic.
Signed-off-by: Ruslan Kuprieiev <kupruser at gmail.com>
---
cr-service.c | 6 +++---
protobuf/rpc.proto | 3 ++-
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/cr-service.c b/cr-service.c
index b092948..53de02b 100644
--- a/cr-service.c
+++ b/cr-service.c
@@ -140,7 +140,8 @@ static int setup_opts_from_req(int sk, CriuOpts *req)
if (req->has_leave_running && req->leave_running)
opts.final_state = TASK_ALIVE;
- if (!req->has_pid) {
+ if (!req->has_pid || req->self_dump) {
+ req->self_dump = true;
req->has_pid = true;
req->pid = ids.pid;
}
@@ -166,7 +167,6 @@ static int setup_opts_from_req(int sk, CriuOpts *req)
static int dump_using_req(int sk, CriuOpts *req)
{
bool success = false;
- bool self_dump = !req->pid;
if (setup_opts_from_req(sk, req) == -1) {
pr_perror("Arguments treating fail");
@@ -176,7 +176,7 @@ static int dump_using_req(int sk, CriuOpts *req)
if (cr_dump_tasks(req->pid) == -1)
goto exit;
- if (req->leave_running || !self_dump) {
+ if (req->leave_running || !req->self_dump) {
success = true;
exit:
if (send_criu_dump_resp(sk, success, false) == -1) {
diff --git a/protobuf/rpc.proto b/protobuf/rpc.proto
index 7bea573..90a837d 100644
--- a/protobuf/rpc.proto
+++ b/protobuf/rpc.proto
@@ -1,6 +1,6 @@
message criu_opts {
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(is left for compatibility, see "self_dump" field below)
optional bool leave_running = 3;
optional bool ext_unix_sk = 4;
@@ -10,6 +10,7 @@ message criu_opts {
optional bool file_locks = 8;
optional int32 log_level = 9 [default = 2];
optional string log_file = 10;
+ optional bool self_dump = 11;
}
message criu_dump_resp {
--
1.8.1.2
More information about the CRIU
mailing list