[CRIU] [PATCH 1/8] compel: Introduce compel_thread_sigmask

Pavel Emelyanov xemul at virtuozzo.com
Mon Nov 14 05:04:54 PST 2016


The plan is to rectify the thread infection API and hide
thread_ctx from uapi eventually, so here's the symmetrical
to compel_task_sigmask() call for threads.

Signed-off-by: Pavel Emelyanov <xemul at virtuozzo.com>
---
 compel/include/uapi/infect.h | 1 +
 compel/src/lib/infect.c      | 7 ++++++-
 criu/parasite-syscall.c      | 2 +-
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/compel/include/uapi/infect.h b/compel/include/uapi/infect.h
index 38051f4..c444a6e 100644
--- a/compel/include/uapi/infect.h
+++ b/compel/include/uapi/infect.h
@@ -92,6 +92,7 @@ extern int compel_unmap(struct parasite_ctl *ctl, unsigned long addr);
 extern int compel_mode_native(struct parasite_ctl *ctl);
 
 extern k_rtsigset_t *compel_task_sigmask(struct parasite_ctl *ctl);
+extern k_rtsigset_t *compel_thread_sigmask(struct thread_ctx *tctx);
 
 struct rt_sigframe;
 
diff --git a/compel/src/lib/infect.c b/compel/src/lib/infect.c
index d9fd052..ff2140d 100644
--- a/compel/src/lib/infect.c
+++ b/compel/src/lib/infect.c
@@ -1246,9 +1246,14 @@ int compel_mode_native(struct parasite_ctl *ctl)
 	return user_regs_native(&ctl->orig.regs);
 }
 
+k_rtsigset_t *compel_thread_sigmask(struct thread_ctx *tctx)
+{
+	return &tctx->sigmask;
+}
+
 k_rtsigset_t *compel_task_sigmask(struct parasite_ctl *ctl)
 {
-	return &ctl->orig.sigmask;
+	return compel_thread_sigmask(&ctl->orig);
 }
 
 struct infect_ctx *compel_infect_ctx(struct parasite_ctl *ctl)
diff --git a/criu/parasite-syscall.c b/criu/parasite-syscall.c
index 79b4e9e..f35b71d 100644
--- a/criu/parasite-syscall.c
+++ b/criu/parasite-syscall.c
@@ -201,7 +201,7 @@ int parasite_dump_thread_seized(struct parasite_ctl *ctl, int id,
 		return -1;
 
 	tc->has_blk_sigset = true;
-	memcpy(&tc->blk_sigset, &octx.sigmask, sizeof(k_rtsigset_t));
+	memcpy(&tc->blk_sigset, compel_thread_sigmask(&octx), sizeof(k_rtsigset_t));
 
 	ret = compel_run_in_thread(pid, PARASITE_CMD_DUMP_THREAD, ctl, &octx);
 	if (ret) {
-- 
2.5.0



More information about the CRIU mailing list