Age | Commit message (Collapse) | Author |
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
bb_dump_dump 1497 1523 +26
xxd_main 459 466 +7
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 33/0) Total: 33 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
recursive_action1 - 316 +316
file_action_grep 161 164 +3
add_to_prg_cache_if_socket 202 205 +3
depmod_main 509 511 +2
writeFileToTarball 488 489 +1
parse_module 281 282 +1
fileAction 207 208 +1
act 189 190 +1
add_to_dirlist 65 64 -1
writeTarFile 196 194 -2
uuidcache_init 47 45 -2
uuidcache_check_device 109 107 -2
true_action 8 6 -2
run_parts_main 310 308 -2
netstat_main 534 532 -2
lsusb_main 29 27 -2
lspci_main 45 43 -2
initial_scan 138 136 -2
grep_main 845 843 -2
find_main 482 480 -2
config_file_action 437 435 -2
chmod_main 142 140 -2
dirAction 14 10 -4
diff_main 1544 1540 -4
chown_main 154 148 -6
skip_dir 136 129 -7
dir_act 191 184 -7
recursive_action 453 69 -384
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 7/20 up/down: 328/-439) Total: -111 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Savings on musl:
function old new delta
resume_main 582 614 +32
lbb_prepare - 20 +20
seq_main 432 449 +17
fgetsetversion 74 88 +14
...
script_main 1207 1180 -27
close_silently 28 - -28
shell_builtin_ulimit 655 626 -29
lineedit_read_key 280 247 -33
------------------------------------------------------------------------------
(add/remove: 2/1 grow/shrink: 25/123 up/down: 182/-882) Total: -700 bytes
text data bss dec hex filename
1005858 551 5676 1012085 f7175 busybox_old
1005136 551 5680 1011367 f6ea7 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Starting with linux kernel v5.4 squashfs has a more strict parameter
checking implemented. Unlike util-linux mount, busybox never supported
the sizelimit option but simply forwards it to the kernel.
Since v5.4 mounting will fail with
squashfs: Unknown parameter 'sizelimit'
Support the sizelimit parameter by setting it in the LOOP_SET_STATUS64
structure before handing it to the kernel.
While at it also add support for the offset option, which currently will
always be set to 0.
function old new delta
cut_out_ull_opt - 167 +167
singlemount 1230 1266 +36
set_loop 834 862 +28
losetup_main 479 483 +4
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 3/0 up/down: 235/0) Total: 235 bytes
Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
resolve_peer_hostname 129 196 +67
recv_and_process_peer_pkt 2475 2476 +1
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 68/0) Total: 68 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
complete_cmd_dir_file 678 830 +152
get_builtin_name - 35 +35
optschanged 125 132 +7
hush_main 1069 1076 +7
save_command_ps_at_cur_history 76 78 +2
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 4/0 up/down: 203/0) Total: 203 bytes
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
This is *much* better (9 kbytes better) than dropping "*const"
optimization trick.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Back in 2007, commit 0c97c9d43707 ("'simple' error message functions by
Loic Grenie") introduced bb_simple_perror_msg() to allow for a lower
overhead call to bb_perror_msg() when only a string was being printed
with no parameters. This saves space for some CPU architectures because
it avoids the overhead of a call to a variadic function. However there
has never been a simple version of bb_error_msg(), and since 2007 many
new calls to bb_perror_msg() have been added that only take a single
parameter and so could have been using bb_simple_perror_message().
This changeset introduces 'simple' versions of bb_info_msg(),
bb_error_msg(), bb_error_msg_and_die(), bb_herror_msg() and
bb_herror_msg_and_die(), and replaces all calls that only take a
single parameter, or use something like ("%s", arg), with calls to the
corresponding 'simple' version.
Since it is likely that single parameter calls to the variadic functions
may be accidentally reintroduced in the future a new debugging config
option WARN_SIMPLE_MSG has been introduced. This uses some macro magic
which will cause any such calls to generate a warning, but this is
turned off by default to avoid use of the unpleasant macros in normal
circumstances.
This is a large changeset due to the number of calls that have been
replaced. The only files that contain changes other than simple
substitution of function calls are libbb.h, libbb/herror_msg.c,
libbb/verror_msg.c and libbb/xfuncs_printf.c. In miscutils/devfsd.c,
networking/udhcp/common.h and util-linux/mdev.c additonal macros have
been added for logging so that single parameter and multiple parameter
logging variants exist.
The amount of space saved varies considerably by architecture, and was
found to be as follows (for 'defconfig' using GCC 7.4):
Arm: -92 bytes
MIPS: -52 bytes
PPC: -1836 bytes
x86_64: -938 bytes
Note that for the MIPS architecture only an exception had to be made
disabling the 'simple' calls for 'udhcp' (in networking/udhcp/common.h)
because it made these files larger on MIPS.
Signed-off-by: James Byrne <james.byrne@origamienergy.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
get_free_loop - 58 +58
set_loop 597 649 +52
losetup_main 482 476 -6
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/1 up/down: 110/-6) Total: 104 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
create_and_bind_to_netlink - 134 +134
ifplugd_main 1117 1052 -65
uevent_main 399 306 -93
mdev_main 314 215 -99
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/3 up/down: 134/-257) Total: -123 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Add -P option from util-linux losetup to scan for partitions.
function old new delta
losetup_main 449 482 +33
packed_usage 33264 33292 +28
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 61/0) Total: 61 bytes
Signed-off-by: Jack O'Sullivan <jackos1998@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
xmalloc_read_with_initial_buf - 205 +205
setup_transformer_on_fd 154 150 -4
xmalloc_open_zipped_read_close 143 135 -8
xmalloc_read 201 10 -191
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/3 up/down: 205/-203) Total: 2 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Between Busybox 1.24.2 and 1.25.0 the bb_info_msg() function was
eliminated and calls to it changed to be bb_error_msg(). The downside of
this is that daemons now log all messages to syslog at the LOG_ERR level
which makes it hard to filter errors from informational messages.
This change optionally re-introduces bb_info_msg(), controlled by a new
option FEATURE_SYSLOG_INFO, restores all the calls to bb_info_msg() that
were removed (only in applets that set logmode to LOGMODE_SYSLOG or
LOGMODE_BOTH), and also changes informational messages in ifplugd and
ntpd.
The code size change of this is as follows (using 'defconfig' on x86_64
with gcc 7.3.0-27ubuntu1~18.04)
function old new delta
bb_info_msg - 182 +182
bb_vinfo_msg - 27 +27
static.log7 194 198 +4
log8 190 191 +1
log5 190 191 +1
crondlog 45 - -45
------------------------------------------------------------------------------
(add/remove: 2/1 grow/shrink: 3/0 up/down: 215/-45) Total: 170 bytes
If you don't care about everything being logged at LOG_ERR level
then when FEATURE_SYSLOG_INFO is disabled Busybox actually gets smaller:
function old new delta
static.log7 194 200 +6
log8 190 193 +3
log5 190 193 +3
syslog_level 1 - -1
bb_verror_msg 583 581 -2
crondlog 45 - -45
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 3/1 up/down: 12/-48) Total: -36 bytes
Signed-off-by: James Byrne <james.byrne@origamienergy.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Building with individual binaries enabled fails when embedded
script applets are included:
/tmp/ccIvMFZg.o: In function `main':
applet.c:(.text.main+0x20): undefined reference to `scripted_main'
Mark scripted_main() as externally visible.
Reported-by: Yann E. MORIN <yann.morin.1998@free.fr>
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
text data bss dec hex filename
981737 485 7296 989518 f194e busybox_old
981704 485 7296 989485 f192d busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
watch_main 212 232 +20
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
This removes DAEMON_DOUBLE_FORK flag from bb_daemonize_or_rexec(),
as SSD was the only user.
Also includes fix for -S: now works without -a and -x,
does not print pids
(compat with "start-stop-daemon (OpenRC) 0.34.11 (Gentoo Linux)").
function old new delta
start_stop_daemon_main 1018 1084 +66
add_interface 99 103 +4
fail_hunk 139 136 -3
bb_daemonize_or_rexec 205 183 -22
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/2 up/down: 70/-25) Total: 45 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
sigprocmask2 - 8 +8
wait_for_child_or_signal 213 218 +5
dowait 424 429 +5
block_CHLD_HUP_ALRM 62 59 -3
sigprocmask_SIG_SETMASK 16 - -16
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 2/1 up/down: 18/-19) Total: -1 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
sigprocmask_SIG_SETMASK - 16 +16
wait_for_child_or_signal 221 213 -8
dowait 432 424 -8
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
$ cat -n does_not_exist; echo $?
cat: does_not_exist: No such file or directory
1
function old new delta
print_numbered_lines 118 129 +11
nl_main 196 201 +5
cat_main 421 425 +4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 20/0) Total: 20 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Embedded scripts require a shell to be present in the BusyBox
binary. Allow either ash or hush to be used for this purpose.
If both are enabled ash takes precedence.
The size of the binary is unchanged in the default configuration:
both ash and hush are present but support for embedded scripts
isn't compiled into hush.
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
- Force a rebuild if a script in applets_sh is changed.
- Move the dummy usage messages for custom applets to usage.h and
change the name from 'dummy' to 'scripted'.
- Hide an error from gen_build_files.sh if an embed directory exists
but is empty.
- Tidy up embedded_scripts script.
v2: Remove a couple of unnecessary tests in embedded_scripts, as
pointed out by Xabier Oneca.
Drop the stripping of comments.
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
xwrite_and_update_handshake_hash 81 80 -1
tls_handshake 1987 1957 -30
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
$ busybox wget URL 2>&1 | cat
Connecting to ....
install.iso 0% | | 2629k 0:02:05 ETA
install.iso 7% |** | 25.7M 0:00:23 ETA
install.iso 16% |***** | 54.1M 0:00:14 ETA
install.iso 20% |****** | 67.4M 0:00:15 ETA
install.iso 25% |******** | 81.0M 0:00:14 ETA
install.iso 30% |********* | 97.3M 0:00:13 ETA
install.iso 36% |*********** | 117M 0:00:12 ETA
install.iso 41% |************* | 134M 0:00:11 ETA
install.iso 47% |*************** | 152M 0:00:10 ETA
install.iso 54% |***************** | 176M 0:00:08 ETA
install.iso 61% |******************* | 200M 0:00:06 ETA
install.iso 66% |********************* | 215M 0:00:06 ETA
install.iso 71% |********************** | 231M 0:00:05 ETA
install.iso 75% |************************ | 244M 0:00:04 ETA
install.iso 79% |************************* | 257M 0:00:03 ETA
install.iso 84% |*************************** | 275M 0:00:02 ETA
install.iso 91% |***************************** | 297M 0:00:01 ETA
install.iso 99% |******************************* | 321M 0:00:00 ETA
install.iso 100% |********************************| 323M 0:00:00 ETA
<-- no empty line here
$
function old new delta
bb_progress_update 622 632 +10
progress_meter 152 158 +6
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 16/0) Total: 16 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
xwrite_encrypted 599 585 -14
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
xwrite_encrypted 209 605 +396
GHASH - 395 +395
aes_encrypt_1 - 382 +382
GMULT - 192 +192
tls_xread_record 489 659 +170
aes_encrypt_one_block - 65 +65
aesgcm_setkey - 58 +58
FlattenSzInBits - 52 +52
tls_handshake 1890 1941 +51
xwrite_and_update_handshake_hash 46 81 +35
xorbuf - 24 +24
aes_setkey - 16 +16
psRsaEncryptPub 413 421 +8
stty_main 1221 1227 +6
ssl_client_main 138 143 +5
next_token 841 845 +4
spawn_ssl_client 218 219 +1
volume_id_probe_hfs_hfsplus 564 563 -1
read_package_field 232 230 -2
i2cdetect_main 674 672 -2
fail_hunk 139 136 -3
parse_expr 891 883 -8
curve25519 802 793 -9
aes_cbc_decrypt 971 958 -13
xwrite_handshake_record 43 - -43
aes_cbc_encrypt 644 172 -472
------------------------------------------------------------------------------
(add/remove: 9/1 grow/shrink: 9/8 up/down: 1860/-553) Total: 1307 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
BusyBox has support for embedded shell scripts. Two types can be
distinguished: custom scripts and scripts implementing applets.
Custom scripts should be placed in the 'embed' directory at build
time. They are given a default applet configuration and appear
as applets to the user but no further configuration is possible.
Applet scripts are integrated with the BusyBox build system and
are intended to be used to ship standard applets that just happen
to be implemented as scripts. They can be configured at build time
and appear just like native applets.
Such scripts should be placed in the 'applets_sh' directory. A stub
C program should be written to provide the usual applet configuration
details and placed in a suitable subsystem directory. It may be
helpful to have a configuration option to enable any dependencies the
script requires: see the 'nologin' applet for an example.
function old new delta
scripted_main - 41 +41
applet_names 2773 2781 +8
applet_main 1600 1604 +4
i2cdetect_main 672 674 +2
applet_suid 100 101 +1
applet_install_loc 200 201 +1
applet_flags 100 101 +1
packed_usage 33180 33179 -1
tryexec 159 152 -7
evalcommand 1661 1653 -8
script_names 9 - -9
packed_scripts 123 114 -9
complete_cmd_dir_file 826 811 -15
shellexec 271 254 -17
find_command 1007 990 -17
busybox_main 642 624 -18
run_applet_and_exit 100 78 -22
find_script_by_name 51 - -51
------------------------------------------------------------------------------
(add/remove: 1/2 grow/shrink: 6/9 up/down: 58/-174) Total: -116 bytes
text data bss dec hex filename
950034 477 7296 957807 e9d6f busybox_old
949918 477 7296 957691 e9cfb busybox_unstripped
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Similar code to unpack embedded data is used to decompress usage
messages, embedded scripts and the config file (in the non-default
bbconfig applet).
Moving this code to a common function reduces the size of the default
build and hides more of the internals of libarchive.
function old new delta
unpack_bz2_data - 135 +135
bb_show_usage 137 157 +20
get_script_content 32 47 +15
unpack_scripts 119 - -119
unpack_usage_messages 124 - -124
------------------------------------------------------------------------------
(add/remove: 1/2 grow/shrink: 2/0 up/down: 170/-243) Total: -73 bytes
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
find_script_by_name - 51 +51
shellexec 254 271 +17
find_command 990 1007 +17
evalcommand 1653 1661 +8
doCommands 2233 2222 -11
run_applet_and_exit 128 100 -28
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 6/4 up/down: 104/-52) Total: 52 bytes
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
To assist in the deployment of shell scripts it may be convenient
to embed them in the BusyBox binary.
'Embed scripts in the binary' takes any files in the directory
'embed', concatenates them with null separators, compresses them
and embeds them in the binary.
When scripts are embedded in the binary, scripts can be run as
'busybox SCRIPT [ARGS]' or by usual (sym)link mechanism.
embed/nologin is provided as an example.
function old new delta
packed_scripts - 123 +123
unpack_scripts - 87 +87
ash_main 1103 1171 +68
run_applet_and_exit 78 128 +50
get_script_content - 32 +32
script_names - 10 +10
expmeta 663 659 -4
------------------------------------------------------------------------------
(add/remove: 4/0 grow/shrink: 2/1 up/down: 370/-4) Total: 366 bytes
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
unzip_main 2726 2792 +66
printable_string2 - 57 +57
identify 4329 4336 +7
expmeta 659 663 +4
add_interface 99 103 +4
beep_main 286 289 +3
changepath 192 194 +2
builtin_type 115 117 +2
devmem_main 469 470 +1
input_tab 1076 1074 -2
create_J 1821 1819 -2
poplocalvars 314 311 -3
doCommands 2222 2214 -8
do_load 918 902 -16
printable_string 57 9 -48
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 8/6 up/down: 146/-79) Total: 67 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
parse_duration_str - 168 +168
sleep_for_duration - 157 +157
top_main 885 928 +43
timeout_main 269 312 +43
handle_input 571 614 +43
duration_suffixes - 40 +40
sfx 40 - -40
sleep_main 364 79 -285
------------------------------------------------------------------------------
(add/remove: 4/1 grow/shrink: 3/1 up/down: 494/-325) Total: 169 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
cp_main 428 512 +84
copy_file 1676 1742 +66
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
xmalloc_realpath_coreutils - 121 +121
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
create_or_remember_link - 106 +106
create_links_from_list - 93 +93
find_applet_by_name 124 128 +4
unzip_main 2724 2726 +2
data_extract_all 891 873 -18
create_symlinks_from_list 64 - -64
create_or_remember_symlink 94 - -94
------------------------------------------------------------------------------
(add/remove: 2/2 grow/shrink: 2/1 up/down: 205/-176) Total: 29 bytes
Signed-off-by: Harald van Dijk <harald@gigawatt.nl>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
avoided
In practice, "wget http://host.com/" always uses port 80.
People explicitly set non-standard ports via options or parameters
("telnet 1.2.3.4 567" or "telnet 1.2.3.4 ftp") instead of modifying
/etc/services.
function old new delta
telnet_main 1466 1464 -2
rdate_main 215 198 -17
fakeidentd_main 269 252 -17
parse_url 459 392 -67
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/4 up/down: 0/-103) Total: -103 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Testcase: (sleep 10; ls) | busybox less
[...]
~ LICENSE
~ Makefile
~ Makefile.custom
~ Makefile.flags
[...]
less did not want this part:
+ /* dont convert NL to CR+NL on output */
+ newterm->c_oflag &= ~(ONLCR);
function old new delta
get_termios_and_make_raw 108 115 +7
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
static.ar_long_names 4 - -4
static.ar_long_name_size 4 - -4
get_header_ar 546 532 -14
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 0/1 up/down: 0/-22) Total: -22 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
As it turns out, longjmp'ing into freed stack is not healthy...
function old new delta
unpack_usage_messages - 97 +97
unpack_bz2_stream 369 409 +40
get_next_block 1667 1677 +10
get_bits 156 155 -1
start_bunzip 212 183 -29
bb_show_usage 181 120 -61
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 2/3 up/down: 147/-91) Total: 56 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|