diff options
author | Michael Brown | 2016-03-22 17:12:32 +0100 |
---|---|---|
committer | Michael Brown | 2016-03-22 17:18:42 +0100 |
commit | ee3122bc54631711e192c934734f3f5be40c2fa9 (patch) | |
tree | 8982b34b6c23595ed57398b6247de57b01899dff /src/core/exec.c | |
parent | [arbel] Fix received packet length (diff) | |
download | ipxe-ee3122bc54631711e192c934734f3f5be40c2fa9.tar.gz ipxe-ee3122bc54631711e192c934734f3f5be40c2fa9.tar.xz ipxe-ee3122bc54631711e192c934734f3f5be40c2fa9.zip |
[libc] Make sleep() interruptible
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/core/exec.c')
-rw-r--r-- | src/core/exec.c | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/src/core/exec.c b/src/core/exec.c index 2c2ade0a..a13884b6 100644 --- a/src/core/exec.c +++ b/src/core/exec.c @@ -36,10 +36,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL ); #include <ipxe/command.h> #include <ipxe/parseopt.h> #include <ipxe/settings.h> -#include <ipxe/console.h> -#include <ipxe/keys.h> -#include <ipxe/process.h> -#include <ipxe/nap.h> #include <ipxe/shell.h> /** @file @@ -573,8 +569,6 @@ static struct command_descriptor sleep_cmd = static int sleep_exec ( int argc, char **argv ) { struct sleep_options opts; unsigned int seconds; - unsigned long start; - unsigned long delay; int rc; /* Parse options */ @@ -586,14 +580,8 @@ static int sleep_exec ( int argc, char **argv ) { return rc; /* Delay for specified number of seconds */ - start = currticks(); - delay = ( seconds * TICKS_PER_SEC ); - while ( ( currticks() - start ) <= delay ) { - step(); - if ( iskey() && ( getchar() == CTRL_C ) ) - return -ECANCELED; - cpu_nap(); - } + if ( sleep ( seconds ) != 0 ) + return -ECANCELED; return 0; } |