mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-30 05:48:05 +00:00
compel: Add compel_prepare_noctx
The original compel_prepare() also initializes the infect_ctx with values suitable for simple usage. As a starting point the task_size value is set. The compel_prepare_noctx() allocates ctx-less handler that is to be filled by the caller (CRIU). travis-ci: success for compel: Contrinue improving library Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com> Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
This commit is contained in:
parent
5be5424047
commit
c0836c2052
@ -40,6 +40,7 @@ struct parasite_ctl;
|
|||||||
struct parasite_thread_ctl;
|
struct parasite_thread_ctl;
|
||||||
|
|
||||||
extern struct parasite_ctl *compel_prepare(int pid);
|
extern struct parasite_ctl *compel_prepare(int pid);
|
||||||
|
extern struct parasite_ctl *compel_prepare_noctx(int pid);
|
||||||
extern int compel_infect(struct parasite_ctl *ctl, unsigned long nr_threads, unsigned long args_size);
|
extern int compel_infect(struct parasite_ctl *ctl, unsigned long nr_threads, unsigned long args_size);
|
||||||
extern struct parasite_thread_ctl *compel_prepare_thread(struct parasite_ctl *ctl, int pid);
|
extern struct parasite_thread_ctl *compel_prepare_thread(struct parasite_ctl *ctl, int pid);
|
||||||
extern void compel_release_thread(struct parasite_thread_ctl *);
|
extern void compel_release_thread(struct parasite_thread_ctl *);
|
||||||
|
@ -894,7 +894,7 @@ void compel_release_thread(struct parasite_thread_ctl *tctl)
|
|||||||
xfree(tctl);
|
xfree(tctl);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct parasite_ctl *compel_prepare(int pid)
|
struct parasite_ctl *compel_prepare_noctx(int pid)
|
||||||
{
|
{
|
||||||
struct parasite_ctl *ctl = NULL;
|
struct parasite_ctl *ctl = NULL;
|
||||||
|
|
||||||
@ -924,6 +924,21 @@ err:
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct parasite_ctl *compel_prepare(int pid)
|
||||||
|
{
|
||||||
|
struct parasite_ctl *ctl;
|
||||||
|
struct infect_ctx *ictx;
|
||||||
|
|
||||||
|
ctl = compel_prepare_noctx(pid);
|
||||||
|
if (ctl == NULL)
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
ictx = &ctl->ictx;
|
||||||
|
ictx->task_size = compel_task_size();
|
||||||
|
out:
|
||||||
|
return ctl;
|
||||||
|
}
|
||||||
|
|
||||||
static bool task_in_parasite(struct parasite_ctl *ctl, user_regs_struct_t *regs)
|
static bool task_in_parasite(struct parasite_ctl *ctl, user_regs_struct_t *regs)
|
||||||
{
|
{
|
||||||
void *addr = (void *) REG_IP(*regs);
|
void *addr = (void *) REG_IP(*regs);
|
||||||
|
@ -1657,7 +1657,7 @@ static void finalize_restore(void)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* Unmap the restorer blob */
|
/* Unmap the restorer blob */
|
||||||
ctl = compel_prepare(pid);
|
ctl = compel_prepare_noctx(pid);
|
||||||
if (ctl == NULL)
|
if (ctl == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -573,7 +573,7 @@ struct parasite_ctl *parasite_infect_seized(pid_t pid, struct pstree_item *item,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ctl = compel_prepare(pid);
|
ctl = compel_prepare_noctx(pid);
|
||||||
if (!ctl)
|
if (!ctl)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user