Commit 76017ec5 authored by Pavel Emelyanov's avatar Pavel Emelyanov

scripts: Use numeric action val in RPC notifications

Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 17d44de9
...@@ -42,7 +42,7 @@ int run_scripts(enum script_actions act) ...@@ -42,7 +42,7 @@ int run_scripts(enum script_actions act)
list_for_each_entry(script, &opts.scripts, node) { list_for_each_entry(script, &opts.scripts, node) {
if (script->path == SCRIPT_RPC_NOTIFY) { if (script->path == SCRIPT_RPC_NOTIFY) {
pr_debug("\tRPC\n"); pr_debug("\tRPC\n");
ret |= send_criu_rpc_script(action, script->arg); ret |= send_criu_rpc_script(act, action, script->arg);
} else { } else {
pr_debug("\t[%s]\n", script->path); pr_debug("\t[%s]\n", script->path);
ret |= system(script->path); ret |= system(script->path);
......
...@@ -129,7 +129,7 @@ int send_criu_restore_resp(int socket_fd, bool success, int pid) ...@@ -129,7 +129,7 @@ int send_criu_restore_resp(int socket_fd, bool success, int pid)
return send_criu_msg(socket_fd, &msg); return send_criu_msg(socket_fd, &msg);
} }
int send_criu_rpc_script(char *script, int fd) int send_criu_rpc_script(enum script_actions act, char *name, int fd)
{ {
int ret; int ret;
CriuResp msg = CRIU_RESP__INIT; CriuResp msg = CRIU_RESP__INIT;
...@@ -139,9 +139,10 @@ int send_criu_rpc_script(char *script, int fd) ...@@ -139,9 +139,10 @@ int send_criu_rpc_script(char *script, int fd)
msg.type = CRIU_REQ_TYPE__NOTIFY; msg.type = CRIU_REQ_TYPE__NOTIFY;
msg.success = true; msg.success = true;
msg.notify = &cn; msg.notify = &cn;
cn.script = script; cn.script = name;
if (!strcmp(script, "setup-namespaces")) { switch (act) {
case ACT_SETUP_NS:
/* /*
* FIXME pid is required only once on * FIXME pid is required only once on
* restore. Need some more sane way of * restore. Need some more sane way of
...@@ -149,6 +150,9 @@ int send_criu_rpc_script(char *script, int fd) ...@@ -149,6 +150,9 @@ int send_criu_rpc_script(char *script, int fd)
*/ */
cn.has_pid = true; cn.has_pid = true;
cn.pid = root_item->pid.real; cn.pid = root_item->pid.real;
break;
default:
break;
} }
ret = send_criu_msg(fd, &msg); ret = send_criu_msg(fd, &msg);
......
...@@ -19,5 +19,6 @@ enum script_actions { ...@@ -19,5 +19,6 @@ enum script_actions {
extern int add_script(char *path, int arg); extern int add_script(char *path, int arg);
extern int run_scripts(enum script_actions); extern int run_scripts(enum script_actions);
extern int send_criu_rpc_script(enum script_actions act, char *name, int arg);
#endif /* __CR_ACTION_SCRIPTS_H__ */ #endif /* __CR_ACTION_SCRIPTS_H__ */
...@@ -7,7 +7,6 @@ extern int cr_service(bool deamon_mode); ...@@ -7,7 +7,6 @@ extern int cr_service(bool deamon_mode);
int cr_service_work(int sk); int cr_service_work(int sk);
extern int send_criu_dump_resp(int socket_fd, bool success, bool restored); extern int send_criu_dump_resp(int socket_fd, bool success, bool restored);
extern int send_criu_rpc_script(char *name, int arg);
extern struct _cr_service_client *cr_service_client; extern struct _cr_service_client *cr_service_client;
extern unsigned int service_sk_ino; extern unsigned int service_sk_ino;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment