mirror of
https://github.com/checkpoint-restore/criu
synced 2025-09-01 14:55:39 +00:00
service: add cr_errno to criu_resp and send cr_errno in it, v2
v2, set cr_errno only if we have one that is != 0 Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
committed by
Pavel Emelyanov
parent
2d91ff5f2e
commit
b58eb26fb2
17
cr-service.c
17
cr-service.c
@@ -88,7 +88,10 @@ static void send_criu_err(int sk, char *msg)
|
|||||||
|
|
||||||
resp.type = CRIU_REQ_TYPE__EMPTY;
|
resp.type = CRIU_REQ_TYPE__EMPTY;
|
||||||
resp.success = false;
|
resp.success = false;
|
||||||
/* XXX -- add optional error code to CriuResp */
|
if (get_cr_errno()) {
|
||||||
|
resp.has_cr_errno = true;
|
||||||
|
resp.cr_errno = get_cr_errno();
|
||||||
|
}
|
||||||
|
|
||||||
send_criu_msg(sk, &resp);
|
send_criu_msg(sk, &resp);
|
||||||
}
|
}
|
||||||
@@ -100,6 +103,10 @@ int send_criu_dump_resp(int socket_fd, bool success, bool restored)
|
|||||||
|
|
||||||
msg.type = CRIU_REQ_TYPE__DUMP;
|
msg.type = CRIU_REQ_TYPE__DUMP;
|
||||||
msg.success = success;
|
msg.success = success;
|
||||||
|
if (get_cr_errno()) {
|
||||||
|
msg.has_cr_errno = true;
|
||||||
|
msg.cr_errno = get_cr_errno();
|
||||||
|
}
|
||||||
msg.dump = &resp;
|
msg.dump = &resp;
|
||||||
|
|
||||||
resp.has_restored = true;
|
resp.has_restored = true;
|
||||||
@@ -114,6 +121,10 @@ static int send_criu_pre_dump_resp(int socket_fd, bool success)
|
|||||||
|
|
||||||
msg.type = CRIU_REQ_TYPE__PRE_DUMP;
|
msg.type = CRIU_REQ_TYPE__PRE_DUMP;
|
||||||
msg.success = success;
|
msg.success = success;
|
||||||
|
if (get_cr_errno()) {
|
||||||
|
msg.has_cr_errno = true;
|
||||||
|
msg.cr_errno = get_cr_errno();
|
||||||
|
}
|
||||||
|
|
||||||
return send_criu_msg(socket_fd, &msg);
|
return send_criu_msg(socket_fd, &msg);
|
||||||
}
|
}
|
||||||
@@ -125,6 +136,10 @@ int send_criu_restore_resp(int socket_fd, bool success, int pid)
|
|||||||
|
|
||||||
msg.type = CRIU_REQ_TYPE__RESTORE;
|
msg.type = CRIU_REQ_TYPE__RESTORE;
|
||||||
msg.success = success;
|
msg.success = success;
|
||||||
|
if (get_cr_errno()) {
|
||||||
|
msg.has_cr_errno = true;
|
||||||
|
msg.cr_errno = get_cr_errno();
|
||||||
|
}
|
||||||
msg.restore = &resp;
|
msg.restore = &resp;
|
||||||
|
|
||||||
resp.pid = pid;
|
resp.pid = pid;
|
||||||
|
@@ -116,4 +116,6 @@ message criu_resp {
|
|||||||
optional criu_restore_resp restore = 4;
|
optional criu_restore_resp restore = 4;
|
||||||
optional criu_notify notify = 5;
|
optional criu_notify notify = 5;
|
||||||
optional criu_page_server_info ps = 6;
|
optional criu_page_server_info ps = 6;
|
||||||
|
|
||||||
|
optional int32 cr_errno = 7;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user