diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2000-10-05 01:18:40 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2000-10-05 01:18:40 +0000 |
commit | 012bb3e61e5eced6c610f9e036372bf0c8def2d1 (patch) | |
tree | 87efc733f9b164e8c85c0336f92c8fb7eff6d183 /kernel/kmod.c | |
parent | 625a1589d3d6464b5d90b8a0918789e3afffd220 (diff) |
Merge with Linux 2.4.0-test9. Please check DECstation, I had a number
of rejects to fixup while integrating Linus patches. I also found
that this kernel will only boot SMP on Origin; the UP kernel freeze
soon after bootup with SCSI timeout messages. I commit this anyway
since I found that the last CVS versions had the same problem.
Diffstat (limited to 'kernel/kmod.c')
-rw-r--r-- | kernel/kmod.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/kernel/kmod.c b/kernel/kmod.c index 4941840a7..3fff3ed3d 100644 --- a/kernel/kmod.c +++ b/kernel/kmod.c @@ -247,5 +247,44 @@ int request_module(const char * module_name) */ 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 |