[Toybox] ps on Android
Rob Landley
rob at landley.net
Wed Jun 8 21:06:09 PDT 2016
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.
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
More information about the Toybox
mailing list