Age | Commit message (Collapse) | Author |
|
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
rtnl_send_check - 160 +160
xrtnl_wilddump_request 64 66 +2
ipneigh_list_or_flush 714 706 -8
rtnl_send 69 - -69
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 1/1 up/down: 162/-77) Total: 85 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
parse_rtattr() was using tb[] array without initializing it.
Based on patch by Balaji Punnuru <balaji_punnuru@cable.comcast.com>
function old new delta
parse_rtattr 85 107 +22
print_route 1630 1617 -13
print_linkinfo 807 794 -13
iproute_get 835 822 -13
print_rule 680 665 -15
ll_remember_index 263 248 -15
print_addrinfo 1223 1197 -26
ipaddr_list_or_flush 1253 1223 -30
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/7 up/down: 22/-125) Total: -103 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
The result of looking at "grep -F -B2 '*fill*' busybox_unstripped.map"
text data bss dec hex filename
829901 4086 1904 835891 cc133 busybox_before
829665 4086 1904 835655 cc047 busybox
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
The config item is FEATURE_USE_BSS_TAIL. When it is off (default):
function old new delta
read_config 210 228 +18
doCommands 2279 2294 +15
ipneigh_list_or_flush 763 772 +9
ipaddr_list_or_flush 1256 1261 +5
display_process_list 1301 1306 +5
conspy_main 1378 1383 +5
do_lzo_compress 352 355 +3
do_lzo_decompress 565 567 +2
push 46 44 -2
inetd_main 2136 2134 -2
uevent_main 421 418 -3
addLines 97 92 -5
bb_common_bufsiz1 8193 1024 -7169
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 8/5 up/down: 62/-7181) Total: -7119 bytes
text data bss dec hex filename
829850 4086 9080 843016 cdd08 busybox_old
829901 4086 1904 835891 cc133 busybox_unstripped
FEATURE_USE_BSS_TAIL=y:
read_config 210 228 +18
doCommands 2279 2294 +15
ipneigh_list_or_flush 763 772 +9
ipaddr_list_or_flush 1256 1261 +5
display_process_list 1301 1306 +5
conspy_main 1378 1383 +5
do_lzo_compress 352 355 +3
do_lzo_decompress 565 567 +2
inetd_main 2136 2134 -2
bb_common_bufsiz1 8193 - -8193
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 8/1 up/down: 62/-8195) Total: -8133 bytes
text data bss dec hex filename
829850 4086 9080 843016 cdd08 busybox_old
829911 4086 880 834877 cbd3d busybox_unstripped
FIXME: setup_common_bufsiz() calls are missing.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
rt_addr_n2a 56 53 -3
print_addrinfo 1227 1178 -49
print_neigh 933 881 -52
print_rule 689 617 -72
print_tunnel 640 560 -80
print_route 1727 1588 -139
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/6 up/down: 0/-395) Total: -395 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
invarg(a,b) - "invalid argument", but how a and b enter the message?
invarg_1_to_2(a,b) is somewhat easier to read: "invalid argument 'a' to 'b'"
Audit of usage revealed a number of bad uses, with too long messages.
text data bss dec hex filename
938848 932 17448 957228 e9b2c busybox_old
938788 932 17448 957168 e9af0 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
This patch ports the 'ip neigh' command, originally written by Alexey
Kuznetsov, <kuznet@ms2.inr.ac.ru>, to busybox.
The base of the port is the version of iproute that shipped with
Debian Squeeze, taken from:
http://http.debian.net/debian/pool/main/i/iproute/iproute_20100519.orig.tar.gz
This patch has actively been used by the Open Network Install
Environment (ONIE) project for over 3 years without incident.
function old new delta
print_neigh - 933 +933
ipneigh_list_or_flush - 742 +742
get_hz - 109 +109
do_ipneigh - 62 +62
do_iproute 2112 2153 +41
packed_usage 30647 30667 +20
ipneigh_main - 14 +14
static.ip_neigh_commands - 12 +12
static.nuds - 9 +9
static.ip_func_ptrs 32 36 +4
print_route 1858 1727 -131
------------------------------------------------------------------------------
(add/remove: 8/0 grow/shrink: 3/1 up/down: 1946/-131) Total: 1815 bytes
Signed-off-by: Curt Brune <curt@cumulusnetworks.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|