Age | Commit message (Collapse) | Author |
|
|
|
|
|
unify some TT.signame tests checking constant value variable initialized to.
|
|
|
|
Refactor the /proc/net parsing so this only adds 7 lines overall.
Also clear the DEVICE field for sockets and fix alignment for long
usernames (until someone implements the two-pass output that measures
columns).
|
|
The brillo folks wanted this in a shell script they're porting over
(so I've only implemented the fd style they wanted, not the named file
style).
|
|
|
|
|
|
|
|
|
|
|
|
Adds XVFORK() macro, teaches xpopen_both() to call /proc/self/exe with NULL
argv (and converts cpio -p to use that), adds TOYBOX_FORK guards to some
unconverted commands.
|
|
|
|
Note: vfork(), like fork(), can return -1 if too many processes, and
we should notice and fail loudly.
|
|
|
|
Elliott Hughes found a bug https://android-review.googlesource.com/#/c/170020/
and Daniel K. Levy worked out the problem: the user/group/newer arguments
to find weren't consuming their arguments when not checking the results of
their comparison (because an earlier test had already caused their
parenthetical group to fail). This confused the argument parsing logic
and could lead to segfaults.
I applied a different fix that reorganized the existing tests instead of
adding a new test. (Looks like a big commit but it's mostly whitespace
due to extra curly brackets changing indendentation levels.)
|
|
|
|
|
|
|
|
The -e flag should add "user" and "inode" columns to the TCP output.
Also truncate IP addresses in non-wide (no -W) mode.
This also removes a bit more of the duplication, though there's still
plenty left in this file!
|
|
|
|
netstat -p was failing for any cmdline longer than 21 characters. (A
typical Chrome render process has about half a kilobyte of cmdline.)
There's still a lot of cleanup to be done later, but this is enough to
fix -p and remove a fair amount of unnecessary custom code into the
bargain.
|
|
|
|
This fixes the build break, the change to yesno() prototype accidentally got
checked in last commit. (Oops, sorry.)
|
|
and update the tests.
|
|
overwritten before we set up signal handlers.
|
|
|
|
It turns out that people are anticipating the switch to toybox ls from
toolbox ls on the assumption that this will finally bring -h support.
Let's not disappoint.
I've merged two existing buffers in listfiles whose uses didn't
overlap into one. It may be possible to cram this into toybuf with the
other stuff, but it didn't seem worth the extra complexity for 64B of
stack, especially since we were already living with that for time
formatting anyway.
|
|
This doesn't address the lack of support for a variable-width
"Filesystems" column, but it doesn't make the current situation any
worse either.
This is the last of the missing -h options. The other commands with -h
also have --si, but only for df did it get a corresponding short
option (and I've never personally used --si on du or ls, so let's wait
until someone actually cares).
|
|
This is a superset of the current AOSP lsof (which is itself a
superset of the lsof in Android M). It fixes several bugs/misfeatures
and adds support for decoding IPv4/IPv6 tcp/udp/raw sockets and Unix
domain sockets.
|
|
|
|
before saving, the updates don't go in the commit. Behavior difference
between git and mercurial, that.
Good to know.
|
|
|
|
pgpgin and pgpgout in /proc/vmstat are in kbytes, not pages.
(see http://lxr.free-electrons.com/source/mm/vmstat.c?v=4.2#L1310).
Remove the extra * page_kb for io_in and io_out.
|
|
|
|
Modifying the headers pointer when printing the headers causes
a buffer overrun the second time they are printed. Use a local
header pointer that is reset to the beginning of the buffer for
each loop.
|
|
Right-aligned looks pretty good to me, but it's not what anyone else does.
|
|
We need to remove the destination, not the source, to be able to overwrite.
|
|
Now that the kernel's 128k environment size has been lifted, it might be
possible to feed in a gigabyte of suffix so argv[2] is enough larger than
argv[1] that char *s decrements past NULL and points to arbitrary high
memory (I.E. strlen(suffix) > (long)base), at which point the base > s
test is defeated and we strcmp() against a wild pointer.
Which is read only anyway and on 64 bit you probably couldn't hit any
interesting addresses, but the fix is easy enough: compare strlen values
instead of pointers. So do that instead.
|
|
it's how the kernel signals that ctrl-alt-delete has been pressed;
thus, setting it as the signal for reboot prevents ctrlaltdel scripts
from working.
SIGTERM is what Busybox uses, so we might as well be compatible.
|
|
|
|
|
|
|
|
Correctly and portably check for non-normal dates, and explicitly show
the "before" and "after" dates (in the format of the user's choosing).
Clear the struct tm in date_main rather than parse_default because on
one path the struct tm is actually initialized. Explicitly clear the
tm_sec field in parse_default because -- experiment shows -- that
should not be preserved. Only do the "what does this 2-digit year
mean?" dance if we actually parsed a 2-digit year. Show the right
string in the error message if strptime fails.
Also add more tests, and use UTC in the tests to avoid flakiness.
|
|
uninitialized trash in struct tm fields could segfault glibc's strftime().
|
|
looks like. dd uses "7 MB" where du uses "7M", for example. this patch
adds flags, similar to the BSD humanize_number. most callers will pass 0.
|
|
|
|
It's user then group, not the other way round.
|
|
|
|
|