From 3fa36e235021af5810333a52876d29efc661ad60 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Sun, 9 Nov 2008 00:15:11 +0000 Subject: *: a bit of code shrink function old new delta stop_handler 41 38 -3 sulogin_main 508 504 -4 got_cont 4 - -4 cont_handler 11 - -11 startservice 309 297 -12 processorstart 423 409 -14 tcpudpsvd_main 1861 1843 -18 ------------------------------------------------------------------------------ (add/remove: 0/2 grow/shrink: 0/5 up/down: 0/-66) Total: -66 bytes --- init/init.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'init') diff --git a/init/init.c b/init/init.c index 3d171d7..ef38781 100644 --- a/init/init.c +++ b/init/init.c @@ -60,7 +60,6 @@ struct init_action { static struct init_action *init_action_list = NULL; static const char *log_console = VC_5; -static sig_atomic_t got_cont = 0; enum { L_LOG = 0x1, @@ -613,24 +612,21 @@ static void ctrlaltdel_signal(int sig UNUSED_PARAM) run_actions(CTRLALTDEL); } +/* The SIGCONT handler is set to record_signo(). + * It just sets bb_got_signal = SIGCONT. */ + /* The SIGSTOP & SIGTSTP handler */ static void stop_handler(int sig UNUSED_PARAM) { int saved_errno = errno; - got_cont = 0; - while (!got_cont) + bb_got_signal = 0; + while (bb_got_signal == 0) pause(); errno = saved_errno; } -/* The SIGCONT handler */ -static void cont_handler(int sig UNUSED_PARAM) -{ - got_cont = 1; -} - static void new_init_action(uint8_t action_type, const char *command, const char *cons) { struct init_action *a, *last; @@ -808,7 +804,7 @@ int init_main(int argc UNUSED_PARAM, char **argv) + (1 << SIGTERM) /* reboot */ , halt_reboot_pwoff); signal(SIGINT, ctrlaltdel_signal); - signal(SIGCONT, cont_handler); + signal(SIGCONT, record_signo); bb_signals(0 + (1 << SIGSTOP) + (1 << SIGTSTP) -- cgit v1.1