[Toybox] Regarding toybox 'top' command options support

Rob Landley rob at landley.net
Mon Sep 25 05:24:09 PDT 2017


I've cc'd my reply to the toybox mailing list, but removed the
identifying info from the submitter rather than do the "can I post this"
round trip. (They can reply publicly if they like.)

On 09/22/2017 07:26 AM, XXX wrote:
> Dear Rob Landley
>
> I  have gone through toybox code developed by  you.
> I  need small information regarding code changes
> required to support 'top -m ' command.

I tried "top -m" on ubuntu and it didn't know what that was...

> In toolbox(old version) , support 'top -m  x'command to
> display <x> lines from 'top' command output.

During normal operation you can override the secreen size detection via
the environment variable $LINES, ala:

  LINES=10 top

But that doesn't affect -b mode...

> But this '-m' option is not supported  yet in toybox code.

My assumption was if you're using "top -bn1" you'd pipe it through "head
-n ##", to trim the output, but I suppose I can see it being useful for
multiple -b output iterations...

> So could you please let me know the source code changes
> that are need to be done in top_common() function
> present in toybox/toys/posix/ps.c file.?

I.E. this is a feature request to add -m to top? :)

Hey Elliott, given this was an android addition to begin with, what do
you think? (It's easy enough to add...)

Rob

P.S. Poking at this, top and iotop have a common option block but -H and
-O weren't applied to iotop so either they should be or the options
should be moved to the earlier quoted string in the NEWTOY macro to mark
them as not common... And -O differs because iotop uses it to mean
something else. But maybe -H can be shared...


More information about the Toybox mailing list