diff options
author | Shawn Landden <shawnlandden@tutanota.com> | 2022-08-27 19:56:21 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2022-08-27 19:56:21 +0200 |
commit | 58598eb7093561d914a6254697e137b815f1fdfc (patch) | |
tree | a1e15b99eb2deaebefa01a504498494a95c80f32 /libbb/duration.c | |
parent | d432049f288c9acdc4a7caa729c68ceba3c5dca1 (diff) | |
download | busybox-w32-58598eb7093561d914a6254697e137b815f1fdfc.tar.gz busybox-w32-58598eb7093561d914a6254697e137b815f1fdfc.tar.bz2 busybox-w32-58598eb7093561d914a6254697e137b815f1fdfc.zip |
ash: optional sleep builtin
function old new delta
sleepcmd - 10 +10
builtintab 352 360 +8
.rodata 105264 105271 +7
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 2/0 up/down: 25/0) Total: 25 bytes
Signed-off-by: Shawn Landden <shawnlandden@tutanota.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb/duration.c')
-rw-r--r-- | libbb/duration.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libbb/duration.c b/libbb/duration.c index a6a29ddae..793d02f42 100644 --- a/libbb/duration.c +++ b/libbb/duration.c | |||
@@ -76,6 +76,12 @@ void FAST_FUNC sleep_for_duration(duration_t duration) | |||
76 | ts.tv_sec = duration; | 76 | ts.tv_sec = duration; |
77 | ts.tv_nsec = (duration - ts.tv_sec) * 1000000000; | 77 | ts.tv_nsec = (duration - ts.tv_sec) * 1000000000; |
78 | } | 78 | } |
79 | /* NB: if ENABLE_ASH_SLEEP, we end up here if "sleep N" | ||
80 | * is run in ash. ^C will still work, because ash's signal handler | ||
81 | * does not return (it longjumps), the below loop | ||
82 | * will not continue looping. | ||
83 | * (This wouldn't work in hush) | ||
84 | */ | ||
79 | do { | 85 | do { |
80 | errno = 0; | 86 | errno = 0; |
81 | nanosleep(&ts, &ts); | 87 | nanosleep(&ts, &ts); |