aboutsummaryrefslogtreecommitdiff
path: root/toys/posix
AgeCommit message (Collapse)Author
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.)
2016-03-04Elliott pointed out that we output "unlimited" instead of "infinity", soRob Landley
accept that as input. (And that I screwed up the test.)
2016-03-02For years the man pages have said to #include <sys/types.h> to getRob Landley
major/minor/makedev, but glibc has vowed to break existing programs (https://sourceware.org/ml/libc-alpha/2015-11/msg00253.html) and replace it with _another_ non-standard header (not in posix or lsb), so let's just add functions to lib/ that do the transform ourselves.
2016-03-01The last-ever release of uClibc hasn't got prlimit, so probe.Rob Landley
2016-02-29Fix trailing spaces on ps -o cmdline.Elliott Hughes
2016-02-17The perl build's attempt to escape spaces and such in LD_LIBRARY_PATH is _SAD_.Rob Landley
It uses a sed expression that assumes you can escape - to use it as a literal (you can't, it has to be first or last char of the range), and assumes you have to escape delimiters in sed [] context (you don't), and/or that non-printf escapes become the literal character (they don't, the backslash is preserved as a literal), meaning it winds up doing "s/[\-\]//" which is a length 1 range, which is officially undefined behavior according to posix, and regcomp errors out. But if we don't accept it (like other implementations do) the perl build breaks. So collapse [A-A] into just [A]. Testcae taken from perl 5.22.0 file Makefile.SH line 8. (While we're at it, remove an unused argument from a function.)
2016-02-14Fix wc -c optimization.Elliott Hughes
Check the fstat(2) return value rather than read uninitialized memory if it failed, and add a special case for files that claim to be zero-length but aren't (as is common in /proc on Linux).
2016-02-11removed unread assignment in sed.clovelycuppatea
clang scan-build flags up this line as being unread, so clearing from code.
2016-02-10Factor out strnstr() since posix hasn't got it, and add a config option forRob Landley
the deeply sad passwd heuristics that don't even check numbers and punctuation.
2016-02-10make wc -c fasterizabera
2016-02-10Although printf("%.*s", INT_MAX, s) works fine on ubuntu 12.04, it broke since.Rob Landley
2016-02-10implement env -uizabera
2016-02-09Add ulimit.Rob Landley
This isn't a shell builtin, it uses prlimit to target any pid (without -P it defaults to $PPID, so acts like historical ulimit by default).
2016-02-05Another fix from Josh Gao to avoid a null pointer dereference, andRob Landley
minor cleanup of previous commit.
2016-02-05Fix segfault when `find -iname` gets no argument.Josh Gao
2016-02-04Fix -H and -n with -ABC, and add tests.Rob Landley
2016-02-01Fix directory test in cp.Elliott Hughes
Commit 3d33dd80f8cb931e293d7f64c44bc357fec11120 fixed a use of S_ISDIR on st_dev rather than st_mode in find, but there was another instance of the same error in cp.
2016-02-01Add find -deleteRob Landley
2016-01-30Add grep -B -CRob Landley
2016-01-30Add grep -ARob Landley
2016-01-28Add SIGWINCH support to top, and implement -o and -n in pgrep/pkill.Rob Landley
2016-01-28Adding -M broke ps -k header printing without -M.Rob Landley
2016-01-28Bugfix I forgot to checkin, plus a wrapper function.Rob Landley
2016-01-27Don't resort or recalculate headers for cursor up/down, do PGUP PGDN, andRob Landley
down move way down past end of list.
2016-01-27Add cpu line to top, and fix a bug initializing upticks slot.Rob Landley
2016-01-27Don't try to be fancy with top headers, just hardwired the standardish ones.Rob Landley
Still need to do the cpu(s) line in top.
2016-01-26Add ps -M to measure/expand field widths if they don't fit.Rob Landley
(Still truncates at the right edge to fit terminal width, but last commit made -w the default when no terminal width detected.)
2016-01-26Add ps -O (inserts extra args before last field), and make -w the defaultRob Landley
when we haven't got a terminal width. Replace top CMDLINE with ARGS. More ps infrastructure genericization: parse reverse unconditionally. Break out get_headers() with global references moved to caller. change quick_ko() to default_ko() (dlist_terminate is now caller's job).
2016-01-25Next lump of top work. Add -o DISPLAY_FIELDS -k FALLBACK_SORTS -s SORT_BY plusRob Landley
the start of -h HEADER (mostly parses text, but doesn't display %ESCAPES yet). Added UP, DOWN, and R keys. Made only iotop STAYROOT (not top), added comment explaining why. Bumped iotop's historical -O and -K to capital letters. Added quick_ko() to add argument list from string instead of arg_list.
2016-01-21Replace slot[] constants with SLOT_blah, fix some that weren't displaying right.Rob Landley
Make fallback sort do string sort after numeric tie, retain absolute uptime even though relative is needed for %CPU (hence utime2).
2016-01-20Correct units of %MEM and %VSZ.Rob Landley
2016-01-20Add basic top support to ps.c, delete toys/pending/top.c.Rob Landley
While I'm there, pack the ps help text, break out TOP_COMMON (todo: update config2help to collate that properly), add -o CPU showing which processor this pid is running on, implement -o C (it's %cpu without the fractional part), add -o %MEM, fix header padding.
2016-01-18Implement pgrep -clv (and remove some accidentally checked in debug code).Rob Landley
Still need to do -n and -o.
2016-01-18Implement basic pkill plumbing, and fix FORCE_FLAGS on flag context switch.Rob Landley
2016-01-17Extend utf8 fontmetrics so ps can use them.Rob Landley
Also, I forgot to check in uuid_show() last time.
2016-01-15Command line files without paths were attempting to use stdin as their dirfd,Rob Landley
(because ls uses nonstandard directory recursion which collates all the command line arguments under a fake top node, which needs more thorough initialization).
2016-01-15Fix sort -f, add tests, make TEST_HOST pass new tests.Rob Landley
2016-01-14Implement most of pgrep and pkill.Rob Landley
Needs testing and a few more options connected up.
2016-01-14Make "find -execdir toys echo {} +" batch correctly and show topdir results.Rob Landley
I dunno if find -execdir should show depth-first like it's doing, bit given that ubuntu's treating "+" and ";" the same for execdir... eh? Also, testing "find toys tests -mindepth 2 -execdir echo {} +" against the toybox source is easy (and why if (revert) fchdir() is needed), but adding that to the test suite means making a nontrivial hierarchy of files to test against (don't wanna use the project source because it's expected to change in ways that would break the tests)... The old "real world data vs test data" problem.
2016-01-10Fix tail -f /does/not/exist.Elliott Hughes
Exit immediately if we don't actually have anything to -f --- it's -f's big brother -F that retries by name rather than by fd.
2016-01-10Make cursor left/right change sort type in iotop.Rob Landley
2016-01-08The sense of -L was flipped.Elliott Hughes
2016-01-05Add error_msg_raw() and friends, replace error_msg("%s", s) uses, enable formatRob Landley
checking, and fix up format checking complaints. Added out(type, value) function to stat to avoid a zillion printf typecasts.
2016-01-05Work towards making "find . -execdir echo {} + -execdir ls {} +" work,Rob Landley
(not finished yet) plus some error message improvements.
2016-01-02Fix find --prune.Rob Landley
2016-01-02Fix "find . -exec echo {}" segfault, and stop measuring environment space,Rob Landley
The segfault was spotted/fixed by Daniel K. Levy back in September, and again by Isabella Parakiss yesterday. While we're there, remove the environment size measurement code (the 128k limit was lifted by linux commit b6a2fea39318, which went into 2.6.22 released July 2007).
2016-01-01First pass at iotop.Rob Landley
Lotsa TODOs: Currently exit it with ctrl-c, not q. Doesn't show totals, PID instead ofTID, PR instead of PRIO (type/pri), human_readable can't display fixed point, IO isn't a percentage, COMM instead of COMMAND (so no [kernelthread] brackets), and no cursor left/right to change sort field...
2015-12-30First half of iotop. Add READ, WRITE, IO, DREAD, DWRITE, SWAP, DIO, andRob Landley
corresponding percentile fields to ps. Move FLAG_ macro usage to ps-specific code (top/iotop have their own flag contexts). Split init and match code into shared and ps-specific parts. Fix bug in COMMAND for privileged processes.