[CRIU] [PATCH 1/3] crtools: resurrect --pid option for dump, v2
Ruslan Kuprieiev
kupruser at gmail.com
Thu Mar 2 07:32:56 PST 2017
On 03/02/2017 05:19 PM, Pavel Emelyanov wrote:
> On 03/01/2017 01:09 AM, Ruslan Kuprieiev wrote:
>> On 02/28/2017 05:24 PM, Pavel Emelyanov wrote:
>>
>>> On 02/28/2017 03:19 PM, Ruslan Kuprieiev wrote:
>>>> @@ -344,8 +345,8 @@ int main(int argc, char *argv[], char *envp[])
>>>> opts.ext_unix_sk = true;
>>>> break;
>>>> case 'p':
>>>> - pid = atoi(optarg);
>>>> - if (pid <= 0)
>>>> + opts.pid = atoi(optarg);
>>>> + if (opts.pid <= 0)
>>> I would just save the tree_id value here and set opts.one_shot = true.
>>> Then in collect_pstree() just freeze root task and that's it.
>>>
>> I've previously sent --root-only patch, but you pointed that it would be
>> nice to reuse old --pid option, so I decided to prepare ground for a more
>> general case of --pid specifying any task within tree(which, _in theory_ ,
>> might be useful for cases when you want to freeze the tree but only
>> interested in one task, like, for example, dumping a single worker that
>> is a child of master process or something like that). What do you think
>> about that potential general case?
> Ah, so your proposal is to make --tree and --pid work together, where
> the former one specifies what to freeze and the latter what to dump?
Yes, exactly. I don't actually _need_ to freeze a whole tree as of
right now,
but will need it a bit later =) and it actually has some logic to it in
general
case, i.e. other processes(children for example) might send signals and what
not to the process that we want to dump and so it has a lot of sense to use
--tree option to freeze the tree(we might even want to obtain some info from
it later) and then dump the task we're actually interested in that is
specified
with --pid option. Thus I suggest using both --tree and --pid and for
now only
allow pid == tree, but have potential to support for pid != tree in the
future.
>> I would honestly prefer introducing --one-shot(love the name, btw)
>> option for
>> CLI/CAPI/RPC which is like --root-only from previous patch and be done
>> with it,
>> as we definitely don't have any use cases(at least as of now) for more
>> general
>> --pid option and I would be more than happy with --one-shot.
>> .
> For me the --one-shot says that some action should perform once, in case
> of dump -- the dump one :) So if we want an additional option to --tree
> I'd call one --root-only.
>
> But actually making just the --pid option, that conflicts with the --tree
> one and dumps single task would be easier to understand.
>
> -- Pavel
More information about the CRIU
mailing list