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 /miscutils | |
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 'miscutils')
-rw-r--r-- | miscutils/crond.c | 6 | ||||
-rw-r--r-- | miscutils/devfsd.c | 2 |
2 files changed, 3 insertions, 5 deletions
diff --git a/miscutils/crond.c b/miscutils/crond.c index 25e5503c7..b533a3991 100644 --- a/miscutils/crond.c +++ b/miscutils/crond.c | |||
@@ -181,9 +181,7 @@ static void crondlog(unsigned level, const char *msg, va_list va) | |||
181 | * need not touch syslog_level | 181 | * need not touch syslog_level |
182 | * (they are ok with LOG_ERR default). | 182 | * (they are ok with LOG_ERR default). |
183 | */ | 183 | */ |
184 | syslog_level = LOG_INFO; | 184 | bb_vinfo_msg(msg, va); |
185 | bb_verror_msg(msg, va, /* strerr: */ NULL); | ||
186 | syslog_level = LOG_ERR; | ||
187 | } | 185 | } |
188 | } | 186 | } |
189 | 187 | ||
@@ -1108,7 +1106,7 @@ int crond_main(int argc UNUSED_PARAM, char **argv) | |||
1108 | process_cron_update_file(); | 1106 | process_cron_update_file(); |
1109 | log5("wakeup dt=%ld", dt); | 1107 | log5("wakeup dt=%ld", dt); |
1110 | if (dt < -60 * 60 || dt > 60 * 60) { | 1108 | if (dt < -60 * 60 || dt > 60 * 60) { |
1111 | bb_error_msg("time disparity of %ld minutes detected", dt / 60); | 1109 | bb_info_msg("time disparity of %ld minutes detected", dt / 60); |
1112 | /* and we do not run any jobs in this case */ | 1110 | /* and we do not run any jobs in this case */ |
1113 | } else if (dt > 0) { | 1111 | } else if (dt > 0) { |
1114 | /* Usual case: time advances forward, as expected */ | 1112 | /* Usual case: time advances forward, as expected */ |
diff --git a/miscutils/devfsd.c b/miscutils/devfsd.c index 3bf06b965..e4d104d0c 100644 --- a/miscutils/devfsd.c +++ b/miscutils/devfsd.c | |||
@@ -343,7 +343,7 @@ static const char bb_msg_variable_not_found[] ALIGN1 = "variable: %s not found"; | |||
343 | 343 | ||
344 | /* Busybox stuff */ | 344 | /* Busybox stuff */ |
345 | #if ENABLE_DEVFSD_VERBOSE || ENABLE_DEBUG | 345 | #if ENABLE_DEVFSD_VERBOSE || ENABLE_DEBUG |
346 | #define info_logger(p, fmt, args...) bb_error_msg(fmt, ## args) | 346 | #define info_logger(p, fmt, args...) bb_info_msg(fmt, ## args) |
347 | #define msg_logger(p, fmt, args...) bb_error_msg(fmt, ## args) | 347 | #define msg_logger(p, fmt, args...) bb_error_msg(fmt, ## args) |
348 | #define msg_logger_and_die(p, fmt, args...) bb_error_msg_and_die(fmt, ## args) | 348 | #define msg_logger_and_die(p, fmt, args...) bb_error_msg_and_die(fmt, ## args) |
349 | #define error_logger(p, fmt, args...) bb_perror_msg(fmt, ## args) | 349 | #define error_logger(p, fmt, args...) bb_perror_msg(fmt, ## args) |