Age | Commit message (Collapse) | Author |
|
|
|
Be consistent about upper versus lower case. (Upper seems to have the
majority, so I went with that, though I'm happy to provide the opposite
patch as long as we're consistent!)
Be consistent about using \t. (Though saving a few bytes seems like it
might be better done in the code that generates help.h rather than
directly in the source, since tabs make careful ASCII art layout hard
enough that we regularly have things misaligned.)
Remove trailing periods (most of which seem to have been added by me).
Always use the US "human readable" rather than my British
"human-readable", and be more consistent about declaring whether we're
showing multiples of 1000 or 1024.
Just say "verbose" rather than adding a useless "mode" or "output".
|
|
|
|
Even if we don't build ps, we can't have a Linux-only struct in GLOBALS.
The obvious alternative to this would be to have a fake struct sysinfo
in lib/portability.h. Since having a real macOS replacement for
sysinfo(2) seems unlikely at this point, I went this route instead.
|
|
xparsetime() not to need floating point, adjust callers.
|
|
|
|
|
|
|
|
|
|
add comments to get_ps().
|
|
|
|
|
|
|
|
LTP uses `top -d 0.1`, which isn't convincingly useful, but general
support for other time units might be useful, and switching to xparsetime
addresses both at once.
Also fix 3169d948c049664bcf7216d4c4ae751881099d3e where I mistakenly
treated `rev` and `toys.optflags&FLAG_b` as interchangeable. (Without
this second fix, `top -b` looks fine but `top` is broken!)
Also fix xparsetime to reject input such as "monkey" or "1monkey".
|
|
|
|
(Otherwise updating pid to parents makes threads read thread parent data.)
|
|
The first contains display fields selectable by the -o argument,
the second contains the /proc/$PID data for one process.
|
|
(Bionic _does_ do the malloc(0)!=0 thing, the problem is pedantic access
checking, not null dereference. So test count instead.)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
iotop -H
|
|
out from under us due to asyncronous process exit.
The directory we're traversing vanishing can result in DIRTREE_ABORTVAL
being returned, which we turn into a NUL entry, but then we were trying to
look at that null entry's children. Oops.
|
|
the help infrastructure to handle it.
(The lifetime rules are all wrong for hunks that get reused. Needs a largeish
rewrite.)
|
|
`ps -A | cat` shouldn't have different output depending on the size of
your terminal window.
|
|
exist, which can hit ps when /proc isn't there or /proc/$PID/task isn't
there (because process exited between the time we checked its contents
and the time we looked for its threads).
|
|
(Recent "show + for last char when truncated" change broke that, putting it
back.)
|
|
|
|
to be left justified again.
|
|
|
|
when we can't query terminal size pad to 80 but add -w.
|
|
(It was defaulting to 99999 but not FLAG_w, so it tried to _pad_ to 99999.)
|
|
|
|
(left-justified) fields.
|
|
subtract one _less_ than /dev prefix length or string isn't terminated.
|
|
just for terminal width.
|
|
|
|
I knew that just showing the process name was a divergence from
traditional Android behavior, but I was curious to see whether anyone
cared. Bug reports show that they do. I've not made this conditional on
CFG_TOYBOX_ON_ANDROID on the assumption that this is more useful for
everyone else too. (Why are you asking for per-thread information if
you don't actually want to be able to identify individual threads?)
Why not _just_ show the thread name? Because on Android at least, every
process has lots of identically-named threads; everyone has GC threads,
everyone has JIT threads, and so knowing _just_ the thread name is
rarely useful.
Why show thread name first? Because the kernel limits thread names to 15
bytes plus a NUL, so any left-over space should go to the process name,
so that should come last.
Why call the thread name THREAD? Because "CMD" isn't obviously "thread
name" to folks who don't know how this is implemented behind the scenes.
This change also removes an incorrect "usage:" comment. None of the
other commands in this file duplicated their "usage:" lines, and this
copy wasn't even close to being correct.
Bug: http://b/34610082
|
|
|
|
|
|
This fixes an indirect function call through a pointer of an
incompatible type.
See http://clang.llvm.org/docs/ControlFlowIntegrity.html for more
details.
|
|
It's causing confusion, and it's not obvious that anyone's relying on
it (and even if they are, let's try to find and fix them first).
|
|
|
|
(no /proc/$PID/cmdline so setting was skipped and previous value retained),
which led to memcpy() with an overlapping source/dest range (annoying asan).
Fix: move temp variable and assignment outside the if() statement so we assign
zero if we can''t read the file.
|
|
POSIX says nothing, but traditional ps lets you say "ps 123" in addition
to "ps -p 123". (You can mix and match too: "ps -p 123,124 666 667" works
fine.)
Bug: 31778761
|
|
Android uses NAME rather than CMD by default, but that's not what we
want with -T. Noticed because it broke systrace's reporting of thread
names (see https://developer.android.com/studio/profile/systrace.html).
Bug: 31741954
|
|
This is enough for everything on Android and everything except Java
on my desktop. Even desktop Chrome fits!
|