[CRIU] [PATCH 5/9] Moved function parasite_dump_sigacts_seized() from here

prakriti goyal prakritigoyal19 at gmail.com
Mon Mar 16 18:59:32 MSK 2020


From: prakritigoyal19 <prakritigoyal19 at gmail.com>

Signed-off-by: prakritigoyal19 <prakritigoyal19 at gmail.com>
Repo link: https://github.com/prakritigoyal19/criu/tree/sigactions

---
 criu/parasite-syscall.c | 46 +++--------------------------------------
 1 file changed, 3 insertions(+), 43 deletions(-)

diff --git a/criu/parasite-syscall.c b/criu/parasite-syscall.c
index b649d1b5..06cbe07f 100644
--- a/criu/parasite-syscall.c
+++ b/criu/parasite-syscall.c
@@ -5,6 +5,7 @@
 #include <sys/wait.h>
 #include <sys/mman.h>
 
+#include "sigaction.h"
 #include "common/config.h"
 #include "common/compiler.h"
 #include "types.h"
@@ -45,6 +46,8 @@
 #include "infect-rpc.h"
 #include "pie/parasite-blob.h"
 
+#include <compel/compel.h>
+
 unsigned long get_exec_start(struct vm_area_list *vmas)
 {
 	struct vma_area *vma_area;
@@ -208,49 +211,6 @@ err_rth:
 	return -1;
 }
 
-int parasite_dump_sigacts_seized(struct parasite_ctl *ctl, struct pstree_item *item)
-{
-	TaskCoreEntry *tc = item->core[0]->tc;
-	struct parasite_dump_sa_args *args;
-	int ret, sig;
-	SaEntry *sa, **psa;
-
-	args = compel_parasite_args(ctl, struct parasite_dump_sa_args);
-
-	ret = compel_rpc_call_sync(PARASITE_CMD_DUMP_SIGACTS, ctl);
-	if (ret < 0)
-		return ret;
-
-	psa = xmalloc((SIGMAX - 2) * (sizeof(SaEntry *) + sizeof(SaEntry)));
-	if (!psa)
-		return -1;
-
-	sa = (SaEntry *)(psa + SIGMAX - 2);
-
-	tc->n_sigactions = SIGMAX - 2;
-	tc->sigactions = psa;
-
-	for (sig = 1; sig <= SIGMAX; sig++) {
-		int i = sig - 1;
-
-		if (sig == SIGSTOP || sig == SIGKILL)
-			continue;
-
-		sa_entry__init(sa);
-		ASSIGN_TYPED(sa->sigaction, encode_pointer(args->sas[i].rt_sa_handler));
-		ASSIGN_TYPED(sa->flags, args->sas[i].rt_sa_flags);
-		ASSIGN_TYPED(sa->restorer, encode_pointer(args->sas[i].rt_sa_restorer));
-		BUILD_BUG_ON(sizeof(sa->mask) != sizeof(args->sas[0].rt_sa_mask.sig));
-		memcpy(&sa->mask, args->sas[i].rt_sa_mask.sig, sizeof(sa->mask));
-		sa->has_compat_sigaction = true;
-		sa->compat_sigaction = !compel_mode_native(ctl);
-
-		*(psa++) = sa++;
-	}
-
-	return 0;
-}
-
 static void encode_itimer(struct itimerval *v, ItimerEntry *ie)
 {
 	ie->isec = v->it_interval.tv_sec;
-- 
2.17.1



More information about the CRIU mailing list