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>
Kconfig-language.txt was deleted in commit 4fa499a17b back in 2006.
Move to docs/ as suggested by Xabier Oneca:
http://lists.busybox.net/pipermail/busybox/2014-May/080914.html
Also update references to it everywhere.
Signed-off-by: Kartik Agaram <akkartik@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
The applets with "<applet> [opts] PROG ARGS" API very quickly exec
another program, noexec is okay for them:
chpst/envdir/envuidgid/softlimit/setuidgid
chroot
chrt
ionice
nice
nohup
setarch/linux32/linux64
taskset
cttyhack
"reset" and "sulogin" applets don't have this form, but also exec
another program at once, thus made noexec too.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Backport from upstream versions:
2.1.2
Sun, 10 Aug 2014 18:01:54 +0000
* sv.c: properly format status command's output on failure cases.
* sv.c: support optional LSB init script actions reload and
try-restart.
* sv.c: fix typo that may lead to wrong output from sv when reporting
status of multiple service directories.
2.1.1
Sun, 04 Oct 2009 20:28:38 +0000
* sv.c: on 'down', send runsv the 'down' command properly if not yet
done (e.g. when taken up with 'once').
[Remove previous workaround added to BusyBox version].
1.9.0
Mon, 05 May 2008 22:00:13 +0000
* sv.c: service name is also relative to the current directory if it
ends with a slash.
1.8.0
Fri, 21 Sep 2007 00:33:56 +0000
* sv.c: fix race on check for down if pid is 0 and state is run or
finish.
1.7.1
Sat, 04 Nov 2006 19:23:29 +0000
* sv.c: properly wait for a service to be restarted on 'restart';
support checks through -v for pause, cont, kill.
function old new delta
sv 1184 1280 +96
control 132 180 +48
status 118 139 +21
out 64 85 +21
svstatus_print 334 344 +10
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 5/0 up/down: 196/0) Total: 196 bytes
Signed-off-by: James Byrne <james.byrne at origamienergy.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Backport from upstream versions:
2.1.0
Thu, 24 Sep 2009 22:49:33 +0000
* runsv.c: exit with error if [log/]supervise/control exists, but is
not a fifo.
[Code abstracted into a separate function to make it more compact
for BusyBox.]
1.9.0
Mon, 05 May 2008 22:00:13 +0000
* runsv.c: create temporary new status files for log/supervise/
actually in log/supervise/.
1.7.2
Tue, 21 Nov 2006 15:13:47 +0000
* runsv.c: really don't act on commands in state finish; minor.
function old new delta
open_control - 135 +135
update_status 553 612 +59
custom 223 242 +19
ctrl 426 422 -4
warn_cannot 21 10 -11
runsv_main 1786 1662 -124
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 2/3 up/down: 213/-139) Total: 74 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Backport from upstream version:
1.7.0
Sat, 07 Oct 2006 18:24:17 +0000
* svlogd.c: new option -ttt: prefix log messages with sortable UTC
timestamp YYYY-MM-DDTHH:MM:SS.xxxxx.
function old new delta
svlogd_main 1429 1454 +25
packed_usage 31575 31580 +5
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
busybox's chpst first switches user/group and then tries to call nice().
Once the root priviledges are dropped, process priority can only be lowered.
So negative nice values don't work anymore.
Upstream version of chpst correctly calls nice() before switching user.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
When using svlogd's processor functionality to run arbitrary commands
on log rotation, the line in the config is executed verbatim, i.e. the
exclamation mark is included.
For example, if the config file contains:
s100
!cat
then when it's time to rotate the log files after each 100 bytes, sh -c
"!cat" will be run, instead of sh -c "cat" as intended. The result is
svlogd logging
/bin/bash: !cat: command not found
svlogd: warning: processor failed, restart: /tmp/svlogd/
over and over again as it keeps attempting to execute the processor and
failing (unless you happen to have a "!cat" binary around :)).
Skipping the exclamation mark when performing the wstrdup() fixes the
issue.
Signed-off-by: Francis Rounds <francis.rounds@4bridgeworks.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
There is no reason to do so. We do not even have SIGCHLD handler.
function old new delta
runsvdir_main 1077 1057 -20
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
We could lose a signal while processing previous one
function old new delta
runsvdir_main 1088 1077 -11
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
We use functions from sys/resource.h in misc applets, but don't include
the header. This breaks building with newer glibc versions, so add the
include where needed.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>