[CRIU] [PATCH 3/4] parasite: Use parasite_ctl as the argument to arch_can_dump_task

Pavel Emelyanov xemul at virtuozzo.com
Sun Oct 30 00:37:16 PDT 2016


The pid is set on ctl and in the next patch I'll use one
more field.

Signed-off-by: Pavel Emelyanov <xemul at virtuozzo.com>
---
 criu/arch/aarch64/crtools.c     | 2 +-
 criu/arch/arm/crtools.c         | 2 +-
 criu/arch/ppc64/crtools.c       | 2 +-
 criu/arch/x86/crtools.c         | 8 +++++---
 criu/include/parasite-syscall.h | 2 +-
 criu/parasite-syscall.c         | 2 +-
 6 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/criu/arch/aarch64/crtools.c b/criu/arch/aarch64/crtools.c
index 515ab9a..8b0569f 100644
--- a/criu/arch/aarch64/crtools.c
+++ b/criu/arch/aarch64/crtools.c
@@ -42,7 +42,7 @@ void parasite_setup_regs(unsigned long new_ip, void *stack, user_regs_struct_t *
 		regs->sp = (unsigned long)stack;
 }
 
-bool arch_can_dump_task(pid_t pid)
+bool arch_can_dump_task(struct parasite_ctl *ctl)
 {
 	/*
 	 * TODO: Add proper check here
diff --git a/criu/arch/arm/crtools.c b/criu/arch/arm/crtools.c
index 51b6b06..7229ba0 100644
--- a/criu/arch/arm/crtools.c
+++ b/criu/arch/arm/crtools.c
@@ -46,7 +46,7 @@ void parasite_setup_regs(unsigned long new_ip, void *stack, user_regs_struct_t *
 	regs->ARM_cpsr &= PSR_f | PSR_s | PSR_x | MODE32_BIT;
 }
 
-bool arch_can_dump_task(pid_t pid)
+bool arch_can_dump_task(struct parasite_ctl *ctl)
 {
 	/*
 	 * TODO: Add proper check here
diff --git a/criu/arch/ppc64/crtools.c b/criu/arch/ppc64/crtools.c
index 6cf262e..3914bfd 100644
--- a/criu/arch/ppc64/crtools.c
+++ b/criu/arch/ppc64/crtools.c
@@ -58,7 +58,7 @@ void parasite_setup_regs(unsigned long new_ip, void *stack, user_regs_struct_t *
 	regs->trap = 0;
 }
 
-bool arch_can_dump_task(pid_t pid)
+bool arch_can_dump_task(struct parasite_ctl *ctl)
 {
 	/*
 	 * TODO: We should detect 32bit task when BE support is done.
diff --git a/criu/arch/x86/crtools.c b/criu/arch/x86/crtools.c
index 55b25d5..f301679 100644
--- a/criu/arch/x86/crtools.c
+++ b/criu/arch/x86/crtools.c
@@ -128,10 +128,12 @@ static bool ldt_task_selectors(pid_t pid)
 	return cs != USER_CS && cs != USER32_CS;
 }
 
-bool arch_can_dump_task(pid_t pid)
+bool arch_can_dump_task(struct parasite_ctl *ctl)
 {
-	int ret = arch_task_compatible(pid);
-
+	pid_t pid = ctl->rpid;
+	int ret;
+	
+	ret = arch_task_compatible(pid);
 	if (ret < 0)
 		return false;
 
diff --git a/criu/include/parasite-syscall.h b/criu/include/parasite-syscall.h
index fbec423..95296c5 100644
--- a/criu/include/parasite-syscall.h
+++ b/criu/include/parasite-syscall.h
@@ -118,7 +118,7 @@ extern int syscall_seized(struct parasite_ctl *ctl, int nr, unsigned long *ret,
 
 extern int __parasite_execute_syscall(struct parasite_ctl *ctl,
 		user_regs_struct_t *regs, const char *code_syscall);
-extern bool arch_can_dump_task(pid_t pid);
+extern bool arch_can_dump_task(struct parasite_ctl *ctl);
 extern bool seized_native(struct parasite_ctl *ctl);
 
 /*
diff --git a/criu/parasite-syscall.c b/criu/parasite-syscall.c
index 5ebb7aa..cbc3935 100644
--- a/criu/parasite-syscall.c
+++ b/criu/parasite-syscall.c
@@ -1478,7 +1478,7 @@ struct parasite_ctl *parasite_infect_seized(pid_t pid, struct pstree_item *item,
 	parasite_ensure_args_size(dump_pages_args_size(vma_area_list));
 	parasite_ensure_args_size(aio_rings_args_size(vma_area_list));
 
-	if (!arch_can_dump_task(pid))
+	if (!arch_can_dump_task(ctl))
 		goto err_restore;
 	/*
 	 * Inject a parasite engine. Ie allocate memory inside alien
-- 
2.5.0



More information about the CRIU mailing list