aboutsummaryrefslogtreecommitdiff
path: root/toys/posix
AgeCommit message (Collapse)Author
2016-06-10Shuffle arguments around (TNAME->NAME->COMM->CMD), working around posixRob Landley
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.
2016-06-10Revert commit e02e41373ea3, we're always initializing the TNAME stringRob Landley
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.)
2016-06-10HACK: restore Android ps behavior.Elliott Hughes
"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
2016-06-09Fix dangling link after cp commandKyungsik Lee
"toybuf" should be initialized before calling symlinkat() or dangling link could occur.
2016-06-08Fix ps bug, last field wasn't expanding to width.Rob Landley
(Still fixing the fallout from that "Don't truncate number fields" logic rewrite.)
2016-06-08Change the TNAME behavior to "Show parent argv[0]. If that's blank, showour ↵Rob Landley
argv[0]. If that's blank, show [stat2]." That way threads show their parents, parents show themselves, and kernel threads show the [stat2] name.
2016-06-07Izabera pointed out that cmp -ls are contradictory.Rob Landley
2016-06-04Basic success/failure return from pgrep/pkill.Elliott Hughes
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
2016-06-04ps: Show [stat2] for any otherwise blank process name field, expand TNAME to 27,Rob Landley
use generated constant for stat field parsing loop.
2016-05-31In cp -a, don't complain if non-root user can't chown, failure is expected.0.7.1Rob Landley
2016-05-30Add output path to cp error message filenames.Rob Landley
2016-05-27Add -o TNAME for android, fix display of last field (retain left justifificationRob Landley
when trimmed for screen width), make ARGS path trimming logic work with spaces in path.
2016-05-24The "show parent command path" commit changed the criteria for active nodes,Rob Landley
and the collate logic wasn't updated. (Oops.)
2016-05-23Fix remaining pkill tests.Elliott Hughes
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.
2016-05-23Fix pkill -9.Elliott Hughes
This fixes the existing test. Internal Android bug 28877702. I've left -l as-is, even though the desktop doesn't support that.
2016-05-22Don't truncate number fields for anything but right edge of screen, insteadRob Landley
let them overflow and try to reclaim extra space from later short fields.
2016-05-22Make -o COMMAND show parent command path for threads, and use saved lengthRob Landley
calculations instead of doing strlen() on strings again to store lengths.
2016-05-22Comment and help text tweaks.Rob Landley
2016-05-20Add bufgetgrgid()Rob Landley
2016-05-17Add bufgetpwuid. (Repeated calls to getpwuid() are really expensive.)Rob Landley
2016-05-16Add top -ORob Landley
2016-05-05Add top -H.Elliott Hughes
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.
2016-05-05"top -b -n1" should end with a newline.Elliott Hughes
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.
2016-05-04Elliott says -T should fetch threads even when not displaying thread fields.Rob Landley
2016-05-04Simplify ps android scheduling policy fetch slightly.Rob Landley
2016-04-30Add a ps "PCY" field for Android scheduling policy.Elliott Hughes
2016-04-29First guess at showing thread names properly.Rob Landley
2016-04-29Show "-" rather 0 if we don't know whether a process is 32- or 64-bit.Elliott Hughes
2016-04-29Fix ps -O help output alignment.Elliott Hughes
2016-04-25ps thread supportand 32/64 bit detection.Rob Landley
Add ps -o BIT,TID,TCNT, and make -T display "PID,TID" for default output types (adding TCNT to -f)
2016-04-25Fix find bug reported by Tom Marshall, add test for it, and while we're at itRob Landley
fix two tests looking for a too-specific error message (so TEST_HOST failed).
2016-04-21Have dirtree_recurse() take the new dirfd as an argument.Rob Landley
2016-04-21Fix touch -t seconds parsingDavis Mosenkovs
2016-04-16Fix tail -NUM again.Elliott Hughes
This time with a test.
2016-04-16Fix "ssh top".Elliott Hughes
The ps.c change allows us to start. The interestingtimes.c change allows us to clean up properly afterwards if you ^C out (which you usually do). Tested with both ssh and "adb shell" (the latter being where I noticed the problem).
2016-04-16Fix top -b.Elliott Hughes
Batch mode should never output terminal escape sequences, should ignore the keyboard, and should include a gap between datasets.
2016-04-16Rename gratuitous references to Roger Zelazny's amber series, add comments.Rob Landley
2016-04-11sed -f - should read from stdin.Rob Landley
2016-03-30Whitespace and comment.Rob Landley
2016-03-30Implement mv -n / cp -n (no clobber).Andy Chu
This fixes a failing test case in mv.test. Test changes: - Add coverage for -i (interactive). - Better descriptions, better formatting, and removed some redundant cases.
2016-03-25basename: fix segfault on null input; add testsSamuel Holland
When passed an empty string, glibc's basename() returns a pointer to the string "." in read-only memory. If an empty suffix is given, it fits the condition of being shorter than the path, so we try to overwrite the null byte and crash. Fix this by just ignoring empty suffixes; they don't do anything anyway.
2016-03-25Add od -w.Elliott Hughes
I'm not an od user myself, but I copy & pasted an 'od' invocation from a bug and it didn't work. Which was embarrassing because I'd just claimed that the od user didn't need to run od on their desktop (as they had done) and could have run it on the device instead...
2016-03-24Debian bug 635570 did something horribly nonstandard (depending on a sideRob Landley
effect of "sed -e 'a\'" with no trailing line). But there's an actual user, and it's not hard to implement, and it's not hard to implement, and there isn't an obvious _other_ way to do it, so add the behavior and a test for it. Fix some bad/missing comments while I was there, and add a couple TODOs.
2016-03-18Fix last commit (had newline before first ==> name <==) and add -f tests.Rob Landley
2016-03-18Fix "tail -f single_file".Josh Gao
TT.file_no was being incorrectly calculated as 0 when tail -f was passed a single argument.
2016-03-15Add ls -b and make ls -q work with utf8.Rob Landley
2016-03-12Update scripts/single.sh and cp.c so "make mv" isn't actually building cp.Rob Landley
2016-03-12The xattr functions were added during the 2.5 kernel, lsm.h can #include theRob Landley
header unconditionally. (This fixes the warning when CP_PRESERVE disabled.)
2016-03-10Fix segfault in sed -e 'c\'.Andy Chu
Found by afl-fuzz.
2016-03-07Cleanup pass on the dirtree infrastructure, in preparation for making rm -rRob Landley
handle infinite depth. Fix docs, tweak dirtree_handle_callback() semantics, remove dirtree_start() and don't export dirtree_handle_callback(), instead offer dirtree_flagread(). (dirtree_read() is a wrapper around dirtree_flagread passing 0 for flags.)