Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
lk_usermodehelper [2019/02/14 15:10] – [kernel/kmod.c] rpjdaylk_usermodehelper [2019/02/14 15:18] (current) – [init/do_mounts_initrd.c] rpjday
Line 277: Line 277:
 ... ...
  
 +static int uvesafb_helper_start(void)
 +{
 +        char *envp[] = {
 +                "HOME=/",
 +                "PATH=/sbin:/bin",
 +                NULL,
 +        };
  
 +        char *argv[] = {
 +                v86d_path,
 +                NULL,
 +        };
 +
 +        return call_usermodehelper(v86d_path, argv, envp, UMH_WAIT_PROC);
 +}
 +</code>
 +
 +==== drivers/macintosh/windfarm_core.c ====
 +
 +<code>
 +static int wf_critical_overtemp(void)
 +{
 +        static char const critical_overtemp_path[] = "/sbin/critical_overtemp";
 +        char *argv[] = { (char *)critical_overtemp_path, NULL };
 +        static char *envp[] = { "HOME=/",
 +                                "TERM=linux",
 +                                "PATH=/sbin:/usr/sbin:/bin:/usr/bin",
 +                                NULL };
 +
 +        return call_usermodehelper(critical_overtemp_path,
 +                                   argv, envp, UMH_WAIT_EXEC);
 +}
 +</code>
 +
 +==== init/do_mounts_initrd.c ====
 +
 +<code>
 +static void __init handle_initrd(void)
 +{
 +        struct subprocess_info *info;
 +        static char *argv[] = { "linuxrc", NULL, };
 +        extern char *envp_init[];
 +        int error;
 +
 +        real_root_dev = new_encode_dev(ROOT_DEV);
 +        create_dev("/dev/root.old", Root_RAM0);
 +        /* mount initrd on rootfs' /root */
 +        mount_block_root("/dev/root.old", root_mountflags & ~MS_RDONLY);
 +        ksys_mkdir("/old", 0700);
 +        ksys_chdir("/old");
 +
 +        /*
 +         * In case that a resume from disk is carried out by linuxrc or one of
 +         * its children, we need to tell the freezer not to wait for us.
 +         */
 +        current->flags |= PF_FREEZER_SKIP;
 +
 +        info = call_usermodehelper_setup("/linuxrc", argv, envp_init,
 +                                         GFP_KERNEL, init_linuxrc, NULL, NULL);
 +        if (!info)
 +                return;
 +        call_usermodehelper_exec(info, UMH_WAIT_PROC);
 +        
 +        ...
 +</code>
 +
 +==== kernel/reboot.c ====
 +
 +<code>
 +char poweroff_cmd[POWEROFF_CMD_PATH_LEN] = "/sbin/poweroff";
 +static const char reboot_cmd[] = "/sbin/reboot";
 +
 +static int run_cmd(const char *cmd)
 +{
 +        char **argv;
 +        static char *envp[] = {
 +                "HOME=/",
 +                "PATH=/sbin:/bin:/usr/sbin:/usr/bin",
 +                NULL
 +        };
 +        int ret;
 +        argv = argv_split(GFP_KERNEL, cmd, NULL);
 +        if (argv) {
 +                ret = call_usermodehelper(argv[0], argv, envp, UMH_WAIT_EXEC);
 +                argv_free(argv);
 +        } else {
 +                ret = -ENOMEM;
 +        }
 +
 +        return ret;
 +}
 </code> </code>
  • lk_usermodehelper.1550157048.txt.gz
  • Last modified: 2019/02/14 15:10
  • by rpjday