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>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Was (under X):
$ ./busybox_old kbd_mode
kbd_mode: ioctl 0x4b44 failed: Inappropriate ioctl for device
Now:
$ ./busybox kbd_mode
The keyboard is in off mode
function old new delta
kbd_mode_main 166 174 +8
packed_usage 31782 31764 -18
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 8/-18) Total: -10 bytes
text data bss dec hex filename
915757 485 6880 923122 e15f2 busybox_old
915747 485 6880 923112 e15e8 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
This change retains "or later" state! No licensing _changes_ here,
only form is adjusted (article, space between "GPL" and "v2" and so on).
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
xx) op
function old new delta
tcsetattr_stdin_TCSANOW - 14 +14
set_sane_term 116 113 -3
top_main 1277 1273 -4
make_new_session 421 415 -6
rawmode 133 126 -7
reset_term 18 10 -8
die 43 35 -8
cookmode 62 54 -8
vlock_main 425 415 -10
read_line_input 3165 3155 -10
bb_askpass 357 347 -10
fsck_minix_main 3079 3065 -14
getty_main 2375 2332 -43
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/12 up/down: 14/-131) Total: -117 bytes
|
|
get_console_fd_or_die().
function old new delta
get_console_fd_or_die - 163 +163
loadkmap_main 211 201 -10
loadfont_main 440 430 -10
dumpkmap_main 218 208 -10
kbd_mode_main 158 146 -12
setkeycodes_main 156 143 -13
get_console_fd 163 - -163
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 0/5 up/down: 163/-218) Total: -55 bytes
|
|
text data bss dec hex filename
808035 611 6868 815514 c719a busybox_old
804472 611 6868 811951 c63af busybox_unstripped
|
|
- Rewrite kbd_mode and setconsole
- Introduce and use console_make_active() and xopen_xwrite_close()
- honour buffer-reservation method as set by the user (dumpkmap, loadkmap)
- shrink rtcwake and some console-tools
Saves about 270 Bytes
|
|
kbd_mode_main - 189 +189
packed_usage 22745 22833 +88
applets 3132 3144 +12
static.opts 7 12 +5
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 3/0 up/down: 294/0) Total: 294 bytes
text data bss dec hex filename
777210 1000 9532 787742 c051e busybox_old
777575 1000 9532 788107 c068b busybox_unstripped
|
|
|
|
|
|
|
|
no preceding prototype
|
|
|
|
- use shorter boilerplate while at it
|
|
the busybox binary) into enums (which don't).
|
|
|
|
Vodz last_patch106
|
|
|
|
|
|
|
|
|
|
-Erik
|
|
|
|
files. Clean up the resulting damage and fix up the makefile.
-Erik
|