[CRIU] [PATCH 27/78] infect: Move restore_thread_ctx() into infect.c

Cyrill Gorcunov gorcunov at openvz.org
Mon Nov 7 08:36:12 PST 2016


From: Pavel Emelyanov <xemul at virtuozzo.com>

Signed-off-by: Pavel Emelyanov <xemul at virtuozzo.com>
---
 criu/infect.c           | 18 ++++++++++++++++--
 criu/parasite-syscall.c | 16 ----------------
 2 files changed, 16 insertions(+), 18 deletions(-)

diff --git a/criu/infect.c b/criu/infect.c
index 40fc54ea22a2..b16453a835af 100644
--- a/criu/infect.c
+++ b/criu/infect.c
@@ -369,8 +369,22 @@ err_sig:
 	return -1;
 }
 
-/* XXX will be removed soon */
-extern int restore_thread_ctx(int pid, struct thread_ctx *ctx);
+static int restore_thread_ctx(int pid, struct thread_ctx *ctx)
+{
+	int ret = 0;
+
+	if (ptrace_set_regs(pid, &ctx->regs)) {
+		pr_perror("Can't restore registers (pid: %d)", pid);
+		ret = -1;
+	}
+	if (ptrace(PTRACE_SETSIGMASK, pid, sizeof(k_rtsigset_t), &ctx->sigmask)) {
+		pr_perror("Can't block signals");
+		ret = -1;
+	}
+
+	return ret;
+}
+
 
 /* we run at @regs->ip */
 static int parasite_trap(struct parasite_ctl *ctl, pid_t pid,
diff --git a/criu/parasite-syscall.c b/criu/parasite-syscall.c
index dcd88c557bfe..b961e09f6503 100644
--- a/criu/parasite-syscall.c
+++ b/criu/parasite-syscall.c
@@ -91,22 +91,6 @@ static inline int ptrace_set_regs(int pid, user_regs_struct_t *regs)
 }
 #endif
 
-int restore_thread_ctx(int pid, struct thread_ctx *ctx)
-{
-	int ret = 0;
-
-	if (ptrace_set_regs(pid, &ctx->regs)) {
-		pr_perror("Can't restore registers (pid: %d)", pid);
-		ret = -1;
-	}
-	if (ptrace(PTRACE_SETSIGMASK, pid, sizeof(k_rtsigset_t), &ctx->sigmask)) {
-		pr_perror("Can't block signals");
-		ret = -1;
-	}
-
-	return ret;
-}
-
 bool seized_native(struct parasite_ctl *ctl)
 {
 	return user_regs_native(&ctl->orig.regs);
-- 
2.7.4



More information about the CRIU mailing list