From 5cab7caa2a767b16211c15f0051a2e21a96ebfd9 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 19 Oct 2004 04:37:30 -0700 Subject: [PATCH] cleanup udevd/udevstart Change to the same timeout loop we use in the rest of the code. Change some comments and names to be more descriptive. I'm mostly finished with the overall cleanup. I will post a new patch for the udevd-nofork experiment, which will be much smaller now. --- udevsend.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'udevsend.c') diff --git a/udevsend.c b/udevsend.c index 883181c1b6..84c46bc0c2 100644 --- a/udevsend.c +++ b/udevsend.c @@ -95,9 +95,9 @@ static void run_udev(const char *subsystem) switch (pid) { case 0: /* child */ - execl(UDEV_BIN, "udev", subsystem, NULL); + execl(UDEV_BIN, UDEV_BIN, subsystem, NULL); dbg("exec of child failed"); - exit(1); + _exit(1); break; case -1: dbg("fork of child failed"); @@ -117,7 +117,6 @@ int main(int argc, char* argv[]) unsigned long long seq; int retval = 1; int loop; - struct timespec tspec; int sock = -1; struct sockaddr_un saddr; socklen_t addrlen; @@ -176,8 +175,8 @@ int main(int argc, char* argv[]) strfieldcpy(msg.subsystem, subsystem); /* If we can't send, try to start daemon and resend message */ - loop = UDEVSEND_CONNECT_RETRY; - while (loop--) { + loop = SEND_WAIT_MAX_SECONDS * SEND_WAIT_LOOP_PER_SECOND; + while (--loop) { retval = sendto(sock, &msg, sizeof(struct hotplug_msg), 0, (struct sockaddr *)&saddr, addrlen); if (retval != -1) { @@ -200,10 +199,8 @@ int main(int argc, char* argv[]) dbg("daemon started"); started_daemon = 1; } else { - dbg("retry to connect %d", UDEVSEND_CONNECT_RETRY - loop); - tspec.tv_sec = 0; - tspec.tv_nsec = 100000000; /* 100 millisec */ - nanosleep(&tspec, NULL); + dbg("retry to connect %d", SEND_WAIT_MAX_SECONDS * SEND_WAIT_LOOP_PER_SECOND - loop); + usleep(1000 * 1000 / SEND_WAIT_LOOP_PER_SECOND); } } -- cgit v1.2.3-54-g00ecf