static int send_criu_pre_dump_resp(int socket_fd, bool success) { CriuResp msg = CRIU_RESP__INIT; msg.type = CRIU_REQ_TYPE__PRE_DUMP; 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); }
static void send_criu_err(int sk, char *msg) { CriuResp resp = CRIU_RESP__INIT; pr_perror("RPC error: %s", msg); resp.type = CRIU_REQ_TYPE__EMPTY; resp.success = false; if (get_cr_errno()) { resp.has_cr_errno = true; resp.cr_errno = get_cr_errno(); } send_criu_msg(sk, &resp); }
int send_criu_restore_resp(int socket_fd, bool success, int pid) { CriuResp msg = CRIU_RESP__INIT; CriuRestoreResp resp = CRIU_RESTORE_RESP__INIT; msg.type = CRIU_REQ_TYPE__RESTORE; msg.success = success; if (get_cr_errno()) { msg.has_cr_errno = true; msg.cr_errno = get_cr_errno(); } msg.restore = &resp; resp.pid = pid; return send_criu_msg(socket_fd, &msg); }
int send_criu_dump_resp(int socket_fd, bool success, bool restored) { CriuResp msg = CRIU_RESP__INIT; CriuDumpResp resp = CRIU_DUMP_RESP__INIT; msg.type = CRIU_REQ_TYPE__DUMP; msg.success = success; if (get_cr_errno()) { msg.has_cr_errno = true; msg.cr_errno = get_cr_errno(); } msg.dump = &resp; resp.has_restored = true; resp.restored = restored; return send_criu_msg(socket_fd, &msg); }
static void set_resp_err(CriuResp *resp) { resp->cr_errno = get_cr_errno(); resp->has_cr_errno = resp->cr_errno ? true : false; resp->cr_errmsg = log_first_err(); }