User Tools

Site Tools


lk_usermodehelper

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
lk_usermodehelper [2019/02/14 15:16]
rpjday [drivers/macintosh/windfarm_core.c]
lk_usermodehelper [2019/02/14 15:18] (current)
rpjday [init/do_mounts_initrd.c]
Line 341: Line 341:
         ​         ​
         ...         ...
 +</​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.txt ยท Last modified: 2019/02/14 15:18 by rpjday