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 /networking/ifplugd.c | |
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 'networking/ifplugd.c')
-rw-r--r-- | networking/ifplugd.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/networking/ifplugd.c b/networking/ifplugd.c index 026ff1cc8..1426709cb 100644 --- a/networking/ifplugd.c +++ b/networking/ifplugd.c | |||
@@ -326,7 +326,7 @@ static int run_script(const char *action) | |||
326 | char *argv[5]; | 326 | char *argv[5]; |
327 | int r; | 327 | int r; |
328 | 328 | ||
329 | bb_error_msg("executing '%s %s %s'", G.script_name, G.iface, action); | 329 | bb_info_msg("executing '%s %s %s'", G.script_name, G.iface, action); |
330 | 330 | ||
331 | argv[0] = (char*) G.script_name; | 331 | argv[0] = (char*) G.script_name; |
332 | argv[1] = (char*) G.iface; | 332 | argv[1] = (char*) G.iface; |
@@ -345,7 +345,7 @@ static int run_script(const char *action) | |||
345 | bb_unsetenv_and_free(env_PREVIOUS); | 345 | bb_unsetenv_and_free(env_PREVIOUS); |
346 | bb_unsetenv_and_free(env_CURRENT); | 346 | bb_unsetenv_and_free(env_CURRENT); |
347 | 347 | ||
348 | bb_error_msg("exit code: %d", r & 0xff); | 348 | bb_info_msg("exit code: %d", r & 0xff); |
349 | return (option_mask32 & FLAG_IGNORE_RETVAL) ? 0 : r; | 349 | return (option_mask32 & FLAG_IGNORE_RETVAL) ? 0 : r; |
350 | } | 350 | } |
351 | 351 | ||
@@ -365,7 +365,7 @@ static void up_iface(void) | |||
365 | if (!(ifrequest.ifr_flags & IFF_UP)) { | 365 | if (!(ifrequest.ifr_flags & IFF_UP)) { |
366 | ifrequest.ifr_flags |= IFF_UP; | 366 | ifrequest.ifr_flags |= IFF_UP; |
367 | /* Let user know we mess up with interface */ | 367 | /* Let user know we mess up with interface */ |
368 | bb_error_msg("upping interface"); | 368 | bb_info_msg("upping interface"); |
369 | if (network_ioctl(SIOCSIFFLAGS, &ifrequest, "setting interface flags") < 0) { | 369 | if (network_ioctl(SIOCSIFFLAGS, &ifrequest, "setting interface flags") < 0) { |
370 | if (errno != ENODEV && errno != EADDRNOTAVAIL) | 370 | if (errno != ENODEV && errno != EADDRNOTAVAIL) |
371 | xfunc_die(); | 371 | xfunc_die(); |
@@ -414,7 +414,7 @@ static void maybe_up_new_iface(void) | |||
414 | (uint8_t)(ifrequest.ifr_hwaddr.sa_data[5])); | 414 | (uint8_t)(ifrequest.ifr_hwaddr.sa_data[5])); |
415 | } | 415 | } |
416 | 416 | ||
417 | bb_error_msg("using interface %s%s with driver<%s> (version: %s)", | 417 | bb_info_msg("using interface %s%s with driver<%s> (version: %s)", |
418 | G.iface, buf, driver_info.driver, driver_info.version); | 418 | G.iface, buf, driver_info.driver, driver_info.version); |
419 | } | 419 | } |
420 | #endif | 420 | #endif |
@@ -447,7 +447,7 @@ static smallint detect_link(void) | |||
447 | logmode = sv_logmode; | 447 | logmode = sv_logmode; |
448 | if (status != IFSTATUS_ERR) { | 448 | if (status != IFSTATUS_ERR) { |
449 | G.api_method_num = i; | 449 | G.api_method_num = i; |
450 | bb_error_msg("using %s detection mode", method_table[i].name); | 450 | bb_info_msg("using %s detection mode", method_table[i].name); |
451 | break; | 451 | break; |
452 | } | 452 | } |
453 | } | 453 | } |
@@ -632,7 +632,7 @@ int ifplugd_main(int argc UNUSED_PARAM, char **argv) | |||
632 | /* | (1 << SIGCHLD) - run_script does not use it anymore */ | 632 | /* | (1 << SIGCHLD) - run_script does not use it anymore */ |
633 | , record_signo); | 633 | , record_signo); |
634 | 634 | ||
635 | bb_error_msg("started: %s", bb_banner); | 635 | bb_info_msg("started: %s", bb_banner); |
636 | 636 | ||
637 | if (opts & FLAG_MONITOR) { | 637 | if (opts & FLAG_MONITOR) { |
638 | struct ifreq ifrequest; | 638 | struct ifreq ifrequest; |
@@ -649,7 +649,7 @@ int ifplugd_main(int argc UNUSED_PARAM, char **argv) | |||
649 | iface_status_str = strstatus(iface_status); | 649 | iface_status_str = strstatus(iface_status); |
650 | 650 | ||
651 | if (opts & FLAG_MONITOR) { | 651 | if (opts & FLAG_MONITOR) { |
652 | bb_error_msg("interface %s", | 652 | bb_info_msg("interface %s", |
653 | G.iface_exists ? "exists" | 653 | G.iface_exists ? "exists" |
654 | : "doesn't exist, waiting"); | 654 | : "doesn't exist, waiting"); |
655 | } | 655 | } |
@@ -657,7 +657,7 @@ int ifplugd_main(int argc UNUSED_PARAM, char **argv) | |||
657 | * by potentially lying that it really exists */ | 657 | * by potentially lying that it really exists */ |
658 | 658 | ||
659 | if (G.iface_exists) { | 659 | if (G.iface_exists) { |
660 | bb_error_msg("link is %s", iface_status_str); | 660 | bb_info_msg("link is %s", iface_status_str); |
661 | } | 661 | } |
662 | 662 | ||
663 | if ((!(opts & FLAG_NO_STARTUP) | 663 | if ((!(opts & FLAG_NO_STARTUP) |
@@ -712,7 +712,7 @@ int ifplugd_main(int argc UNUSED_PARAM, char **argv) | |||
712 | if (G.iface_exists < 0) /* error */ | 712 | if (G.iface_exists < 0) /* error */ |
713 | goto exiting; | 713 | goto exiting; |
714 | if (iface_exists_old != G.iface_exists) { | 714 | if (iface_exists_old != G.iface_exists) { |
715 | bb_error_msg("interface %sappeared", | 715 | bb_info_msg("interface %sappeared", |
716 | G.iface_exists ? "" : "dis"); | 716 | G.iface_exists ? "" : "dis"); |
717 | if (G.iface_exists) | 717 | if (G.iface_exists) |
718 | maybe_up_new_iface(); | 718 | maybe_up_new_iface(); |
@@ -730,7 +730,7 @@ int ifplugd_main(int argc UNUSED_PARAM, char **argv) | |||
730 | iface_status_str = strstatus(iface_status); | 730 | iface_status_str = strstatus(iface_status); |
731 | 731 | ||
732 | if (iface_status_old != iface_status) { | 732 | if (iface_status_old != iface_status) { |
733 | bb_error_msg("link is %s", iface_status_str); | 733 | bb_info_msg("link is %s", iface_status_str); |
734 | 734 | ||
735 | if (delay_time) { | 735 | if (delay_time) { |
736 | /* link restored its old status before | 736 | /* link restored its old status before |