/* This is a non __init function. Force it to be noinline otherwise gcc736 * makes it inline to init() and it becomes part of init.text section737 */738static noinline int init_post(void)739{740/* need to finish all async __init code before freeing the memory */741 async_synchronize_full();742 free_initmem();743 mark_rodata_ro();744 system_state = SYSTEM_RUNNING;745 numa_default_policy();746747748 current->signal->flags |= SIGNAL_UNKILLABLE;749750if (ramdisk_execute_command) {751 run_init_process(ramdisk_execute_command);752 printk(KERN_WARNING "Failed to execute %s\n",753 ramdisk_execute_command);754 }755756/*757 * We try each of these until one succeeds.758 *759 * The Bourne shell can be used instead of init if we are760 * trying to recover a really broken machine.
從內核里發起系統調用,執行用戶空間的應用程序。這些程序自動以root權限運行。
761 */762if (execute_command) {763 run_init_process(execute_command);764 printk(KERN_WARNING "Failed to execute %s. Attempting "765"defaults...\n", execute_command);766 }767 run_init_process("/sbin/init");768 run_init_process("/etc/init");769 run_init_process("/bin/init");770 run_init_process("/bin/sh");771772 panic("No init found. Try passing init= option to kernel. "773"See Linux Documentation/init.txt for guidance.");774}
105static inline int106call_usermodehelper(char *path, char **argv, char **envp, enum umh_wait wait)107{108return call_usermodehelper_fns(path, argv, envp, wait,109 NULL, NULL, NULL);110}11150enum umh_wait {51 UMH_NO_WAIT = -1, /* don't wait at all */52 UMH_WAIT_EXEC = 0, /* wait for the exec, but not the process */53 UMH_WAIT_PROC = 1, /* wait for the process to complete */54};5556struct subprocess_info {57struct work_struct work;58struct completion *complete;59char *path;60char **argv;61char **envp;62enum umh_wait wait;63int retval;64int (*init)(struct subprocess_info *info);65void (*cleanup)(struct subprocess_info *info);66void *data;67};68kernel/kmod.c實現文件377/**378 * call_usermodehelper_exec - start a usermode application379 * @sub_info: information about the subprocessa 子進程的信息380 * @wait: wait for the application to finish and return status.等待用戶空間子進程的完成,并返回結果。381 * when -1 don't wait at all, but you get no useful error back when382 * the program couldn't be exec'ed. This makes it safe to call383 * from interrupt context.
384 *385 * Runs a user-space application. The application is started386 * asynchronously if wait is not set, and runs as a child of keventd.387 * (ie. it runs with full root capabilities).