[14/15] restore: Move other task-args preparations from sigreturn_restore

Submitted by Pavel Emelianov on May 24, 2016, 11:37 a.m.

Details

Message ID 57443CDD.4070906@virtuozzo.com
State Superseded
Commit 4d38ef3e4ee677342c9e645e6ac137e8bc13bf90
Headers show

Commit Message

Pavel Emelianov May 24, 2016, 11:37 a.m.
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
---
 criu/cr-restore.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

Patch hide | download patch | download mbox

diff --git a/criu/cr-restore.c b/criu/cr-restore.c
index 948b4a0..cfa1c4e 100644
--- a/criu/cr-restore.c
+++ b/criu/cr-restore.c
@@ -477,6 +477,9 @@  static int prepare_proc_misc(pid_t pid, TaskCoreEntry *tc)
 	return 0;
 }
 
+static int prepare_itimers(int pid, struct task_restore_args *args, CoreEntry *core);
+static int prepare_mm(pid_t pid, struct task_restore_args *args);
+
 static int restore_one_alive_task(int pid, CoreEntry *core)
 {
 	unsigned args_len;
@@ -551,6 +554,12 @@  static int restore_one_alive_task(int pid, CoreEntry *core)
 	if (seccomp_filters_get_rst_pos(core, ta) < 0)
 		return -1;
 
+	if (prepare_itimers(pid, ta, core) < 0)
+		return -1;
+
+	if (prepare_mm(pid, ta))
+		return -1;
+
 	return sigreturn_restore(pid, ta_cp, core);
 }
 
@@ -2061,7 +2070,7 @@  out:
 	return ret;
 }
 
-static int prepare_itimers(int pid, CoreEntry *core, struct task_restore_args *args)
+static int prepare_itimers(int pid, struct task_restore_args *args, CoreEntry *core)
 {
 	int ret = 0;
 	TaskTimersEntry *tte = core->tc->timers;
@@ -2973,14 +2982,6 @@  static int sigreturn_restore(pid_t pid, unsigned long ta_cp, CoreEntry *core)
 
 	new_sp = restorer_stack(task_args->t->mz);
 
-	ret = prepare_itimers(pid, core, task_args);
-	if (ret < 0)
-		goto err;
-
-	ret = prepare_mm(pid, task_args);
-	if (ret < 0)
-		goto err;
-
 	/* No longer need it */
 	core_entry__free_unpacked(core, NULL);
 	xfree(current->core);