summaryrefslogtreecommitdiff
path: root/udev/udev-event.c
diff options
context:
space:
mode:
authorDaniel Mierswa <impulze@impulze.org>2009-08-30 23:58:57 +0200
committerKay Sievers <kay.sievers@vrfy.org>2009-08-30 23:58:57 +0200
commit959e8b5decb32fda0a8c8be21aff8bc17382586d (patch)
tree25b419d0fab9c616e52a3552f8bc8e3644ab637b /udev/udev-event.c
parentc45e22151313878dcce33c788f9eebbd93842008 (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-event.c')
-rw-r--r--udev/udev-event.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/udev/udev-event.c b/udev/udev-event.c
index 3a6c71abe9..8183793e5f 100644
--- a/udev/udev-event.c
+++ b/udev/udev-event.c
@@ -23,9 +23,10 @@
#include <errno.h>
#include <ctype.h>
#include <string.h>
+#include <time.h>
+#include <net/if.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
-#include <net/if.h>
#include <linux/sockios.h>
#include "udev.h"
@@ -505,6 +506,8 @@ static int rename_netif(struct udev_event *event)
util_strscpy(ifr.ifr_newname, IFNAMSIZ, event->name);
loop = 90 * 20;
while (loop--) {
+ const struct timespec duration = { 0, 1000 * 1000 * 1000 / 20 };
+
err = ioctl(sk, SIOCSIFNAME, &ifr);
if (err == 0) {
rename_netif_kernel_log(ifr);
@@ -518,7 +521,7 @@ static int rename_netif(struct udev_event *event)
}
dbg(event->udev, "wait for netif '%s' to become free, loop=%i\n",
event->name, (90 * 20) - loop);
- usleep(1000 * 1000 / 20);
+ nanosleep(&duration, NULL);
}
}
exit: