call_usermodehelper使用实例
来源:互联网 发布:源码资本 编辑:程序博客网 时间:2024/05/19 01:29
#define UMH_WAIT_PROC 1
char * argv[3];
argv[0] = "/sbin/mdev";argv[1] = "-s";
argv[2] = 0;
if (CallUserApp(argv)< 0)
{
printk("mdev -s failed\n");
break;
}
int CallUserApp(char * argv[])
{
int ret;
char *envp[3];
/* minimal command environment taken from cpu_run_sbin_hotplug */
envp[0] = "HOME=/";
envp[1] = "PATH=/sbin:/bin:/usr/sbin:/usr/bin";
envp[2] = NULL;
if (!argv || !argv[0])
{
printk( "%s argument is incorrect\n", __func__);
return -1;
}
ret = call_usermodehelper(argv[0], argv, envp, UMH_WAIT_PROC);
if (ret < 0) {
printk("running user helper \"%s \" failed %d\n", argv[0], ret);
}
return ret;
}
static inline int call_usermodehelper(char *path, char **argv, char **envp, enum umh_wait wait);
path --- 用户空间所要启用的应用程序路径,如:"/sbin/hotplug",那么hotplug应用程序就会被内核加载启用
argv --- 传递给启用了的用户空间应用程序的参数argv
envp --- 传递给启用了的用户空间应用程序的环境变量envp,类似int main(int argc, char *_argv[])模式
wait --- 调用call_usermodehelper的内核程序是否等到被exec的用户空间应用程序,
- call_usermodehelper使用实例
- Linux call_usermodehelper()
- call_usermodehelper函数
- 使用call_usermodehelper在Linux内核中直接运行用户空间程序
- 使用call_usermodehelper在Linux内核中直接运行用户空间程序
- 使用call_usermodehelper在Linux内核中直接运行用户空间程序
- 使用call_usermodehelper在Linux内核中直接运行用户空间程序
- 使用call_usermodehelper在Linux内核中直接运行用户空间程序
- 使用call_usermodehelper在Linux内核中直接运行用户空间程序
- call_usermodehelper()函数简介
- hotplug启动过程之call_usermodehelper分析
- Linux驱动层调用应用层程序--call_usermodehelper()
- call_usermodehelper() ---让内核空间的驱动程序启用用户空间的若干应用程序
- 避免使用实例陷阱
- SAFEARRAY使用实例
- log4j使用实例
- VSS使用实例1
- Label使用实例
- 在vs2008下使用ffmpeg(1):inttypes.h的问题
- HTML,JSP清除浏览器缓存的meta标签
- 数据分析方法汇总
- 使用递推最小二乘法(RLS算法)进行自适应噪声对消
- Android 复习笔记之图解TextView类及其XML相关属性和方法
- call_usermodehelper使用实例
- unity3D4.0.6学习笔记——Unity3D中的快捷键
- UML类图几种关系的总结
- iOS8中UITableVIew cell间分割线短的问题
- qmake生成的。pro文件解析
- 收集IIS配置错误-- 您未被授权查看该页
- Web_PHP_PHPMailer使用教程_使用PHPMailer发送邮件;
- 【转】datagridview 动态合并单元格代码
- Android官方开发相关下载资源一揽子大汇总