Commit Graph

25 Commits

Author SHA1 Message Date
James Byrne
6937487be7 libbb: reduce the overhead of single parameter bb_error_msg() calls
Back in 2007, commit 0c97c9d437 ("'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>
2019-07-02 11:35:03 +02:00
Denys Vlasenko
b097a84d62 config: update size information
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-12-28 03:20:17 +01:00
Denys Vlasenko
72089cf6b4 config: deindent all help texts
Those two spaces after tab have no effect, and always a nuisance when editing.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-21 09:50:55 +02:00
Denys Vlasenko
4eed2c6c50 Update menuconfig items with approximate applet sizes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-18 22:01:24 +02:00
Denys Vlasenko
10ad622dc2 Spelling fixes in comments, documentation, tests and examples
By klemens <ka7@github.com>

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-04-17 16:13:32 +02:00
Denys Vlasenko
f88e3bfa8d Convert all miscutils/* applets to "new style" applet definitions
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-22 23:54:17 +01:00
Denys Vlasenko
fb4da16711 Split miscutils/Config.src items into miscutils/*.c files
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-22 23:14:24 +01:00
Denys Vlasenko
9de2e5a222 *: hopefully all setup_common_bufsiz() are in place
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-04-21 18:38:51 +02:00
Denys Vlasenko
e6a2f4cc5a libbb: make bb_common_bufsiz1 1 kbyte, add capability to use bss tail for it
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>
2016-04-21 17:39:11 +02:00
Denys Vlasenko
7849ccb61c inotifyd: swap meaning of 'y' and 'm' events in help text. Closes 8726
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-06 17:35:16 +01:00
Flemming Madsen
ecccbac37b inotify: if PROG is -, print events to stdout
function                                             old     new   delta
inotifyd_main                                        516     589     +73
packed_usage                                       28698   28709     +11

Signed-off-by: Flemming Madsen <busybox@themadsens.dk>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-10-10 20:24:02 +02:00
Pere Orga
5bc8c005a8 move remaining help text from include/usage.src.h
Signed-off-by: Pere Orga <gotrunks@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-04-11 03:29:49 +02:00
Denys Vlasenko
0ef64bdb40 *: make GNU licensing statement forms more regular
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>
2010-08-16 20:14:46 +02:00
Denys Vlasenko
8531d76a15 *: code shrink and better "died from signal" reporting from wait4pid
function                                             old     new   delta
parse                                                964     967      +3
udhcp_run_script                                     670     665      -5
singlemount                                          911     906      -5
mount_it_now                                         360     355      -5
inotifyd_main                                        521     516      -5
xspawn                                                21       -     -21
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/4 up/down: 3/-41)             Total: -38 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-18 22:44:00 +01:00
Denys Vlasenko
5370bfb123 documentation and typo fixes. By Dan Fandrich (dan AT coneharvesters.com)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-06 02:58:59 +02:00
Denis Vlasenko
d723fb155d inotifyd: save resourses by closing unused inotify descriptors 2008-11-29 09:07:24 +00:00
Denis Vlasenko
9a4c0d59a7 inotifyd: exit if x event happened for all files
fix FIONREAD parameter type
 fix default mask code
 shrink help text

function                                             old     new   delta
inotifyd_main                                        497     506      +9
packed_usage                                       25446   25431     -15
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 9/-15)              Total: -6 bytes
2008-11-20 01:24:39 +00:00
Denis Vlasenko
a09a42cd83 inotify: add x, o, and u events 2008-11-17 22:19:18 +00:00
Denis Vlasenko
2479cd4a5d inotifyd: fix "inotifyd with no params" case 2008-11-14 22:14:12 +00:00
Denis Vlasenko
289ff0e341 inotify: document waiting behavior 2008-11-14 21:52:16 +00:00
Denis Vlasenko
b0e5d42d4f inotify: fix buffer overflow and "unreaped zombies" problem 2008-11-14 21:34:13 +00:00
Bernhard Reutner-Fischer
01ea971610 - use sys/inotify.h 2008-10-21 17:26:10 +00:00
Denis Vlasenko
08ea11ab07 runsvd: shrink by Vladimir
*: use unified trivial signal handler

function                                             old     new   delta
record_signo                                           -      10     +10
process_stdin                                        433     443     +10
bbunpack                                             383     391      +8
wc_main                                              598     605      +7
conescape                                            293     296      +3
nmeter_main                                          670     672      +2
fallbackSort                                        1717    1719      +2
bb_got_signal                                          -       1      +1
microcom_main                                        713     712      -1
signalled                                              2       -      -2
pack_gzip                                           1661    1659      -2
evalvar                                             1376    1374      -2
compare_keys                                         737     735      -2
parse_command                                       1460    1456      -4
expand                                              1748    1744      -4
s_term                                                37      29      -8
s_hangup                                               8       -      -8
fgotsig                                               10       -     -10
find_pair                                            187     169     -18
signal_handler                                       190     170     -20
runsvdir_main                                       1701    1583    -118
------------------------------------------------------------------------------
(add/remove: 2/3 grow/shrink: 6/10 up/down: 43/-199)         Total: -156 bytes
2008-09-11 19:51:11 +00:00
Denis Vlasenko
a60f84ebf0 *: rename ATTRIBUTE_XXX to just XXX. 2008-07-05 09:18:54 +00:00
Denis Vlasenko
8e2c9e1518 inotify: new applet by Vladimir Dronnikov <dronnikov AT gmail.com>
function                                             old     new   delta
inotifyd_main                                          -     453    +453
packed_usage                                       24246   24450    +204
inotify_add_watch                                      -      47     +47
inotify_init                                           -      29     +29
mask_names                                             -      13     +13
signal_handler                                       130     140     +10
applet_names                                        1859    1868      +9
applet_main                                         1132    1136      +4
applet_nameofs                                       566     568      +2
signalled                                              1       2      +1
2008-05-24 20:47:18 +00:00