Commit Graph

31 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
b86b39bfda config: more tweaks
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-12-28 17:52:43 +01:00
Denys Vlasenko
0c4dbd481a regularize format of source file headers, no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-09-18 16:28:43 +02: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
82dcc3bff9 bootchartd: fix typo in comment
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-20 13:42:19 +02:00
Uwe Geuder
9e2e0ff4ba bootchartd: prevent premature stop by device mapper
Kernel thread kdmflush was recognized as display manager kdm,
check for string length.

Signed-off-by: Uwe Geuder <busybox2017-ugeuder@snkmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-20 13:39:41 +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
3e134ebf6a *: slap on a few ALIGN1/2s where appropriate
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>
2016-04-22 18:09:21 +02:00
Denys Vlasenko
47cfbf32fd *: add most of the required setup_common_bufsiz() calls
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-04-21 18:18:48 +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
18b461925c bootchartd: warn if .config looks wrong
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-11-03 00:07:31 +01:00
Quentin Casasnovas
c158601d50 bootchartd: add process accounting feature
function                                             old     new   delta
bootchartd_main                                      962    1088    +126
finalize                                             294     357     +63
acct                                                   -      33     +33
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 2/0 up/down: 222/0)             Total: 222 bytes

Signed-off-by: Quentin Casasnovas <quentin.casasnovas@mathembedded.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-01-18 02:12:13 +01:00
Denys Vlasenko
d2277e262f nommu: fix cases where we mangle argv[0][0]
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-11-22 17:19:26 +01:00
Denys Vlasenko
66426760be *: remove "Options:" string from help texts
function                                             old     new   delta
packed_usage                                       28706   28623     -83

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-06-05 03:58:28 +02:00
Denys Vlasenko
b9f2d9f7d9 mass removal of underscores from _BB_DIR_foo and _BB_SUID_foo
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-18 13:58:01 +01:00
Denys Vlasenko
1c31e9e82b use BB_EXECVP_or_die where appropriate
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-11-28 04:34:09 +01:00
Denys Vlasenko
b1db09be5a init/*: move applet/kbuild/config/help bits into applet source files
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-10-12 13:47:15 +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
Jeremie Koenig
e7a0632b7b bootchartd: mounting tmpfs is Linux-specific
Signed-off-by: Jeremie Koenig <jk@jk.fr.eu.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-30 01:16:00 +02:00
Jeremie Koenig
1d7266d3b5 mark Linux-specific configuration options
PLATFORM_LINUX is used as a dependency for applets or features
which require Linux-specific interfaces.

Signed-off-by: Jeremie Koenig <jk@jk.fr.eu.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-19 00:44:56 +02:00
Denys Vlasenko
7a2aa87c75 bootchartd: fix labels in config system. no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-06 15:49:01 +02:00
Pascal Bellard
926031b764 *: introduce and use xfork() and xvfork()
function                                             old     new   delta
launch_helper                                        170     169      -1
setup_heredoc                                        312     302     -10
handle_dir_common                                    367     354     -13
expand_vars_to_list                                 2456    2443     -13
open_transformer                                      89      74     -15
data_extract_to_command                              439     423     -16
do_ipaddr                                           1406    1389     -17
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/7 up/down: 0/-85)             Total: -85 bytes

Signed-off-by: Pascal Bellard <pascal.bellard@ads-lu.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-04 15:32:38 +02:00
Keisuke Yasui
c03fb3cd7d bootchartd: fix sample period calculations
Signed-off-by: Keisuke Yasui <keisuke.yasui@toshiba.co.jp>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-28 16:05:54 +02:00
Pascal Bellard
ff37799dfe conspy: code shrink
function                                             old     new   delta
conspy_main                                         1446    1444      -2
screen_read_close                                    114     108      -6
screen_char                                          299     293      -6

Signed-off-by: Pascal Bellard <pascal.bellard@ads-lu.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-28 15:51:01 +02:00
Denys Vlasenko
64606c6d01 typo fix
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-22 18:33:15 +02:00
Denys Vlasenko
6d9c88ad98 fix config help text
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-21 07:25:36 +02:00
Denys Vlasenko
adbbee46ad bootchartd: added optional compat features
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-21 07:17:23 +02:00
Denys Vlasenko
82dd14a510 ash: use CONFIG_FEATURE_EDITING_MAX_LEN
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-17 10:10:01 +02:00
Denys Vlasenko
b8ba6b66f5 bootchartd: better wording in comment
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-05 00:40:15 +02:00
Denys Vlasenko
e7f1e5ca1d bootchartd: add missing parenthesis
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-04 17:34:37 +02:00
Denys Vlasenko
ff027d6f50 bootchartd: new applet
Usage: bootchartd start [PROG ARGS]|init|stop

Create /var/log/bootchart.tgz with boot chart data

Options:
start: start background logging; with PROG, run PROG, then kill
logging with USR1
stop: send USR1 to all bootchartd processes
init: start background logging; stop when getty/gdm is seen (for init scripts)
Under PID 1: as init, then exec $bootchart_init, /init, /sbin/init

function                                             old     new   delta
bootchartd_main                                        -     907    +907
dump_procs                                             -     353    +353
packed_usage                                       26566   26735    +169
dump_file                                              -      91     +91
static.dirs                                            -      23     +23
applet_names                                        2176    2187     +11
applet_main                                         1284    1288      +4
applet_nameofs                                       642     644      +2
------------------------------------------------------------------------------
(add/remove: 5/0 grow/shrink: 4/0 up/down: 1560/0)           Total: 1560 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-04 15:45:25 +02:00