hal/tools/linux hal_dev.c,1.1,1.2

David Zeuthen david at pdx.freedesktop.org
Mon Jul 5 10:00:34 PDT 2004


Update of /cvs/hal/hal/tools/linux
In directory pdx:/tmp/cvs-serv12333/tools/linux

Modified Files:
	hal_dev.c 
Log Message:
2004-07-05  David Zeuthen  <david at fubar.dk>

	* tools/linux/hal_dev.c (main): Disable logging. Also fork(2) a
	new process and make parent exit to temporarily fix that udevstart
	takes a few minutes to run



Index: hal_dev.c
===================================================================
RCS file: /cvs/hal/hal/tools/linux/hal_dev.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- hal_dev.c	7 Apr 2004 23:41:22 -0000	1.1
+++ hal_dev.c	5 Jul 2004 17:00:32 -0000	1.2
@@ -35,7 +35,7 @@
 #include <sys/stat.h>
 #include <unistd.h>
 #include <mntent.h>
-#include <syslog.h>
+/*#include <syslog.h>*/
 #include <linux/limits.h>
 
 #include <dbus/dbus.h>
@@ -112,14 +112,29 @@
 	DBusMessage *message;
 	DBusMessageIter iter;
 	DBusMessageIter iter_dict;
+	pid_t rc;
 
 	if (argc != 2)
 		return 1;
 
+	/* fork a new process so we exit instantly and child is handling
+	 * the processing; fixes bug where udevstart takes a long time
+	 * to start since udev executes stuff in dev.d sequentially.
+	 *
+	 * TODO, FIXME, HACK, XXX : This is not the right way; we merely
+	 * work around the problem that D-BUS requires us to take a nap
+	 * before exiting because otherwise messages are lost
+	 */
+	rc = fork ();
+	if (rc == -1)
+		return 1;
+	if (rc != 0)
+		return 0;
+
 	if (get_sysfs_mnt_path () != 0)
 		return 1;
 
-	openlog ("hal.dev", LOG_PID, LOG_USER);
+	/*openlog ("hal.dev", LOG_PID, LOG_USER);*/
 
 	/* Connect to a well-known bus instance, the system bus */
 	dbus_error_init (&error);
@@ -162,7 +177,7 @@
 	}
 
 	if (devname == NULL || devpath == NULL) {
-		syslog (LOG_ERR, "Missing devname or devpath");
+		/*syslog (LOG_ERR, "Missing devname or devpath");*/
 		goto out;
 	}
 





More information about the hal-commit mailing list