Age | Commit message (Collapse) | Author |
|
function old new delta
packed_usage 33545 33581 +36
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>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
FEATURE_GETOPT_LONG made dependent on LONG_OPTS.
The folloving options are removed, now LONG_OPTS enables long options
for affected applets:
FEATURE_ENV_LONG_OPTIONS FEATURE_EXPAND_LONG_OPTIONS
FEATURE_UNEXPAND_LONG_OPTIONS FEATURE_MKDIR_LONG_OPTIONS
FEATURE_MV_LONG_OPTIONS FEATURE_RMDIR_LONG_OPTIONS
FEATURE_ADDGROUP_LONG_OPTIONS FEATURE_ADDUSER_LONG_OPTIONS
FEATURE_HWCLOCK_LONG_OPTIONS FEATURE_NSENTER_LONG_OPTS
FEATURE_CHCON_LONG_OPTIONS FEATURE_RUNCON_LONG_OPTIONS
They either had a small number of long options, or their long options are
essential.
Example: upstream addgroup and adduser have ONLY longopts,
we should probably go further and get rid
of non-standard short options.
To this end, make addgroup and adduser "select LONG_OPTS".
We had this breakage caused by us even in our own package!
#if ENABLE_LONG_OPTS || !ENABLE_ADDGROUP
/* We try to use --gid, not -g, because "standard" addgroup
* has no short option -g, it has only long --gid.
*/
argv[1] = (char*)"--gid";
#else
/* Breaks if system in fact does NOT use busybox addgroup */
argv[1] = (char*)"-g";
#endif
xargs: its lone longopt no longer depends on DESKTOP, only on LONG_OPTS.
hwclock TODO: get rid of incompatible -t, -l aliases to --systz, --localtime
Shorten help texts by omitting long option when short opt alternative exists.
Reduction of size comes from the fact that store of an immediate
(an address of longopts) to a fixed address (global variable)
is a longer insn than pushing that immediate or passing it in a register.
This effect is CPU-agnostic.
function old new delta
getopt32 1350 22 -1328
vgetopt32 - 1318 +1318
getopt32long - 24 +24
tftpd_main 562 567 +5
scan_recursive 376 380 +4
collect_cpu 545 546 +1
date_main 1096 1095 -1
hostname_main 262 259 -3
uname_main 259 255 -4
setpriv_main 362 358 -4
rmdir_main 191 187 -4
mv_main 562 558 -4
ipcalc_main 548 544 -4
ifenslave_main 641 637 -4
gzip_main 192 188 -4
gunzip_main 77 73 -4
fsfreeze_main 81 77 -4
flock_main 318 314 -4
deluser_main 337 333 -4
cp_main 374 370 -4
chown_main 175 171 -4
applet_long_options 4 - -4
xargs_main 894 889 -5
wget_main 2540 2535 -5
udhcpc_main 2767 2762 -5
touch_main 436 431 -5
tar_main 1014 1009 -5
start_stop_daemon_main 1033 1028 -5
sed_main 682 677 -5
script_main 1082 1077 -5
run_parts_main 330 325 -5
rtcwake_main 459 454 -5
od_main 2169 2164 -5
nl_main 201 196 -5
modprobe_main 773 768 -5
mkdir_main 160 155 -5
ls_main 568 563 -5
install_main 773 768 -5
hwclock_main 411 406 -5
getopt_main 622 617 -5
fstrim_main 256 251 -5
env_main 198 193 -5
dumpleases_main 635 630 -5
dpkg_main 3991 3986 -5
diff_main 1355 1350 -5
cryptpw_main 233 228 -5
cpio_main 593 588 -5
conspy_main 1135 1130 -5
chpasswd_main 313 308 -5
adduser_main 887 882 -5
addgroup_main 416 411 -5
ftpgetput_main 351 345 -6
get_terminal_width_height 242 234 -8
expand_main 690 680 -10
static.expand_longopts 18 - -18
static.unexpand_longopts 27 - -27
mkdir_longopts 28 - -28
env_longopts 30 - -30
static.ifenslave_longopts 34 - -34
mv_longopts 46 - -46
static.rmdir_longopts 48 - -48
packed_usage 31739 31687 -52
------------------------------------------------------------------------------
(add/remove: 2/8 grow/shrink: 3/49 up/down: 1352/-1840) Total: -488 bytes
text data bss dec hex filename
915681 485 6880 923046 e15a6 busybox_old
915428 485 6876 922789 e14a5 busybox_unstripped
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>
|
|
Those two spaces after tab have no effect, and always a nuisance when editing.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
It confused me more than once
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
There's no reason to call gethostbyname() on the value returned
by uname() when asked just for a short name of a host. This may
also be wrong, when uname is set to one value, but in /etc/hosts
(or elsewhere) the "canonical" name is different. This is often
the case for localhost entry in /etc/hosts:
127.0.0.1 localhost myname
With this content of /etc/hosts, and uname being set to myname,
busybox hostname -s will return localhost, while regular
hostname utility returns myname.
Fix this by not calling gethostbyname() for the simple
'hostname -s' use.
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
packed_usage 28706 28623 -83
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Pere Orga <gotrunks@gmail.com>
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>
|
|
function old new delta
hostname_main 218 231 +13
nfsmount 3541 3474 -67
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
cpio: --verbose, --quiet, --to-stdout
test: make 64-bit math enable-able for hush too
dnsdomainname: alias to hostname -d
hostname: support --fqdn, --domain, --file
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
a bug where it underflows the string
a bug where it never frees parser_t struct
make read_config() return 0 if parser is NULL,
make config_close() accept and ignore NULL parser -
eliminates many if() blocks
reverse the sense of parser bit flags - negative flags
are harder to grok.
hexdump: revert the change to use config parser, it is BIGGER
and also requires additional quirks in parser
*: explicitly use PARSER_NORMAL instead of 0
function old new delta
login_main 1575 1596 +21
config_close 18 29 +11
bbunpack 383 391 +8
qgravechar 106 109 +3
rtnl_tab_initialize 121 117 -4
expand 1697 1693 -4
man_main 717 712 -5
nameif_main 674 668 -6
hexdump_main 597 591 -6
read_config 217 209 -8
dnsd_main 1478 1470 -8
sysctl_main 203 189 -14
config_open2 44 25 -19
make_device 1177 1141 -36
config_read 597 549 -48
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/11 up/down: 43/-158) Total: -115 bytes
|
|
(by Valdimir)
function old new delta
config_open2 - 41 +41
config_read 507 542 +35
find_pair 169 187 +18
fopen_for_write - 14 +14
fopen_for_read - 14 +14
find_main 406 418 +12
xfopen_for_write - 10 +10
xfopen_for_read - 10 +10
popstring 134 140 +6
parse_inittab 396 401 +5
next_token 923 928 +5
pack_gzip 1659 1661 +2
bb__parsespent 117 119 +2
fallbackSort 1719 1717 -2
evalvar 1376 1374 -2
qrealloc 36 33 -3
...
...
...
...
singlemount 4579 4569 -10
process_stdin 443 433 -10
patch_main 1111 1101 -10
ifupdown_main 2175 2165 -10
file_action_grep 90 80 -10
uuidcache_init 649 637 -12
hush_main 797 785 -12
read_config 230 217 -13
dpkg_main 3835 3820 -15
read_line_input 3134 3110 -24
sysctl_main 232 203 -29
config_open 40 10 -30
WARN_BAD_LINE 44 - -44
login_main 1714 1575 -139
------------------------------------------------------------------------------
(add/remove: 5/1 grow/shrink: 8/74 up/down: 174/-737) Total: -563 bytes
|
|
safe_gethostname - 48 +48
glob3 35 37 +2
timestamp_and_log 314 315 +1
udhcp_send_kernel_packet 234 231 -3
scan_tree 275 271 -4
passwd_main 1074 1070 -4
print_login_prompt 68 58 -10
obscure 392 377 -15
syslogd_main 882 866 -16
print_login_issue 516 478 -38
hostname_main 278 223 -55
parse_and_put_prompt 825 756 -69
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 2/9 up/down: 51/-214) Total: -163 bytes
text data bss dec hex filename
798791 728 7484 807003 c505b busybox_old
798631 728 7484 806843 c4fbb busybox_unstripped
|
|
EXTERNALLY_VISIBLE. 5% size reduction of libbusybox.so
|
|
|
|
(add/remove: 0/0 grow/shrink: 12/131 up/down: 91/-727) Total: -636 bytes
text data bss dec hex filename
773469 1058 11092 785619 bfcd3 busybox_old
772644 1058 11092 784794 bf99a busybox_unstripped
|
|
tr: stop using globals needlessly.
code: -103 bytes
|
|
*: s/include "busybox.h"/include "libbb.h"
|
|
no preceding prototype
|
|
|
|
hostname: small optimization
|
|
|
|
nowadays? FIXME: use it here instead of the fgets()
- shrink by ~9%: use common_buf, reuse are_you_root, adopt to global option_mask32
|
|
It is impossible to formulate sane ABI based on
size of ulong because it can be 32-bit or 64-bit.
Basically it means that you cannot portably use
more that 32 option chars in one call anyway...
Make it explicit.
|
|
|
|
things like xasprintf() into xfuncs.c, remove xprint_file_by_name() (it only
had one user), clean up lots of #includes... General cleanup pass. What I've
been doing for the last couple days.
And it conflicts! I've removed httpd.c from this checkin due to somebody else
touching that file. It builds for me. I have to catch a bus. (Now you know
why I'm looking forward to Mercurial.)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- Switched to getopt argument parsing
- Added -f option to get fully qualified domain name
- Fixed the -s (short) and -d (domain) options, which were not
doing a gethostbyname lookup to get the FQDN before trying to
separate the local and domain portions of the hostname.
- Fixed probem with 'agressive setting' of the hostname...the
previous busybox version would try to set the hostname if called
with a non-option argument, or the -F option, even if another
option (like -i or -s) was given. This behavior does not match
the net-tools hostname, which does not attempt to set anything if
given a 'display' option, regardless of the presence/absence of
the -F option or additional command line arguments.
- When using a file to set the hostname, behavior now matches
net-tools version...previous busybox version did not handle
comments, and simply grabbed the first line from the file.
|
|
-Erik
|
|
|
|
problems. busybox.h must be last.
-Erik
|
|
|
|
by Larry Doolittle.
|
|
namespace polluting things that really should be static.
|
|
warnings with glibc 2.2 and use always use xfopen
-Erik
|
|
done by Evin Robertson (bug#1105) and work from Manuel to make
usage messages occupy less space and simplify how usage messages
are displayed.
|