diff options
author | kay.sievers@vrfy.org <kay.sievers@vrfy.org> | 2004-10-19 04:37:30 -0700 |
---|---|---|
committer | Greg KH <gregkh@suse.de> | 2005-04-26 22:06:44 -0700 |
commit | 5cab7caa2a767b16211c15f0051a2e21a96ebfd9 (patch) | |
tree | 7caf9217d9dddf8066f49c4a9795e4df6ea12e4f /udevsend.c | |
parent | ab51035617d5725305b8ef98eff6b7c64f3ccec6 (diff) |
[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.
Diffstat (limited to 'udevsend.c')
-rw-r--r-- | udevsend.c | 15 |
1 files changed, 6 insertions, 9 deletions
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); } } |