summaryrefslogtreecommitdiffstats
path: root/sys-utils
diff options
context:
space:
mode:
authorKarel Zak2014-01-24 13:04:14 +0100
committerKarel Zak2014-01-24 13:04:14 +0100
commita5bd7939961aaa6e39f3b298e556063cfd97d75a (patch)
treec7b5425996072f268f5cbb6c5496a4a2a95a5256 /sys-utils
parentflock: Change the 'exit status' man page section to make more sense (diff)
downloadkernel-qcow2-util-linux-a5bd7939961aaa6e39f3b298e556063cfd97d75a.tar.gz
kernel-qcow2-util-linux-a5bd7939961aaa6e39f3b298e556063cfd97d75a.tar.xz
kernel-qcow2-util-linux-a5bd7939961aaa6e39f3b298e556063cfd97d75a.zip
include/c.h: prefer nanosleep() over usleep()
Let's use nanosleep() although if usleep() exists. The nanosleep function does no interact with signals and other timers. The patch introduces xusleep() as replacement to libc (or our fallback) usleep(). Yes, we don't want to use struct timespec + nanosleep() everywhere in code as nano-time resolution is useless for us. The patch also enlarges delays in some busy wait loops. It seems enough to try read/write 4x per second. Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'sys-utils')
-rw-r--r--sys-utils/hwclock-kd.c2
-rw-r--r--sys-utils/rtcwake.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/sys-utils/hwclock-kd.c b/sys-utils/hwclock-kd.c
index 9ed83436a..8e67009cb 100644
--- a/sys-utils/hwclock-kd.c
+++ b/sys-utils/hwclock-kd.c
@@ -66,7 +66,7 @@ static int synchronize_to_clock_tick_kd(void)
* A2000 RTCs and simply hangs after some time. Inserting a
* sleep helps."
*/
- usleep(1);
+ xusleep(1);
if (ioctl(con_fd, KDGHWCLK, &nowtime) == -1) {
warn(_("KDGHWCLK ioctl to read time failed in loop"));
diff --git a/sys-utils/rtcwake.c b/sys-utils/rtcwake.c
index eedf78d0c..51ffb3c5a 100644
--- a/sys-utils/rtcwake.c
+++ b/sys-utils/rtcwake.c
@@ -560,7 +560,7 @@ int main(int argc, char **argv)
program_invocation_short_name, suspend, devname,
ctime(&alarm));
fflush(stdout);
- usleep(10 * 1000);
+ xusleep(10 * 1000);
}
if (strcmp(suspend, "no") == 0) {