[1/8] compel: Introduce compel_thread_sigmask

Submitted by Pavel Emelianov on Nov. 14, 2016, 1:04 p.m.

Details

Message ID 5829B676.4000307@virtuozzo.com
State Accepted
Series "compel: Sanitize API after split, wave 1"
Commit cd88f8982d4b24245aa82b5e232357887ccab3a4
Headers show

Commit Message

Pavel Emelianov Nov. 14, 2016, 1:04 p.m.
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@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(-)

Patch hide | download patch | download mbox

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) {