aboutsummaryrefslogtreecommitdiff
path: root/libbb/verror_msg.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* libbb: reduce the overhead of single parameter bb_error_msg() callsJames Byrne2019-07-021-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Optionally re-introduce bb_info_msg()James Byrne2019-04-301-2/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* libbb: speed up error_msg functionsDenys Vlasenko2016-04-031-4/+25
| | | | | | | function old new delta bb_verror_msg 386 466 +80 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Fix compile failuresDenys Vlasenko2014-05-021-0/+2
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* libbb: make syslog level for bb_error_msg's configurable. use it in crondDenys Vlasenko2014-04-301-1/+2
| | | | | | | | | 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>
* *: make GNU licensing statement forms more regularDenys Vlasenko2010-08-161-1/+1
| | | | | | | 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>
* libbb: reduce number of *error_msg[_and_die].c files by fourDenys Vlasenko2010-07-041-3/+20
| | | | | | No code changes. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Exclude syslog code if FEATURE_SYSLOG is not setNguyễn Thái Ngọc Duy2010-04-091-2/+7
| | | | | | | 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>
* *: introduce and use ffulsh_all()Denys Vlasenko2009-11-021-3/+3
| | | | | | | | | | | | | | | | | | | | 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>
* libbb: prevent resursion on malloc failureDenys Vlasenko2009-08-011-16/+25
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* *: introduce and use FAST_FUNC: regparm on i386, otherwise no-onDenis Vlasenko2008-06-271-2/+2
| | | | | | | text data bss dec hex filename 808035 611 6868 815514 c719a busybox_old 804472 611 6868 811951 c63af busybox_unstripped
* - use STD*_FILENO some more. No object-code changesBernhard Reutner-Fischer2008-05-191-1/+1
|
* - fix conflicting decls of syslog related facilitynames and prioritynames tablesBernhard Reutner-Fischer2008-01-271-1/+1
|
* perror_nomsg: don't print extra colonDenis Vlasenko2007-12-221-2/+4
| | | | | losetup: print name of loop device in error messages
* httpd shring and logging update, part 1 or 7Denis Vlasenko2007-08-171-26/+100
| | | | | | | | | | | | | 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
* verror_msg: don't printf(NULL)Denis Vlasenko2007-05-291-3/+8
|
* random small shrinkage and elimination of staticsDenis Vlasenko2007-04-071-1/+1
|
* bb_applet_name -> applet_nameDenis Vlasenko2006-10-031-1/+1
|
* losetup: getopt_ulflags'ification + small fix for perror_nomsgDenis Vlasenko2006-09-221-1/+3
|
* - small trivia to be gentle to gcc-2.95.x which had no va_copy but only ↵Bernhard Reutner-Fischer2006-09-121-5/+1
| | | | __va_copy.
* getty, sulogin: convert to using bb_msg for syslog outputDenis Vlasenko2006-09-071-2/+3
|
* fix if (ENABLE_FEATURE_SYSLOG & (...)) - should be &&Denis Vlasenko2006-09-071-1/+1
|
* Add CONFIG_FEATURE_SYSLOG which controls whetherDenis Vlasenko2006-09-071-1/+1
| | | | | | | | 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.
* Implement optional syslog logging using ordinaryDenis Vlasenko2006-09-061-4/+30
| | | | | | bb_xx_msg calls, and convert networking/* to it. The rest of bbox will be converted gradually.
* - remove emacs layout block as suggested by Robert P.J. DayBernhard Reutner-Fischer2006-05-191-23/+1
| | | | - use shorter boilerplate while at it
* Robert P. Day removed 8 gazillion occurrences of "extern" on functionRob Landley2006-03-061-1/+1
| | | | definitions. (That should only be on prototypes.)
* Remove trailing whitespace. Update copyright to include 2004.Eric Andersen2004-03-151-1/+1
|
* Update a bunch of docs. Run a script to update my email addr.Eric Andersen2003-07-141-1/+1
|
* Major coreutils update.Manuel Novoa III2003-03-191-2/+2
|
* Major rework of the directory structure and the entire build system.Eric Andersen2001-10-241-7/+1
| | | | -Erik
* Move applet_name declaration from busybox.h to libbb.h.Matt Kraai2001-04-241-2/+0
|
* Split error messages into separate files.Eric Andersen2001-03-191-0/+51
Update libbb.h, per suggestion from Vladimir, to include __attribute__((format (printf ...))) stuff -Erik