hal/hald callout.c,1.15,1.15.2.1

David Zeuthen david at freedesktop.org
Mon Jan 10 21:56:58 PST 2005


Update of /cvs/hal/hal/hald
In directory gabe:/tmp/cvs-serv24910/hald

Modified Files:
      Tag: hal-0_4-stable-branch
	callout.c 
Log Message:
2005-01-11  David Zeuthen  <davidz at redhat.com>

	* hald/callout.c: Fix some craziness adding an idle handler for
	detecting when callouts complete - fixes bug on my new AMD64
	system with device add/remove prior to completion of callouts -
	one visible effect was that fstab-sync was crashing since it
	couldn't retrieve the block.device device as the device was
	removed prior to the completion of the callout



Index: callout.c
===================================================================
RCS file: /cvs/hal/hal/hald/callout.c,v
retrieving revision 1.15
retrieving revision 1.15.2.1
diff -u -d -r1.15 -r1.15.2.1
--- callout.c	31 Aug 2004 23:40:22 -0000	1.15
+++ callout.c	11 Jan 2005 05:56:56 -0000	1.15.2.1
@@ -54,7 +54,7 @@
 	HalDevice *device;
 	char **envp;
 	int envp_index;
-	int pid;
+	pid_t pid;
 	gboolean last_of_device;
 } Callout;
 
@@ -188,7 +188,6 @@
 	Callout *callout;
 	GSList *it;
 
-
 	/* Empty the pipe; one character per dead child */
 	if (G_IO_STATUS_NORMAL != 
 	    g_io_channel_read_chars (source, data, 1, &bytes_read, &err)) {
@@ -211,6 +210,9 @@
 			/* this can happen indeed since we loop */
 			goto out;
 		}
+
+		HAL_INFO (("Child pid %d terminated", child_pid));
+
 	
 		/* Now find the corresponding Callout object */
 		callout = NULL;
@@ -338,13 +340,8 @@
 			      err->message));
 		g_error_free (err);
 	}
-}
 
-static gboolean
-process_callouts_idle (gpointer user_data)
-{
-	process_callouts ();
-	return FALSE;
+	HAL_INFO (("Child pid %d for %s", callout->pid, argv[0]));
 }
 
 void
@@ -422,8 +419,8 @@
 
 	g_dir_close (dir);
 
-	if (!processing_callouts)
-		g_idle_add (process_callouts_idle, NULL);
+	if (any_callouts)
+		process_callouts ();
 
 finish:
 	/*
@@ -508,8 +505,7 @@
 
 	g_dir_close (dir);
 
-	if (!processing_callouts)
-		g_idle_add (process_callouts_idle, NULL);
+	process_callouts ();
 }
 
 void
@@ -589,6 +585,5 @@
 
 	g_dir_close (dir);
 
-	if (!processing_callouts)
-		g_idle_add (process_callouts_idle, NULL);
+	process_callouts ();
 }




More information about the hal-commit mailing list