Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| lk_usermodehelper [2019/02/14 15:05] – [kernel/umh.c] rpjday | lk_usermodehelper [2019/02/14 15:18] (current) – [init/do_mounts_initrd.c] rpjday | ||
|---|---|---|---|
| Line 267: | Line 267: | ||
| out: | out: | ||
| return -ENOMEM; | return -ENOMEM; | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ==== drivers/ | ||
| + | |||
| + | < | ||
| + | static char v86d_path[PATH_MAX] = "/ | ||
| + | |||
| + | ... | ||
| + | |||
| + | static int uvesafb_helper_start(void) | ||
| + | { | ||
| + | char *envp[] = { | ||
| + | " | ||
| + | " | ||
| + | NULL, | ||
| + | }; | ||
| + | |||
| + | char *argv[] = { | ||
| + | v86d_path, | ||
| + | NULL, | ||
| + | }; | ||
| + | |||
| + | return call_usermodehelper(v86d_path, | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ==== drivers/ | ||
| + | |||
| + | < | ||
| + | static int wf_critical_overtemp(void) | ||
| + | { | ||
| + | static char const critical_overtemp_path[] = "/ | ||
| + | char *argv[] = { (char *)critical_overtemp_path, | ||
| + | static char *envp[] = { " | ||
| + | " | ||
| + | " | ||
| + | NULL }; | ||
| + | |||
| + | return call_usermodehelper(critical_overtemp_path, | ||
| + | argv, envp, UMH_WAIT_EXEC); | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ==== init/ | ||
| + | |||
| + | < | ||
| + | static void __init handle_initrd(void) | ||
| + | { | ||
| + | struct subprocess_info *info; | ||
| + | static char *argv[] = { " | ||
| + | extern char *envp_init[]; | ||
| + | int error; | ||
| + | |||
| + | real_root_dev = new_encode_dev(ROOT_DEV); | ||
| + | create_dev("/ | ||
| + | /* mount initrd on rootfs' | ||
| + | mount_block_root("/ | ||
| + | ksys_mkdir("/ | ||
| + | ksys_chdir("/ | ||
| + | |||
| + | /* | ||
| + | * 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-> | ||
| + | |||
| + | info = call_usermodehelper_setup("/ | ||
| + | | ||
| + | if (!info) | ||
| + | return; | ||
| + | call_usermodehelper_exec(info, | ||
| + | | ||
| + | ... | ||
| + | </ | ||
| + | |||
| + | ==== kernel/ | ||
| + | |||
| + | < | ||
| + | char poweroff_cmd[POWEROFF_CMD_PATH_LEN] = "/ | ||
| + | static const char reboot_cmd[] = "/ | ||
| + | |||
| + | static int run_cmd(const char *cmd) | ||
| + | { | ||
| + | char **argv; | ||
| + | static char *envp[] = { | ||
| + | " | ||
| + | " | ||
| + | NULL | ||
| + | }; | ||
| + | int ret; | ||
| + | argv = argv_split(GFP_KERNEL, | ||
| + | if (argv) { | ||
| + | ret = call_usermodehelper(argv[0], | ||
| + | argv_free(argv); | ||
| + | } else { | ||
| + | ret = -ENOMEM; | ||
| + | } | ||
| + | |||
| + | return ret; | ||
| } | } | ||
| </ | </ | ||