[Toybox] ps on Android

enh enh at google.com
Thu Jun 9 08:22:44 PDT 2016


On Wed, Jun 8, 2016 at 9:06 PM, Rob Landley <rob at landley.net> wrote:
> On 06/08/2016 07:09 PM, enh wrote:
>> folks are starting to notice how broken it is...
>
> I never quite got a clear idea whether or not I should apply the patch
> in the last email, and I'd held off because I didn't want to make random
> changes without being sure what you wanted.
>
> Lemme go back and finish that email and send it... And I applied the patch.
>
> Two pending issues from last message:
>
> 1) Rename TNAME to NAME.
>
> 2) Make it not force a thread check.

(testing this morning reminded me that there was a third issue --
albeit much less urgent -- that i think got lost in the megathread...
i was going to make VSZ and RSS wider for Android so we don't have
misaligned columns by default, and iirc you said that should be done
for everyone.)

> Sub-issue of 1, I'm just gonna hijack "CMD" for what "NAME" used to do.
> COMMAND is /proc/$$/exe and CMD is short COMMAND (minus path).
>
>> i'll probably submit https://android-review.googlesource.com/237370
>> (shown below) tomorrow and then revert it when we have a better
>> solution.
>
> Let's see...
>
>> --- a/toys/posix/ps.c
>> +++ b/toys/posix/ps.c
>> @@ -1180,7 +1180,7 @@ void ps_main(void)
>>    else if (toys.optflags&FLAG_l)
>>      not_o = "F,S,UID,%sPPID,C,PRI,NI,ADDR,SZ,WCHAN,TTY,TIME,CMD";
>>    else if (CFG_TOYBOX_ON_ANDROID)
>> -    not_o = "USER,%sPPID,VSIZE,RSS,WCHAN:10,ADDR:10=PC,S,NAME";
>> +    not_o = "USER,%sPPID,VSIZE,RSS,WCHAN:10,ADDR:10=PC,S,TNAME:99";
>
> No, if NAME is the last field, and left justified, then it should
> automatically expand (without padding) up to whatever it thinks the
> right edge of the screen is. If it's not doing that, there's a bug.
> Let's see, if there's no controlling tty, the setup code in
> shared_main() should choose a default width of 99999 and all the others
> (top and iotop care here) should choose 80:
>
>   if (!TT.width) {
>     TT.width = (toys.which->name[1] == 's') ? 99999 : 80;
>     TT.height = 25;
>     terminal_size(&TT.width, &TT.height);
>   }
>
> (The -w option overrides this, setting width to 99999 in ps_main()
> before calling shared_main() so the above if (!TT.width) already has a
> value and the body gets skipped.)
>
> Ah. Blah. Yet more fallout from the "Don't truncate number fields"
> commit. Sigh. I fixed it, sorry about that.
>
> (Also, when I move TNAME to NAME I can change the default to the longer
> -27 so even if it's in the middle it has more space to work with).
>
> 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