chiark / gitweb /
require 2.6.27 for proper signalfd handling
[elogind.git] / udev / udevadm-settle.c
index 0b3f2e21246d7b3a5e6edd5a810b571fec716792..124c59698c491ab04e9b9ecd2722738ad544286d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006-2008 Kay Sievers <kay@vrfy.org>
+ * Copyright (C) 2006-2009 Kay Sievers <kay@vrfy.org>
  * Copyright (C) 2009 Canonical Ltd.
  * Copyright (C) 2009 Scott James Remnant <scott@netsplit.com>
  *
@@ -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 */