chiark / gitweb /
use nanosleep() instead of usleep()
[elogind.git] / udev / udevadm-settle.c
index 682819201e46fc2f970626246c25b2608b7d1cec..124c59698c491ab04e9b9ecd2722738ad544286d 100644 (file)
@@ -28,6 +28,7 @@
 #include <syslog.h>
 #include <getopt.h>
 #include <signal.h>
+#include <time.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 
@@ -180,6 +181,7 @@ int udevadm_settle(struct udev *udev, int argc, char *argv[])
 
        while (1) {
                struct stat statbuf;
+               const struct timespec duration = { 0 , 1000 * 1000 * 1000 / LOOP_PER_SECOND };
 
                if (exists != NULL && stat(exists, &statbuf) == 0) {
                        rc = 0;
@@ -203,7 +205,7 @@ int udevadm_settle(struct udev *udev, int argc, char *argv[])
                if (is_timeout)
                        break;
 
-               usleep(1000 * 1000 / LOOP_PER_SECOND);
+               nanosleep(&duration, NULL);
        }
 
        /* if we reached the timeout, print the list of remaining events */