diff options
author | Denys Vlasenko | 2017-08-16 17:45:32 +0200 |
---|---|---|
committer | Denys Vlasenko | 2017-08-16 17:45:32 +0200 |
commit | e440b39416e7876129e619f7aa6935c783020645 (patch) | |
tree | 1507256a61302443f642c3b517a323671441cae8 /procps | |
parent | cf686ae3b401c68b64ff997b68b7972881dbf80e (diff) | |
download | busybox-e440b39416e7876129e619f7aa6935c783020645.zip busybox-e440b39416e7876129e619f7aa6935c783020645.tar.gz |
*: stop using atexit in non-debug build: saves ~260 in bss with musl
"builtin" below is atexit's 32-element global array of functions to call.
function old new delta
top_main 879 889 +10
launch_helper 185 193 +8
powertop_main 1555 1559 +4
sed_main 651 650 -1
slot 4 - -4
call 4 - -4
atexit 23 - -23
kill_helper 31 - -31
__funcs_on_exit 120 - -120
__cxa_atexit 168 - -168
builtin 260 - -260
------------------------------------------------------------------------------
(add/remove: 0/8 grow/shrink: 3/1 up/down: 22/-611) Total: -589 bytes
text data bss dec hex filename
912364 563 6132 919059 e0613 busybox_old
912035 563 5844 918442 e03aa busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'procps')
-rw-r--r-- | procps/powertop.c | 14 | ||||
-rw-r--r-- | procps/top.c | 1 |
2 files changed, 9 insertions, 6 deletions
diff --git a/procps/powertop.c b/procps/powertop.c index ebd659b..5d522bf 100644 --- a/procps/powertop.c +++ b/procps/powertop.c @@ -8,11 +8,6 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ - -//applet:IF_POWERTOP(APPLET(powertop, BB_DIR_USR_SBIN, BB_SUID_DROP)) - -//kbuild:lib-$(CONFIG_POWERTOP) += powertop.o - //config:config POWERTOP //config: bool "powertop (9.1 kb)" //config: default y @@ -27,6 +22,10 @@ //config: Without this, powertop will only refresh display every 10 seconds. //config: No keyboard commands will work, only ^C to terminate. +//applet:IF_POWERTOP(APPLET(powertop, BB_DIR_USR_SBIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_POWERTOP) += powertop.o + // XXX This should be configurable #define ENABLE_FEATURE_POWERTOP_PROCIRQ 1 @@ -718,7 +717,7 @@ int powertop_main(int UNUSED_PARAM argc, char UNUSED_PARAM **argv) set_termios_to_raw(STDIN_FILENO, &G.init_settings, TERMIOS_CLEAR_ISIG); bb_signals(BB_FATAL_SIGS, sig_handler); /* So we don't forget to reset term settings */ - atexit(reset_term); + die_func = reset_term; #endif /* Collect initial data */ @@ -855,6 +854,9 @@ int powertop_main(int UNUSED_PARAM argc, char UNUSED_PARAM **argv) } /* for (;;) */ bb_putchar('\n'); +#if ENABLE_FEATURE_POWERTOP_INTERACTIVE + reset_term(); +#endif return EXIT_SUCCESS; } diff --git a/procps/top.c b/procps/top.c index b9958af..f97ded5 100644 --- a/procps/top.c +++ b/procps/top.c @@ -1146,6 +1146,7 @@ int top_main(int argc UNUSED_PARAM, char **argv) else { /* Turn on unbuffered input; turn off echoing, ^C ^Z etc */ set_termios_to_raw(STDIN_FILENO, &initial_settings, TERMIOS_CLEAR_ISIG); + die_func = reset_term; } bb_signals(BB_FATAL_SIGS, sig_catcher); |