Commit b071c6e3 authored by Pavel Emelyanov's avatar Pavel Emelyanov Committed by Andrei Vagin

infect: Move restore_thread_ctx() into infect.c

Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent 511a6ffd
...@@ -369,8 +369,22 @@ err_sig: ...@@ -369,8 +369,22 @@ err_sig:
return -1; return -1;
} }
/* XXX will be removed soon */ static int restore_thread_ctx(int pid, struct thread_ctx *ctx)
extern 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 */ /* we run at @regs->ip */
static int parasite_trap(struct parasite_ctl *ctl, pid_t pid, static int parasite_trap(struct parasite_ctl *ctl, pid_t pid,
......
...@@ -91,22 +91,6 @@ static inline int ptrace_set_regs(int pid, user_regs_struct_t *regs) ...@@ -91,22 +91,6 @@ static inline int ptrace_set_regs(int pid, user_regs_struct_t *regs)
} }
#endif #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) bool seized_native(struct parasite_ctl *ctl)
{ {
return user_regs_native(&ctl->orig.regs); return user_regs_native(&ctl->orig.regs);
......
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