diff options
author | Denys Vlasenko | 2020-11-29 11:37:34 +0100 |
---|---|---|
committer | Denys Vlasenko | 2020-11-29 11:37:34 +0100 |
commit | ec16c030bd5527137f95a1c30e6a1f3c9054dcf7 (patch) | |
tree | 16beb4e6302936d6015230cab5e3e2a9758ed98f /init | |
parent | 87bd558f3f0452ed62f2686472e03a1be4a6e36d (diff) | |
download | busybox-ec16c030bd5527137f95a1c30e6a1f3c9054dcf7.zip busybox-ec16c030bd5527137f95a1c30e6a1f3c9054dcf7.tar.gz |
libbb: introduce and use sleep1()
function old new delta
sleep1 - 9 +9
run_shutdown_and_kill_processes 97 95 -2
restore_state_and_exit 116 114 -2
reread_partition_table 67 65 -2
flush_buffer_cache 80 78 -2
chat_main 1302 1300 -2
timeout_main 310 307 -3
telnet_main 1235 1232 -3
stop_handler 86 83 -3
process_action 1078 1075 -3
nbdclient_main 1185 1182 -3
init_main 789 786 -3
getty_main 1541 1538 -3
do_time 410 407 -3
runsv_main 1682 1677 -5
pause_and_low_level_reboot 59 54 -5
inetd_main 1917 1911 -6
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/16 up/down: 9/-50) Total: -41 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'init')
-rw-r--r-- | init/halt.c | 4 | ||||
-rw-r--r-- | init/init.c | 12 |
2 files changed, 8 insertions, 8 deletions
diff --git a/init/halt.c b/init/halt.c index 785c381..2070eaa 100644 --- a/init/halt.c +++ b/init/halt.c @@ -144,14 +144,14 @@ static int init_was_not_there(void) */ #if 0 while (kill(1, 0) != 0 && --cnt >= 0) - sleep(1); + sleep1(); #endif /* ... so let's wait for some evidence a usual startup event, * mounting of /proc, happened. By that time init should be ready * for signals. */ while (access("/proc/meminfo", F_OK) != 0 && --cnt >= 0) - sleep(1); + sleep1(); /* Does it look like init wasn't there? */ return (cnt != initial - 1); diff --git a/init/init.c b/init/init.c index 28775a6..efab5dc 100644 --- a/init/init.c +++ b/init/init.c @@ -736,7 +736,7 @@ static void pause_and_low_level_reboot(unsigned magic) pid_t pid; /* Allow time for last message to reach serial console, etc */ - sleep(1); + sleep1(); /* We have to fork here, since the kernel calls do_exit(EXIT_SUCCESS) * in linux/kernel/sys.c, which can cause the machine to panic when @@ -751,7 +751,7 @@ static void pause_and_low_level_reboot(unsigned magic) * we would eternally sleep here - not what we want. */ waitpid(pid, NULL, 0); - sleep(1); /* paranoia */ + sleep1(); /* paranoia */ _exit(EXIT_SUCCESS); } @@ -768,12 +768,12 @@ static void run_shutdown_and_kill_processes(void) kill(-1, SIGTERM); message(L_CONSOLE, "Sent SIG%s to all processes", "TERM"); sync(); - sleep(1); + sleep1(); kill(-1, SIGKILL); message(L_CONSOLE, "Sent SIG%s to all processes", "KILL"); sync(); - /*sleep(1); - callers take care about making a pause */ + /*sleep1(); - callers take care about making a pause */ } /* Signal handling by init: @@ -904,7 +904,7 @@ static void stop_handler(int sig UNUSED_PARAM) wpid = wait_any_nohang(NULL); mark_terminated(wpid); if (wpid <= 0) /* no processes exited? sleep a bit */ - sleep(1); + sleep1(); } signal(SIGCONT, SIG_DFL); @@ -1209,7 +1209,7 @@ int init_main(int argc UNUSED_PARAM, char **argv) } /* Don't consume all CPU time - sleep a bit */ - sleep(1); + sleep1(); } /* while (1) */ } |