[CRIU] [PATCH] compel: new catch and "release at" helpers added
Stanislav Kinsburskiy
skinsbursky at virtuozzo.com
Fri Mar 17 06:54:17 PDT 2017
17.03.2017 14:41, Pavel Emelyanov пишет:
> On 03/17/2017 04:31 PM, Stanislav Kinsburskiy wrote:
>>
>> 17.03.2017 14:28, Pavel Emelyanov пишет:
>>> On 03/16/2017 02:43 PM, Stanislav Kinsburskiy wrote:
>>>> These helpers are compel_run_at split result.
>>> BTW, the compel_run_at itself seems to be unused.
>>
>> I use it.
> Ah :) OK, can we then give this trio some better names?
> Because run_at, release_at and catch do not give a valid
> impression on what they really do.
Well, naming is not one of my good skills. But, frankly, in this case I
like the names. There are pretty clear (and meaningful) to me.
What might be other options&?
> -- Pavel
>
>>>> IOW, it's an asynchronious way
>>>> of calling some binary code in remote process and cathing it after it's done.
>>>>
>>>> Signed-off-by: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
>>>> ---
>>>> compel/include/uapi/infect.h | 2 ++
>>>> compel/src/lib/infect.c | 14 ++++++++++++++
>>>> 2 files changed, 16 insertions(+)
>>>>
>>>> diff --git a/compel/include/uapi/infect.h b/compel/include/uapi/infect.h
>>>> index da0ca3a..aebb77c 100644
>>>> --- a/compel/include/uapi/infect.h
>>>> +++ b/compel/include/uapi/infect.h
>>>> @@ -66,6 +66,8 @@ extern int compel_syscall(struct parasite_ctl *ctl, int nr, long *ret,
>>>> unsigned long arg6);
>>>> extern int compel_run_in_thread(struct parasite_thread_ctl *tctl, unsigned int cmd);
>>>> extern int compel_run_at(struct parasite_ctl *ctl, unsigned long ip, user_regs_struct_t *ret_regs);
>>>> +extern int compel_release_at(struct parasite_ctl *ctl, unsigned long ip);
>>>> +extern int compel_catch(struct parasite_ctl *ctl, user_regs_struct_t *ret_regs);
>>>>
>>>> /*
>>>> * The PTRACE_SYSCALL will trap task twice -- on
>>>> diff --git a/compel/src/lib/infect.c b/compel/src/lib/infect.c
>>>> index c024250..a2cb5d6 100644
>>>> --- a/compel/src/lib/infect.c
>>>> +++ b/compel/src/lib/infect.c
>>>> @@ -581,6 +581,20 @@ int compel_run_at(struct parasite_ctl *ctl, unsigned long ip, user_regs_struct_t
>>>> return ret;
>>>> }
>>>>
>>>> +int compel_release_at(struct parasite_ctl *ctl, unsigned long ip)
>>>> +{
>>>> + user_regs_struct_t regs = ctl->orig.regs;
>>>> +
>>>> + return parasite_run(ctl->rpid, PTRACE_CONT, ip, 0, ®s, &ctl->orig);
>>>> +}
>>>> +
>>>> +int compel_catch(struct parasite_ctl *ctl, user_regs_struct_t *ret_regs)
>>>> +{
>>>> + user_regs_struct_t regs;
>>>> +
>>>> + return parasite_trap(ctl, ctl->rpid, ret_regs ? ret_regs : ®s, &ctl->orig);
>>>> +}
>>>> +
>>>> static int accept_tsock(struct parasite_ctl *ctl)
>>>> {
>>>> int sock;
>>>>
>>>> .
>>>>
>> .
>>
More information about the CRIU
mailing list