patch-2.4.7 linux/kernel/kmod.c

Next file: linux/kernel/ksyms.c
Previous file: linux/kernel/fork.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.6/linux/kernel/kmod.c linux/kernel/kmod.c
@@ -24,6 +24,7 @@
 #include <linux/unistd.h>
 #include <linux/kmod.h>
 #include <linux/smp_lock.h>
+#include <linux/completion.h>
 
 #include <asm/uaccess.h>
 
@@ -263,7 +264,7 @@
 #endif /* CONFIG_HOTPLUG */
 
 struct subprocess_info {
-	struct semaphore *sem;
+	struct completion *complete;
 	char *path;
 	char **argv;
 	char **envp;
@@ -302,7 +303,7 @@
 	pid = kernel_thread(____call_usermodehelper, sub_info, CLONE_VFORK | SIGCHLD);
 	if (pid < 0)
 		sub_info->retval = pid;
-	up(sub_info->sem);
+	complete(sub_info->complete);
 }
 
 /**
@@ -320,9 +321,9 @@
  */
 int call_usermodehelper(char *path, char **argv, char **envp)
 {
-	DECLARE_MUTEX_LOCKED(sem);
+	DECLARE_COMPLETION(work);
 	struct subprocess_info sub_info = {
-		sem:		&sem,
+		complete:	&work,
 		path:		path,
 		argv:		argv,
 		envp:		envp,
@@ -341,7 +342,7 @@
 		__call_usermodehelper(&sub_info);
 	} else {
 		schedule_task(&tqs);
-		down(&sem);		/* Wait until keventd has started the subprocess */
+		wait_for_completion(&work);
 	}
 out:
 	return sub_info.retval;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)