uevent机制

1:概要
uevent机制就是设备驱动模型中任意设备可以把uevent字符串上报给用户空间。主要用于热插拔设备或设备状态变化时。
无论是usermodehelper还是netlink的方式,uevent对系统性能是有影响的。特别是netlink的方式,上报的event会通知到所有的用户进程,所以还是少用为妙。

2:uevent模块提供的api接口

这两个接口用于上报uevent事件。

3:struct kset_uevent_ops
这个结构体是专门为kset实例定义的uevent 操作。

kobject_uevent_env
->ket-->uevent  // 由所属的kset统一添加环境变量(即键值字符串)
// 添加 由 char *envp[]参数保存的扩展或自定义环境变量

4:设备的uevent属性文件 read/write接口
\drivers\base\core.c

5:参考引用
http://www.wowotech.net/device_model/uevent.html
https://blog.csdn.net/W1107101310/article/details/80211885
https://blog.csdn.net/luckywang1103/article/details/50529534
https://blog.csdn.net/luckyapple1028/article/details/44261391
https://blog.csdn.net/zjujoe/article/details/2986634   uevent事件上报

posted @ 2020-11-12 00:01  bobfly1984  阅读(993)  评论(0编辑  收藏  举报