Age | Commit message (Collapse) | Author |
|
|
|
(Two spaces padding between columns, and -k is hardwired on.)
|
|
(We should use xprintf and similar to flush and check if stdout went away
once per line. No point flushing partway through a line, so in ls only use it
on things outputting a newline char.)
|
|
-h should apply to -s too. (Previously it only applied to the "total"
line in -s output.)
|
|
instead of a struct. This means it can return "12345" even if that user/group
doesn't exist in /etc/passwd and similar.
All the users were immediately dereferencing it to get pw_uid or gr_gid
anyway, so just return it directly and adjust the users. This fixes
things like "chown 12345:23456 filename".
|
|
|
|
apply it to "true" and "false".
|
|
of number, but never NULL. Both returned in static buffer good through
next call.)
|
|
add xopenro() that takes one argument and understands "-" means stdin,
and switch over lots of users.
|
|
The IANA tzcode implementation of mktime (used on Android and BSDs) sets
errno in some cases where it doesn't return -1 to indicate failure, so the
existing test always failed on those systems.
I don't think glibc ever sets errno (which is fine by ISO C, but not POSIX).
Other uses of mktime in toybox are already fine. This one would have been
caught by the existing tests if I was running them on the device :-(
|
|
|
|
|
|
|
|
This is enough for everything on Android and everything except Java
on my desktop. Even desktop Chrome fits!
|
|
|
|
They're really just arbitrary byte sequences of arbitrary length.
Sure, a 20-byte sequence is _probably_ a SHA-1, but there's no way
to know, so let's stop pretending...
|
|
is explicitly outright insane (%b handles octal escapes differently for no
obvious reason).
|
|
|
|
|
|
|
|
|
|
|
|
It should come as no surprise to those who followed the development of
this that it's not well known which of the various names is actually the
thread name. Adding "thread" to the ps --help output seems like a good
idea.
I'm also assuming that "stat2" was meant to read "stat[2]", since that's
how it mostly appeared on the list while discussing this. Still fits in
80 columns.
|
|
|
|
continues to get worse, and now can't handle INT_MAX/2 either. So our
first workaround _also_ broke.
But posix says "A negative precision is taken as if the precision were
omitted." and that _doesn't_ trigger the glibc bug, so use that instead.
|
|
constraints while still trying to get sane behavior. Discard the old CMD,
move COMM to CMD, move the old NAME to COMM, and move TNAME to NAME.
Posix assumes argv[] is the only source of process name data, but Linux has
three sources (/proc/$PID/cmdline, /proc/$PID/exe, /proc/$PID/stat field 2)
and android uses multiple sources simultaneously to identify its processes
and threads.
Toybox ps also assumes that the field names displayed in the headers
can be fed to -o to get that output, which is an assumption posix's
ps spec clearly does not have. Before we were erring on the side of posix,
now we're erring on the side of sanity.
CMD now shows stat[2], all the time. The posix -f behavior change is now
just an ARGS=CMD alias in the -f default command line, which -o overrides.
(Before -f changed the behavior of -o CMD, which is closer to what
posix says but is _insane_ and we've stopped doing it.)
COMM now shows /proc/$PID/exe minus the path. (I'm aware posix says argv[0]
here, but it says argv everywhere.)
NAME is now argv[0] of $PID.
TNAME went away.
Both $COMM and $NAME show the data for $PID, which is a thread's parent
process when $TID != $PID.
|
|
field (that's the ptb/tb switching in get_ps) so it's never blank, so
this doesn't trigger. (Conditionally initializing it would save runtime
memory, but at the expense of more complex code.)
|
|
"NAME" is no longer doing what we want; "TNAME" is what "NAME" used to be,
except that "TNAME" implies -T. This patch switches us over to "TNAME",
disables the implicit -T.
Change-Id: I5553703d3939b24eaf39976162d2f75a591e1ce8
|
|
"toybuf" should be initialized before calling symlinkat() or
dangling link could occur.
|
|
(Still fixing the fallout from that "Don't truncate number fields" logic rewrite.)
|
|
argv[0]. If that's blank, show [stat2]."
That way threads show their parents, parents show themselves, and
kernel threads show the [stat2] name.
|
|
|
|
The man page says they also return 2 for syntax errors and 3 for "fatal
error: out of memory etc", but I don't know how to implement that and
don't need it (or have any reason to believe anyone needs it).
Bug: 29092208
|
|
use generated constant for stat field parsing loop.
|
|
|
|
|
|
when trimmed for screen width), make ARGS path trimming logic work with
spaces in path.
|
|
and the collate logic wasn't updated. (Oops.)
|
|
I don't know that anyone cares, but these failures made me think I'd
broken something while testing the -SIGNAL patch.
The -s parsing wasn't taking into account that -s 0 is a special case,
and the -o test was assuming that pkill can tell the difference between
two processes started at roughly the same time. Hopefully there's
higher-resolution data available that can avoid the need for yet another
sleep in the tests.
|
|
This fixes the existing test. Internal Android bug 28877702.
I've left -l as-is, even though the desktop doesn't support that.
|
|
let them overflow and try to reclaim extra space from later short fields.
|
|
calculations instead of doing strlen() on strings again to store lengths.
|
|
|
|
|
|
|
|
|
|
Also enable the same behavior we have with ps, where adding a thread-related
field implies that you're interested in threads.
Also clean up the help text slightly --- we're still not including the
TOP_COMMON help, but at least when we do, we'll have each option covered with
no duplicates.
|
|
The use of TT.time to determine whether to use \r or \n is a little odd,
but let's stick with that for now. Correct the spelling of millitime and
add a test.
|
|
|
|
|