diff options
author | James Byrne <james.byrne@origamienergy.com> | 2019-04-12 17:01:51 +0000 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2019-04-30 10:51:27 +0200 |
commit | 253c4e787a799a3e1f92957ed791b5222f8d2f64 (patch) | |
tree | 36204e05aaaf2cdcbd89eaadeff0193f99b063bf /include | |
parent | f3a064f4956e113978e74486300dcd1e3e044efa (diff) | |
download | busybox-w32-253c4e787a799a3e1f92957ed791b5222f8d2f64.tar.gz busybox-w32-253c4e787a799a3e1f92957ed791b5222f8d2f64.tar.bz2 busybox-w32-253c4e787a799a3e1f92957ed791b5222f8d2f64.zip |
Optionally re-introduce bb_info_msg()
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>
Diffstat (limited to 'include')
-rw-r--r-- | include/libbb.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/include/libbb.h b/include/libbb.h index a20d5e403..57cfce385 100644 --- a/include/libbb.h +++ b/include/libbb.h | |||
@@ -1316,7 +1316,6 @@ enum { | |||
1316 | LOGMODE_BOTH = LOGMODE_SYSLOG + LOGMODE_STDIO, | 1316 | LOGMODE_BOTH = LOGMODE_SYSLOG + LOGMODE_STDIO, |
1317 | }; | 1317 | }; |
1318 | extern const char *msg_eol; | 1318 | extern const char *msg_eol; |
1319 | extern smallint syslog_level; | ||
1320 | extern smallint logmode; | 1319 | extern smallint logmode; |
1321 | extern uint8_t xfunc_error_retval; | 1320 | extern uint8_t xfunc_error_retval; |
1322 | extern void (*die_func)(void); | 1321 | extern void (*die_func)(void); |
@@ -1336,6 +1335,14 @@ void bb_verror_msg(const char *s, va_list p, const char *strerr) FAST_FUNC; | |||
1336 | void bb_die_memory_exhausted(void) NORETURN FAST_FUNC; | 1335 | void bb_die_memory_exhausted(void) NORETURN FAST_FUNC; |
1337 | void bb_logenv_override(void) FAST_FUNC; | 1336 | void bb_logenv_override(void) FAST_FUNC; |
1338 | 1337 | ||
1338 | #if ENABLE_FEATURE_SYSLOG_INFO | ||
1339 | void bb_info_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))) FAST_FUNC; | ||
1340 | void bb_vinfo_msg(const char *s, va_list p) FAST_FUNC; | ||
1341 | #else | ||
1342 | #define bb_info_msg bb_error_msg | ||
1343 | #define bb_vinfo_msg(s,p) bb_verror_msg(s,p,NULL) | ||
1344 | #endif | ||
1345 | |||
1339 | /* We need to export XXX_main from libbusybox | 1346 | /* We need to export XXX_main from libbusybox |
1340 | * only if we build "individual" binaries | 1347 | * only if we build "individual" binaries |
1341 | */ | 1348 | */ |