52matlab技术网站,matlab教程,matlab安装教程,matlab下载
标题:
从linux kernel 调用应用层AP
[打印本页]
作者:
hjman
时间:
2015-3-20 18:36
标题:
从linux kernel 调用应用层AP
static void argv_cleanup(struct subprocess_info *info)
{
argv_free(info->argv);
}
char reboot_cmd[128] = "/system/bin/reboot";
int call_reboot_proc()
{
int argc;
char **argv = argv_split(GFP_ATOMIC, reboot_cmd, &argc);
static char *envp[] = {
"HOME=/",
"PATH=/sbin:/bin:/usr/sbin:/usr/bin:/system/bin",
NULL
};
int ret = -ENOMEM;
struct subprocess_info *info;
if (argv == NULL) {
printk(KERN_WARNING "%s failed to allocate memory for \"%s\"\n",
__func__, poweroff_cmd);
goto out;
}
info = call_usermodehelper_setup(argv[0], argv, envp, GFP_ATOMIC);
if (info == NULL) {
argv_free(argv);
goto out;
}
call_usermodehelper_setfns(info, NULL, argv_cleanup, NULL);
ret = call_usermodehelper_exec(info, UMH_NO_WAIT);
out:
return ret;
}
欢迎光临 52matlab技术网站,matlab教程,matlab安装教程,matlab下载 (http://www.52matlab.com/)
Powered by Discuz! X3.2