aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2017-01-11ash: 16-bit ->nprocs field is a pain for many CPUsDenys Vlasenko
function old new delta getoptscmd 527 540 +13 getjob 280 286 +6 makejob 278 282 +4 forkchild 602 600 -2 waitcmd 208 205 -3 showjob 382 379 -3 getstatus 83 80 -3 dowait 408 405 -3 freejob 93 89 -4 fg_bgcmd 290 286 -4 forkshell 260 255 -5 killcmd 224 218 -6 jobno 17 11 -6 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/10 up/down: 23/-39) Total: -16 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-11Move FEATURE_AUTOWIDTH config option to two applets which use itDenys Vlasenko
No code changes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-11Move FEATURE_USE_TERMIOS config option to two applets which use itDenys Vlasenko
No code changes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-11libbb: consolidate the code to set termios unbuffered modeDenys Vlasenko
function old new delta set_termios_to_raw - 116 +116 count_lines 72 74 +2 powertop_main 1458 1430 -28 top_main 943 914 -29 more_main 759 714 -45 fsck_minix_main 2969 2921 -48 conspy_main 1197 1135 -62 rawmode 99 36 -63 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 1/6 up/down: 118/-275) Total: -157 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-11hush: reinstate [[ builtinDenys Vlasenko
Mike deleted it: commit 39456a18a104b228de240b265bd943251219849d Author: Mike Frysinger <vapier@gentoo.org> Date: Sat Mar 28 12:21:57 2009 +0000 stop lying about [[ test support probably because it was not properly ifdefed around, and was enabled even when bash compat is off. I just tested it - it works: $ [ *.diff = z.diff ]; echo $? 0 $ [[ *.diff = z.diff ]]; echo $? 1 Of course, not all numerous bash tricks of [[ ]] are implemented... function old new delta bltins2 60 72 +12 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-11hush: split bash compatible extensions into separate defines. No code changesKang-Che Sung
Splitting these options makes it self-documenting about what bash-compatible features we have. Signed-off-by: Kang-Che Sung <explorer09@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-11ash: split bash compatible extensions into separate defines. No code changesDenys Vlasenko
Splitting these options makes it self-documenting about what bash-compatible features we have. Signed-off-by: Kang-Che Sung <explorer09@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-11busybox: stop depending on FEATURE_AUTOWIDTH for applet listDenys Vlasenko
Many other appletw don't - they unconditionally use get_terminal_wodth(), and here the amount of code saved by FEATURE_AUTOWIDTH=n is tiny. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-11top: FEATURE_USE_TERMIOS shouldn't control reading of screen sizeDenys Vlasenko
It controls whether we take input. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-11more: hardcode FEATURE_USE_TERMIOS=y in this applet; code shrinkDenys Vlasenko
function old new delta get_wh - 27 +27 tcsetattr_tty_TCSANOW - 18 +18 gotsig 35 27 -8 more_main 835 759 -76 ------------------------------------------------------------------------------ (add/remove: 2/0 grow/shrink: 0/2 up/down: 45/-84) Total: -39 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-10hush: shorten output of "help" builtinDenys Vlasenko
text data bss dec hex filename 891272 485 6856 898613 db635 busybox_old 891232 485 6856 898573 db60d busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-10hush: reorder builtins (cd and pwd ought to be close, etc), no code changesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-10init: rename FEATURE_EXTRA_QUIET -> FEATURE_INIT_QUIETDenys Vlasenko
The former name had no INIT anywhere in its name, sounded generic Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-10ash: revert "make dot command search current directory first"Denys Vlasenko
Reverts this: commit 8ad78e1ec7b2e873953f9f476fb63b5893526c39 Author: Denis Vlasenko <vda.linux@googlemail.com> Date: Sun Feb 15 12:40:30 2009 +0000 ash: make dot command search current directory first, as bash does. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-10shells: make hush test optional, rename ASH_BUILTIN_foo -> ASH_fooDenys Vlasenko
This makes hash and ash more symmetrical wrt config menu and config options. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-10Big cleanup in config help and descriptionDenys Vlasenko
Redundant help texts (one which only repeats the description) are deleted. Descriptions and help texts are trimmed. Some config options are moved, even across menus. No config option _names_ are changed. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-09Allow FAST_FUNC to be overridden at build timeKang-Che Sung
Busybox uses FAST_FUNC macro to tweak with IA-32 calling conventions in order to make the function call slightly smaller or slightly faster. However, when I experiment with GCC's LTO (Link Time Optimization), I discovered that FAST_FUNC could hinder LTO's optimization so that the resulting executable become a few bytes larger (than what is compiled without FAST_FUNC). This change allows to specify e.g. CONFIG_EXTRA_CFLAGS="-DFAST_FUNC= -flto" and compile with LTO without a source code hack. Signed-off-by: Kang-Che Sung <explorer09@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-09kill: optimizations for single-applet buildKang-Che Sung
* Fix a bug with a configuration in which the shell's kill builtin would be mistreated as a killall command (i.e. '-q' works, and 'kill process_name' succeeds when it shouldn't): CONFIG_ASH_JOB_CONTROL=y CONFIG_HUSH_KILL=y # CONFIG_KILL is not set CONFIG_KILLALL=y # CONFIG_KILLALL5 is not set * Optimize out unneeded code when the relevant applets are not selected. * Move kbuild lines about shells' kill builtins from Kbuild.src to kill.c, to accompany the new HAVE_SH_KILL macro. I hope this would make maintanence a little bit easier. Signed-off-by: Kang-Che Sung <explorer09@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-09hush: make echo builtin optionalDenys Vlasenko
It's a bit overkill (who would want it off?) but ash already has it configurable. Let's be symmetric. Also tweak kbuild logic to use ASH_BUILTIN_ECHO to select echo.o, not ASH. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-09kill: need not build kill.c when ash's job control is offKang-Che Sung
ash kill builtin depends on the job control config option. Signed-off-by: Kang-Che Sung <explorer09@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-09make_single_applets.sh: show errors and warningsDenys Vlasenko
While at it, fix one warning in modprobe-small.c Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-09unlzma: expand comments, no code changesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-09unlzma: fix erroneous "while" instead of "if". Closes 4682Denys Vlasenko
These parts of the code essentially check whether stepping back by rep0 goes negative or not. LZMA SDK from lzma1604.7z has the following in the corresponding places: ... = dic[dicPos - rep0 + (dicPos < rep0 ? dicBufSize : 0)] Clearly, not loop here. Technically, "while" here works: if condition is false (because pos underflowed), it iterates once, adds header.dict_size (a.k.a. dicBufSize), this makes pos positive but smaller than header.dict_size, and loop exits. Now we'll just check for negative result of subtraction, which is less code: function old new delta unpack_lzma_stream 2659 2641 -18 (I hope 2 Gbyte+ dictionaries won't be in use soon). Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-09unzip: match "Defl:?" display with info-zip; cosmetic code shufflingDenys Vlasenko
Large nested indented code blocks made more sane with a few gotos. function old new delta unzip_main 2491 2519 +28 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-09unzip: optional support for xzDenys Vlasenko
function old new delta unzip_main 2476 2491 +15 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-09unzip: optional support for bzip2 and lzmaDenys Vlasenko
function old new delta unzip_main 2376 2476 +100 bbunpack 750 745 -5 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-09modprobe-small: build fixesDenys Vlasenko
Was throwing some build errors: CONFIG_MODPROBE_SMALL=y CONFIG_DEPMOD=y CONFIG_LSMOD=y CONFIG_MODINFO=y CONFIG_FEATURE_MODPROBE_SMALL_CHECK_ALREADY_LOADED=y error: unused variable 'exitcode' modutils/modprobe-small.c: In function 'modprobe_main': modutils/modprobe-small.c:1060: error: control reaches end of non-void function Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-09modprobe-small: optimizations for single applet buildExplorer09
(I'm requesting for a review first because I fear such an aggressive change could lead to bugs. While I observe the sizes have reduced, I haven't test the functionality of each applet after that. So please test before merging.) Aggressively cut off unneeded code when the relevant applets are not built. Correct dependencies of FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE and FEATURE_MODPROBE_SMALL_CHECK_ALREADY_LOADED. Don't bother with the '-r' option check if only rmmod is built (assume true then), or when neither rmmod or mobprobe is built (assume false then). Size comparison before and after the change (single applet configuration): text data bss dec hex filename 34778 946 112 35836 8bfc old/busybox_DEPMOD 34151 946 112 35209 8989 new/busybox_DEPMOD 34903 946 112 35961 8c79 old/busybox_INSMOD 28316 778 112 29206 7216 new/busybox_INSMOD 35228 962 112 36302 8dce old/busybox_LSMOD 5011 706 40 5757 167d new/busybox_LSMOD 34830 946 112 35888 8c30 old/busybox_MODPROBE 34795 946 112 35853 8c0d new/busybox_MODPROBE 34718 946 112 35776 8bc0 old/busybox_RMMOD 7502 714 104 8320 2080 new/busybox_RMMOD Signed-off-by: Kang-Che Sung <explorer09@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-09Allow 'gzip -d' and 'bzip2 -d' without gunzip or bunzip2Kang-Che Sung
Idea copied from the "ip" applet. Signed-off-by: Kang-Che Sung <explorer09@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-09ash: fix a bug in argv restoration after sourcing a fileDenys Vlasenko
if sourced file "shift"ed argvs so that $1 is NULL, restore wasn't done. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-09hush: fix a bug in argv restoration after sourcing a fileDenys Vlasenko
if sourced file "shift"ed argvs so that $1 is NULL, restore wasn't done. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-09hush: global_args_malloced is used only if set builtin is enabledDenys Vlasenko
function old new delta run_pipe 1623 1635 +12 builtin_source 210 222 +12 save_and_replace_G_args 70 60 -10 builtin_shift 132 94 -38 restore_G_args 98 - -98 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 2/2 up/down: 24/-146) Total: -122 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-09hush: fix 'defined but not used' warningDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-09hush: remove redundand test for ENABLE_HUSH_JOBDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-09hush: fix kill builtin without jobs supportDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-09typo fixDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-08hush: conditionalize print_escaped() on EXPORT || TRAPDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-08hush: make memleak builtin optionalDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-08hush: make export builtin optionalDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-08hush: make umask builtin optionalDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-08hush: make set/unset builtins optionalDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-08hush: make read and trap builtins optionalDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-08hush: kill builtin and kill %jobspec supportDenys Vlasenko
Also made it and printf, type and wait builtins optional. function old new delta builtin_kill - 323 +323 bltins1 336 348 +12 builtin_type 114 116 +2 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 2/0 up/down: 337/0) Total: 337 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-08hush: support %%, %+ and % jobspec (meaning "current job")Denys Vlasenko
function old new delta parse_jobspec 83 133 +50 builtin_wait 278 283 +5 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-08httpd: fix address family for reverse proxy client socketLaurent Bercot
When httpd proxies a request to another server, it first creates an AF_INET socket, then resolves the server name to a sockaddr, then connects to it. This fails if the server name resolves to an IPv6 address. This patch ensures that the socket is created with the correct address family (AF_INET6 if the server resolves to an IPv6 address and AF_INET otherwise). Signed-off-by: Laurent Bercot <ska-dietlibc@skarnet.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-08build system: no longer prompt for PLATFORM_LINUX optionKang-Che Sung
With the new "select PLATFORM_LINUX" mechanism (commit e3b1a1fd28558f7a1b3c0ec33313bedb675be8a1), the PLATFORM_LINUX option alone no longer has any purpose of changing program behavior or affecting compiled code. So there is no longer need to prompt user of this config question. Signed-off-by: Kang-Che Sung <explorer09@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-08bunzip2: fix code bloat caused by zcat's seamless magicKang-Che Sung
This example single-applet configuration would trigger the bloat: CONFIG_FEATURE_SEAMLESS_XZ=y CONFIG_FEATURE_SEAMLESS_LZMA=y CONFIG_FEATURE_SEAMLESS_BZ2=y CONFIG_FEATURE_SEAMLESS_GZ=y CONFIG_BUNZIP2=y # CONFIG_ZCAT is not set # All other applets disabled Here, the resulting "busybox-bunzip2" binary would contain unpack_gz_stream, unpack_lzma_stream and unpack_xz_stream functions code. In other words, the gzip, lzma and xz decompressors' code are linked into the binary unnecessarily. This happens because SEAMLESS_MAGIC != 0 and compiler is unable to figure out that SEAMLESS_MAGIC bit is never set. Fix this by disabling SEAMLESS_MAGIC option flag (setting its value to 0) when zcat is disabled. This will help the compiler optimize out bbunpack() and no longer generate open_zipped() function call. Signed-off-by: Kang-Che Sung <explorer09@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-08ash: fix "kill %1" not working if CONFIG_ASH is disabledKang-Che Sung
ix ash "kill %1" not working if CONFIG_ASH is disabled but ash is launched by 'sh' or 'bash' name Signed-off-by: Kang-Che Sung <explorer09@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-08unzip: do not use CDF.extra_len, read local file header. Closes 9536Denys Vlasenko
While at it, shorten many field and variable names. function old new delta unzip_main 2334 2376 +42 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-07ash: fix open fds leaking in redirects. Closes 9561Denys Vlasenko
commit e19923f6652a638ac39c84012e97f52cf5a7568e deleted clearredir() call in shellexec(): ash: [REDIR] Remove redundant CLOEXEC calls Upstream commit: Now that we're marking file descriptors as CLOEXEC in savefd, we no longer need to close them on exec or in setinputfd. but it missed one place where we don't set CLOEXEC. Fixing this. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>