diff options
author | kay.sievers@vrfy.org <kay.sievers@vrfy.org> | 2004-01-26 18:19:33 -0800 |
---|---|---|
committer | Greg KH <gregkh@suse.de> | 2005-04-26 21:13:18 -0700 |
commit | a695feaeff0551745e1a397be2daa61b8cd0cc42 (patch) | |
tree | 9a8d9bd4b89419ab01818610aa8d297ad0a05f66 /udevsend.c | |
parent | eea34a0e9909405467185bb1e5291e6cc88fd0bc (diff) |
[PATCH] udevd - cleanup and better timeout handling
Here is the next revision for udevd:
o Small cleanups all over the place.
o Swich to the usual linked list format "list.h".
o Better timeout handling.
We store a timestamp in in every queued event, so we don't wait longer
than the timeout specified, if the hole in the list is not shrinking.
o ignore udevd target if klibc is used
Diffstat (limited to 'udevsend.c')
-rw-r--r-- | udevsend.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/udevsend.c b/udevsend.c index bdc8293df7..3f3bbacbc2 100644 --- a/udevsend.c +++ b/udevsend.c @@ -64,6 +64,7 @@ static inline char *get_seqnum(void) static int build_hotplugmsg(struct hotplug_msg *msg, char *action, char *devpath, char *subsystem, int seqnum) { + memset(msg, 0x00, sizeof(msg)); msg->mtype = HOTPLUGMSGTYPE; msg->seqnum = seqnum; strncpy(msg->action, action, 8); @@ -85,7 +86,8 @@ static int start_daemon(void) switch (child_pid) { case 0: /* daemon */ - execl(DEFAULT_UDEVD_EXEC, NULL); + setsid(); + execl(UDEVD_EXEC, "udevd", NULL); dbg("exec of daemon failed"); exit(1); case -1: @@ -99,7 +101,7 @@ static int start_daemon(void) dbg("fork of helper failed"); return -1; default: - wait(0); + wait(NULL); } return 0; } @@ -147,7 +149,7 @@ int main(int argc, char* argv[]) seq = atoi(seqnum); /* create ipc message queue or get id of our existing one */ - key = ftok(DEFAULT_UDEVD_EXEC, IPC_KEY_ID); + key = ftok(UDEVD_EXEC, IPC_KEY_ID); size = build_hotplugmsg(&message, action, devpath, subsystem, seq); msgid = msgget(key, IPC_CREAT); if (msgid == -1) { @@ -165,7 +167,7 @@ int main(int argc, char* argv[]) /* get state of ipc queue */ tspec.tv_sec = 0; tspec.tv_nsec = 10000000; /* 10 millisec */ - loop = 20; + loop = 30; while (loop--) { retval = msgctl(msgid, IPC_STAT, &msg_queue); if (retval == -1) { |