[Toybox] [PATCH] Fix the ps -o CMD vs COMM distinction.

Rob Landley rob at landley.net
Mon Nov 2 00:11:28 PST 2015


On 10/31/2015 04:02 PM, enh wrote:
> Better for _me_ would be to change the current code that rewrites
> characters < ' ' to leave '\0' alone if we're not supposed to be
> outputting the arguments, but then toybox would match the Android
> behavior (modulo the fact that we called this field NAME) rather than
> the usual GNU behavior.

Is this another documented deviation from posix in the big comment block
near the top, or did I miss a curve?

> Does anyone actually want the GNU truncating
> behavior? cmd/comm/command seems such a mess that although I wouldn't
> normally suggest adding new stuff, maybe just ignoring all this and
> adding a NAME field isn't such a bad idea after all...

I have no objection. The old posix default values are kinda nuts these days.

I still have a todo item to switch -l's fields to the ps -ly variant
(our variant of addr is so long there's a blank line between the header
and the first ps line and cmd has 3 chars to work with), except... the
ps -ly variant still has C for no readily apparent reason? That's a
field I didn't even bother to document because it's kind of sad. Posix
says "processor utilization for scheduling" with no further
clarification. (That's why I haven't implemented it yet, hence printing
a dash.)

The ps man page has it as an alias for -o pcpu only it's just the
integer part, no fraction. You'll be happy to know that pcpu is
percentage of processor ticks this process has used since its inception,
I.E. percentage of CPU (one processor) it could have used on an idle
system if it was constantly cpu bound the entire time _and_ the system
was never suspended (because elapsed time continues to tick when the
machine's off...).

Currently on my box I have five processes that don't have a zero here:
Three with a 1 and two with a 2, and one of each of those is chromium
(_that's_ how bad a cpu hog you have to be to show up here).

How any of that is usable "for scheduling", I couldn't tell you, since
it's all historical usage of long-running processes telling you about
what they did last week...

Anyway, I ripped out the crazy bitmap stuff and redid the default/-f/-l
command line parsing as strings so it would be easy to change 'em. If
you have a better idea what they should be, now's the time to speak up.
(Heck, I've got a CFG_TOYBOX_ANDROID symbol, easy enough to change the
default just for that, if you've got a userbase that'll care.)

Also, on a previous patch: having --ppid like that in the help text is
really ugly. Can we define -P as the short version of this so the help
text doesn't mix longopts with shortopts? (Keeping the long alias for
compatability with existing users, fine. Nothing seems to be using -P
yet...)

I'm trying to cut a release in the next day or two, so getting this
nailed down would be nice...

Thanks,

Rob

 1446451888.0


More information about the Toybox mailing list