[Toybox] Simplifying (was Re: top -H segfault)

enh enh at google.com
Thu Jun 9 08:16:46 PDT 2016


On Wed, Jun 8, 2016 at 10:25 PM, Rob Landley <rob at landley.net> wrote:
> On 06/08/2016 09:59 PM, enh wrote:
>> On Wed, Jun 8, 2016 at 6:37 PM, Rob Landley <rob at landley.net> wrote:
>>>> yeah, as far as i can tell this is right.
>>>
>>> Ok, I'll apply it then.
>>
>> i can't actually tell any difference from this patch. remind me what changed?
>
> Processes that weren't threads had a blank TNAME (because they
> didn't have a snapshot of their parent process's argv[0] in
> string slot 7).

i don't see that without this patch. all three cases looked fine:
regular java threads (process+thread, different), single-threaded
processes like init or toybox (process), and kernel threads (thread,
no process).

(actually, TNAME is still more useful than NAME even for init and
toybox: it'll show "ps" rather than "toybox", for example.)

> This adds a fallback to show _this_ process's argv[0] when
> the snapshot is blank. I.E.
>
>     // If TNAME is blank, show ARGS instead
>     if (which==PS_ARGS && !*out)
>       out = tb->str+tb->offset[-2-typos[which = PS_ARGS].slot];
>
> And then it falls back to showing stat[2] if they're both
> blank (I.E. kernel threads).
>
> How I explain that in the help text, I have no idea.
>
> Rob



-- 
Elliott Hughes - http://who/enh - http://jessies.org/~enh/
Android native code/tools questions? Mail me/drop by/add me as a reviewer.



More information about the Toybox mailing list