aboutsummaryrefslogtreecommitdiff
path: root/libbb/verror_msg.c
AgeCommit message (Collapse)Author
2019-07-02libbb: reduce the overhead of single parameter bb_error_msg() callsJames Byrne
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>
2019-04-30Optionally re-introduce bb_info_msg()James Byrne
Between Busybox 1.24.2 and 1.25.0 the bb_info_msg() function was eliminated and calls to it changed to be bb_error_msg(). The downside of this is that daemons now log all messages to syslog at the LOG_ERR level which makes it hard to filter errors from informational messages. This change optionally re-introduces bb_info_msg(), controlled by a new option FEATURE_SYSLOG_INFO, restores all the calls to bb_info_msg() that were removed (only in applets that set logmode to LOGMODE_SYSLOG or LOGMODE_BOTH), and also changes informational messages in ifplugd and ntpd. The code size change of this is as follows (using 'defconfig' on x86_64 with gcc 7.3.0-27ubuntu1~18.04) function old new delta bb_info_msg - 182 +182 bb_vinfo_msg - 27 +27 static.log7 194 198 +4 log8 190 191 +1 log5 190 191 +1 crondlog 45 - -45 ------------------------------------------------------------------------------ (add/remove: 2/1 grow/shrink: 3/0 up/down: 215/-45) Total: 170 bytes If you don't care about everything being logged at LOG_ERR level then when FEATURE_SYSLOG_INFO is disabled Busybox actually gets smaller: function old new delta static.log7 194 200 +6 log8 190 193 +3 log5 190 193 +3 syslog_level 1 - -1 bb_verror_msg 583 581 -2 crondlog 45 - -45 ------------------------------------------------------------------------------ (add/remove: 0/2 grow/shrink: 3/1 up/down: 12/-48) Total: -36 bytes Signed-off-by: James Byrne <james.byrne@origamienergy.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-04-03libbb: speed up error_msg functionsDenys Vlasenko
function old new delta bb_verror_msg 386 466 +80 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-05-02Fix compile failuresDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-04-30libbb: make syslog level for bb_error_msg's configurable. use it in crondDenys Vlasenko
function old new delta bb_verror_msg 380 386 +6 syslog_level - 1 +1 crondlog 165 108 -57 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-16*: make GNU licensing statement forms more regularDenys Vlasenko
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-07-04libbb: reduce number of *error_msg[_and_die].c files by fourDenys Vlasenko
No code changes. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-04-09Exclude syslog code if FEATURE_SYSLOG is not setNguyễn Thái Ngọc Duy
syslog.h and syslog(...) may not exist in such configuration Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-02*: introduce and use ffulsh_all()Denys Vlasenko
function old new delta buffer_fill_and_print 179 196 +17 fflush_all - 9 +9 spawn 87 92 +5 rtcwake_main 455 453 -2 ... alarm_intr 93 84 -9 readcmd 1072 1062 -10 bb_ask 345 333 -12 more_main 845 832 -13 flush_stdout_stderr 42 23 -19 xfflush_stdout 27 - -27 flush_stderr 30 - -30 ------------------------------------------------------------------------------ (add/remove: 1/2 grow/shrink: 2/50 up/down: 31/-397) Total: -366 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-08-01libbb: prevent resursion on malloc failureDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2008-06-27*: introduce and use FAST_FUNC: regparm on i386, otherwise no-onDenis Vlasenko
text data bss dec hex filename 808035 611 6868 815514 c719a busybox_old 804472 611 6868 811951 c63af busybox_unstripped
2008-05-19- use STD*_FILENO some more. No object-code changesBernhard Reutner-Fischer
2008-01-27- fix conflicting decls of syslog related facilitynames and prioritynames tablesBernhard Reutner-Fischer
2007-12-22perror_nomsg: don't print extra colonDenis Vlasenko
losetup: print name of loop device in error messages
2007-08-17httpd shring and logging update, part 1 or 7Denis Vlasenko
text data bss dec hex filename 9836 0 0 9836 266c busybox.t1/networking/httpd.o.orig 9724 0 0 9724 25fc busybox.t2/networking/httpd.o 9657 0 0 9657 25b9 busybox.t3/networking/httpd.o 9342 0 0 9342 247e busybox.t4/networking/httpd.o 9342 0 0 9342 247e busybox.t5/networking/httpd.o 9262 0 0 9262 242e busybox.t6/networking/httpd.o 9283 0 0 9283 2443 busybox.t7/networking/httpd.o 9334 0 0 9334 2476 busybox.t8/networking/httpd.o
2007-05-29verror_msg: don't printf(NULL)Denis Vlasenko
2007-04-07random small shrinkage and elimination of staticsDenis Vlasenko
2006-10-03bb_applet_name -> applet_nameDenis Vlasenko
2006-09-22losetup: getopt_ulflags'ification + small fix for perror_nomsgDenis Vlasenko
2006-09-12- small trivia to be gentle to gcc-2.95.x which had no va_copy but only ↵Bernhard Reutner-Fischer
__va_copy.
2006-09-07getty, sulogin: convert to using bb_msg for syslog outputDenis Vlasenko
2006-09-07fix if (ENABLE_FEATURE_SYSLOG & (...)) - should be &&Denis Vlasenko
2006-09-07Add CONFIG_FEATURE_SYSLOG which controls whetherDenis Vlasenko
bb_xx_msg will ever try to send output to syslog. Add "select CONFIG_FEATURE_SYSLOG" to relevant applets. This allows to omit syslog code if we do not have any syslog-capable applets in the build.
2006-09-06Implement optional syslog logging using ordinaryDenis Vlasenko
bb_xx_msg calls, and convert networking/* to it. The rest of bbox will be converted gradually.
2006-05-19- remove emacs layout block as suggested by Robert P.J. DayBernhard Reutner-Fischer
- use shorter boilerplate while at it
2006-03-06Robert P. Day removed 8 gazillion occurrences of "extern" on functionRob Landley
definitions. (That should only be on prototypes.)
2004-03-15Remove trailing whitespace. Update copyright to include 2004.Eric Andersen
2003-07-14Update a bunch of docs. Run a script to update my email addr.Eric Andersen
2003-03-19Major coreutils update.Manuel Novoa III
2001-10-24Major rework of the directory structure and the entire build system.Eric Andersen
-Erik
2001-04-24Move applet_name declaration from busybox.h to libbb.h.Matt Kraai
2001-03-19Split error messages into separate files.Eric Andersen
Update libbb.h, per suggestion from Vladimir, to include __attribute__((format (printf ...))) stuff -Erik