patch-2.4.0-test9 linux/kernel/kmod.c
Next file: linux/kernel/ksyms.c
Previous file: linux/kernel/exit.c
Back to the patch index
Back to the overall index
- Lines: 45
- Date:
Mon Sep 25 16:18:55 2000
- Orig file:
v2.4.0-test8/linux/kernel/kmod.c
- Orig date:
Sat Aug 5 22:58:59 2000
diff -u --recursive --new-file v2.4.0-test8/linux/kernel/kmod.c linux/kernel/kmod.c
@@ -247,5 +247,44 @@
*/
char hotplug_path[256] = "/sbin/hotplug";
+
+static int exec_helper (void *arg)
+{
+ void **params = (void **) arg;
+ char *path = (char *) params [0];
+ char **argv = (char **) params [1];
+ char **envp = (char **) params [2];
+ return exec_usermodehelper (path, argv, envp);
+}
+
+
+int call_usermodehelper (char *path, char **argv, char **envp)
+{
+ void *params [3] = { path, argv, envp };
+ int pid, pid2, retval;
+ mm_segment_t fs;
+
+ if ( ! current->fs->root ) {
+ printk(KERN_ERR "call_usermodehelper[%s]: no root fs\n",
+ path);
+ return -EPERM;
+ }
+ if ((pid = kernel_thread (exec_helper, (void *) params, 0)) < 0) {
+ printk(KERN_ERR "failed fork %s, errno = %d", argv [0], -pid);
+ return -1;
+ }
+
+ fs = get_fs ();
+ set_fs (KERNEL_DS);
+ pid2 = waitpid (pid, &retval, __WCLONE);
+ set_fs (fs);
+
+ if (pid2 != pid) {
+ printk(KERN_ERR "waitpid(%d) failed, %d\n", pid, pid2);
+ return -1;
+ }
+ return retval;
+}
+
#endif
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)