This was Bernhard Fischer' idea.
text data bss dec hex filename
773549 7781 9740 791070 c121e busybox.t7/0_lib/libbusybox.so.1.11.0.svn_unstripped
769683 7397 9740 786820 c0184 busybox.t9t/0_lib/libbusybox.so.1.11.0.svn_unstripped
just build relevant source and use xxx_main functions.
build system: add a special case when we have exactly one applet enabled
(makes "true", "false", "basename" REALLY tiny).
getopt32: do not use stdio.
function old new delta
getopt32 1385 1412 +27
make_device 1187 1200 +13
basename_main 120 127 +7
tcpudpsvd_main 1922 1926 +4
testcmd 5 - -5
echocmd 5 - -5
fuser_main 1243 1231 -12
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 4/1 up/down: 51/-22) Total: 29 bytes
Should be a big win for libbusybox. busybox wins too:
text data bss dec hex filename
776524 929 9100 786553 c0079 busybox_old
775903 929 9100 785932 bfe0c busybox_unstripped
FEATURE_SH_STANDALONE_SHELL => FEATURE_SH_STANDALONE
FEATURE_EXEC_PREFER_APPLETS => FEATURE_PREFER_APPLETS
Make SH_STANDALONE depend on PREFER_APPLETS.
getopt.c: more randomconfig-induced fixes
and now this fact is recorded in applets.h, not ash.c.
Several fixes to "--help + STANDALONE_SHELL" scenarios.
function old new delta
run_current_applet_and_exit - 355 +355
arith 2064 2073 +9
refresh 1148 1156 +8
getopt32 1068 1073 +5
telnet_main 1510 1514 +4
md5_sha1_sum_main 565 566 +1
xstrtoul_range_sfx 255 251 -4
packed_usage 22523 22514 -9
tryexec 255 203 -52
static.safe_applets 152 - -152
.rodata 131320 131128 -192
run_applet_by_name 869 506 -363
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 5/5 up/down: 382/-772) Total: -390 bytes
./busybox ash -c 'i=20000; while test $i != 0; do touch z; i=$((i-1)); done'
runs more than twice as fast with STANDALONE_SHELL versus without.
can figure out what header files to include, and override stuff that comes
later. But applets shouldn't include platform.h directly, they should include
busybox.h or libbb.h. Since busybox.h already includes libbb.h, move libbb.h
to the top of busybox.h and platform.h near the top of libbb.h (right after
bbconfig.h, which is something platform.h also needs access to).
While we're at it, move some stuff from busybox.h to libbb.h so we have one
big file to audit/clean up/try to make sense of instead of many.
- add ATTRIBUTE_ALWAYS_INLINE, endian handling for DEC UNIX, some more
compiler dependent defines to platform.h
- add conditional bb_setpgrp define to platform.h
- remove superfluous specifying args from "#define fdprintf dprintf"
Rob Landley, and others.
Currently CONFIG options are defined or undefined, so we chop out code with
#ifdefs, ala:
#ifdef CONFIG_THING
stuff();
#endif
This creates a new header file, bb_config.h, which sets the CONFIG entry to 1
or 0, and lets us do:
if(CONFIG_THING) stuff();
And let the compiler do dead code elimination to get rid of it. (Note: #ifdef
will still work because for the 1 case it's a static const int, not a #define.)
1) tinylogin like with compile time selection and a chown root.root
2) Runtime configurable via /etc/busybox.conf (docu is in the works)
[Parts of this patch may overlap with my other two patches]