aboutsummaryrefslogtreecommitdiff
path: root/toys.h
AgeCommit message (Collapse)Author
2018-11-30macOS: work around header idiosyncracies.Elliott Hughes
2018-03-23Inline toys/e2fs.h into mke2fs.c. (Debris from the dawn of time.)Rob Landley
2017-10-21Use char for exitval and wasroot (first capped at 8 bits and second's a flag).Rob Landley
2016-03-13Split out _xexit() from xexit() and give sigatexit() multiple callbacks.Rob Landley
2016-02-10Wean scripts/install.c off toys.h so cross compiling less brittle.Rob Landley
2016-01-30Fix two CFG_TOYBOX_SUID corner cases:Rob Landley
1) Don't try to force re-exec unless we actually dropped permissions. (Fixes "./toybox mount" when no suid bit on toybox binary, which previously exited.) 2) Set temporary toys.which value for error reporting. (Fixes "ln -s toybox mount && ./mount" with CFG_TOYBOX_DEBUG and no suid bit, which previously segfaulted.)
2015-12-13Start of TAGGED_ARRAY() infrastructure.Rob Landley
This lets you have struct arrays with a string as the first member, ala: struct {char *name; int x, y} blah thingy[] = TAGGED_ARRAY(BLAH, {"one", 1, 2}, {"two", 3, 4}, {"three", 5, 6} ); And it produces #defines for the array index of each, ala: #define BLAH_one 0 #define BLAH_two 1 #define BLAH_three 2 So you can use thingy[BLAH_two].x and still reorder the elements at will. Note: if you screw up the array initializers, temporarily replace TAGGED_ARRAY(BLAH, with { and the ); with }; and the compiler will give you better error messages. (With the macro the compiler reports errors on the TAGGED_ARRAY line, not where the comma is missing in its contents.) Currently the TAGGED_ARRAY( and ); must be on their own lines, and the { and start of each attached string must be on the same line.
2015-12-12Make "ps -o TIME+ -k TIME+" work. Factor out -o field names, field lengths,Rob Landley
and slot numers into a structure. (Keeping multiple arrays in sync may have been efficient but it was ugly.) Fix duplicate command name copying that corrupted the name of kernel threads. Tighten up slot[] docs.
2015-12-10Expand toys.optargs to 64 bits so people adding more options to ls don't run ↵Rob Landley
out. Keep the low 32 bits of FLAG_x constants as 32 bit numbers so that at least on little endian platforms it's still normal 32 bit math outside of lib/args.c.
2015-09-29Make defconfig build for nommu.Rob Landley
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.
2015-09-27Another chunk of nommu support, replacing toys.recursion with toys.stacktop.Rob Landley
2015-09-11Replace toys.exithelp with help_exit() in lib.Rob Landley
2015-05-18Switch id over to new infrastructure, switch id to use FORCE_FLAGS, andRob Landley
make lib/lsm.h auto-include from toys.h.
2015-05-03Move a prototype to the start of portability.h (suggested by Elliott Hughes)Rob Landley
2015-01-16Move pty.h back to toys.h (under LSB 4.1 headers).Rob Landley
2014-12-31Redo option parsing infrastructure so #define FORCE_FLAGS can unzero flag ↵Rob Landley
macros for a disabled command (needed when multiple commands share infrastructure with a common set of flags). This means the flag space is no longer packed, but leaves gaps where the zeroes go. (Actual flag bit positions are the same for all configs.) Since the option parsing needs to know where the holes are, the OPTSTR values are now generated as part of flags.h with ascii 1 values for the disabled values. (So generated/oldflags.h went away.) This also means that the option string argument for OLDTOY() went away, it now uses the same arguments as the NEWTOY() it references.
2014-12-31When you include the posix header libgen.h, glibc #defines basename to some ↵Rob Landley
random other symbol name (because gnu) and this screws up nontrivial macro expansions of NEWTOY(basename), so work around it in portability.h.
2014-11-19probe for getspnam(), forkpty(), utmpx, replace sethostname()Isaac Dunham
Android is missing all of these; we need to probe for some so we have a config symbol to depend on. sethostname() is easily replaced. We got termios.h via pty.h; now it's not included in configure-step tools, so we need termios.h to generate globals.
2014-10-26xexec() recursion limiter has to go after rebound or toy_init() zeroes it.Rob Landley
2014-09-27Have OLDTOY emit (redundant) function prototype so single.sh can build ↵Rob Landley
OLDTOY standalone (if it has its own config symbol).
2014-09-09Two problems: 1) Sometimes toy_exec() needs to re-exec to gain dropped root ↵Rob Landley
permissions, 2) shouldn't recurse forever without exec, stack depth increases and we may leak other resources. Limit it to ~5 levels.
2014-06-09When locale is enabled, sprintf("%.123s", str) is counting characters, not ↵Rob Landley
bytes, so we can't globally enable locale without opening stack/heap smashing vulnerabilities. Make commands individually request setlocale() using TOYFLAGS instead.
2014-05-21Add generic_signal() handler, which sets toys.signal and writes byte to ↵Rob Landley
toys.signalfd if set.
2014-05-05Fix bug reported by Ashwini Sharma: rebound has to be at the end or ↵Rob Landley
toy_init() doesn't zero the rest of the struct.
2014-04-09modprobe: cleanup, incorporate Ashwini's fix for alias loadingIsaac Dunham
Move <fnmatch.h> to toys.h, since it's POSIX. Avoid duplicating code in an if/else block. Terser error messages, spelling. Don't always print the state.
2014-03-29Group headers by standard (POSIX or LSB) or function (internationalization, ↵Rob Landley
networking). Move headers standards ignore (but which have been there >15 years) to lib/portability.h. Fold xregcomp into lib since it's posix.
2014-03-28Add help -a (to show all commands) and -h (to produce HTML output).Rob Landley
2013-11-02Merge toynet.h into toys.h: musl supports it and micromanaging uClibc config ↵Rob Landley
options isn't very interesting anymore.
2013-10-03Switch flag generation from shell to C.Rob Landley
This should actually generate FLAG_longopt 0 #defines for disabled bare longopts (ala ls without --color). Put temporary executables under "generated" (including instlist for install).
2013-09-03Introduce libbuf analogous to toybuf but for use by lib/*.c. Change ↵Rob Landley
readfile() semantics to be able to read into an existing buffer, or malloc its own if that's NULL.
2013-08-17su: cleaneryStrake
* make help message more like others * s/TT\.(.)Argu/TT.\1/g * move environ to toys.h * simplify failure messages * clear password before quit * not check what execve returns * -lc
2013-08-15Forgot to check in toys.h when generated/oldtoys.h went in. (Oops.)Rob Landley
2013-04-21Fix some comments from way back when toybox first started (in 2006), when I ↵Rob Landley
was still cleaning busybox-isms out of my head...
2012-12-10Add stat submission to new "pending" directory, along with infrastructure to ↵Rob Landley
support pending.
2012-12-01Add header that musl libc needs.Rob Landley
2012-11-26Cleanup i18n support (#ifdefectomy, move global init to process launch). ↵Rob Landley
Teach make.sh to emit "#define FLAG_x 0" for options inside disabled USE macros so we can unconditionally refer to them.
2012-11-21Make internalization support optionalFelix Janda
2012-11-16Add rebound support to intercept error_exit() and longjmp instead.Rob Landley
2012-11-13Reindent to two spaces per level. Remove vi: directives that haven't worked ↵Rob Landley
right in years (ubuntu broke its' vim implementation). Remove trailing spaces. Add/remove blank lines. Re-wordwrap in places. Update documentation with new coding style. The actual code should be the same afterward, this is just cosmetic refactoring.
2012-11-08wc -m only cares about counting characters. Attached is a try on ↵Felix Janda
implementing it and some test cases for it. The test cases are only for UTF-8 locales.
2012-10-08New build infrastructure to generate FLAG_ macros and TT alias, #define ↵Rob Landley
FOR_commandname before #including toys.h to trigger it. Rename DEFINE_GLOBALS() to just GLOBALS() (because I could never remember if it was DECLARE_GLOBALS). Convert existing commands to use new infrastructure, and replace optflag constants with FLAG_ macros where appropriate.
2012-08-14Replace TOY_LIST_LEN with more generic ARRAY_LEN()Rob Landley
2012-07-15Adding initial implementation of tasksetElie De Brauwer
2012-06-16More header fiddling: crypt.h is silly, SUSv4 requires crypt() to be ↵Rob Landley
prototyped in unistd.h. The fact glibc refuses to do so without a wacky #define is a glibc bug, treat it as such.
2012-04-28Georgi pointed out that some overly-pedantic C libraries require you to ↵Rob Landley
include both "string.h" and "strings.h". (Most don't.)
2012-04-24Adding initial version of login.cElie De Brauwer
2012-04-14Comment and whitespace changes.Rob Landley
2012-03-12Yet another header for technical susv4 compliance.Rob Landley
2012-03-07Consolidate headers.Rob Landley
2012-02-18Adding swapon and swapoffElie De Brauwer