diff options
author | Daniel Mierswa <impulze@impulze.org> | 2009-08-30 23:58:57 +0200 |
---|---|---|
committer | Kay Sievers <kay.sievers@vrfy.org> | 2009-08-30 23:58:57 +0200 |
commit | 959e8b5decb32fda0a8c8be21aff8bc17382586d (patch) | |
tree | 25b419d0fab9c616e52a3552f8bc8e3644ab637b /udev/udev-rules.c | |
parent | c45e22151313878dcce33c788f9eebbd93842008 (diff) |
use nanosleep() instead of usleep()
POSIX.1-2001 declares usleep() function obsolete and POSIX.1-2008
removes it.
[Kay Sievers]
- include time.h
- use const for timespec
- scsi_id: drop rand() in retry loop
- modem-probe: rename msuspend() to msleep()
Diffstat (limited to 'udev/udev-rules.c')
-rw-r--r-- | udev/udev-rules.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/udev/udev-rules.c b/udev/udev-rules.c index eeb71bc87b..a45a8138f5 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -27,6 +27,7 @@ #include <errno.h> #include <dirent.h> #include <fnmatch.h> +#include <time.h> #include "udev.h" @@ -814,6 +815,8 @@ static int wait_for_file(struct udev_device *dev, const char *file, int timeout) dbg(udev, "will wait %i sec for '%s'\n", timeout, file); while (--loop) { + const struct timespec duration = { 0, 1000 * 1000 * 1000 / WAIT_LOOP_PER_SECOND }; + /* lookup file */ if (stat(file, &stats) == 0) { info(udev, "file '%s' appeared after %i loops\n", file, (timeout * WAIT_LOOP_PER_SECOND) - loop-1); @@ -825,7 +828,7 @@ static int wait_for_file(struct udev_device *dev, const char *file, int timeout) return -2; } info(udev, "wait for '%s' for %i mseconds\n", file, 1000 / WAIT_LOOP_PER_SECOND); - usleep(1000 * 1000 / WAIT_LOOP_PER_SECOND); + nanosleep(&duration, NULL); } info(udev, "waiting for '%s' failed\n", file); return -1; |