patch-2.3.44 linux/kernel/kmod.c

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

diff -u --recursive --new-file v2.3.43/linux/kernel/kmod.c linux/kernel/kmod.c
@@ -63,10 +63,8 @@
 	unlock_kernel();
 }
 
-static int exec_modprobe(void * module_name)
+int exec_usermodehelper(char *program_path, char *argv[], char *envp[])
 {
-	static char * envp[] = { "HOME=/", "TERM=linux", "PATH=/sbin:/usr/sbin:/bin:/usr/bin", NULL };
-	char *argv[] = { modprobe_path, "-s", "-k", (char*)module_name, NULL };
 	int i;
 
 	current->session = 1;
@@ -101,13 +99,24 @@
 	set_fs(KERNEL_DS);
 
 	/* Go, go, go... */
-	if (execve(modprobe_path, argv, envp) < 0) {
+	if (execve(program_path, argv, envp) < 0)
+		return -errno;
+	return 0;
+}
+
+static int exec_modprobe(void * module_name)
+{
+	static char * envp[] = { "HOME=/", "TERM=linux", "PATH=/sbin:/usr/sbin:/bin:/usr/bin", NULL };
+	char *argv[] = { modprobe_path, "-s", "-k", (char*)module_name, NULL };
+	int ret;
+
+	ret = exec_usermodehelper(modprobe_path, argv, envp);
+	if (ret) {
 		printk(KERN_ERR
 		       "kmod: failed to exec %s -s -k %s, errno = %d\n",
 		       modprobe_path, (char*) module_name, errno);
-		return -errno;
 	}
-	return 0;
+	return ret;
 }
 
 /*

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