问题描述
uevents已通过netlink套接字从内核空间发送到用户空间.
uevents has been sent from kernel space to user space through netlink socket.
在内核中,必须有一些触发uevent的东西.
In kernel, there must be something trigger uevent.
我猜有两种可能性:
-
硬件中断-这意味着,一旦发生硬件中断,内核就会将事件发送到用户空间,以表明发生了某些事件.
Hardware interrupt - this means, once hardware interruption happened, kernel sends event to user space to signal that there is some events happened.
软件轮询-这意味着,总是有一个守护程序来检查这些文件系统,以查看是否有任何更改.如果是这样,则将这些信息更新到上层.
software polling - this means, there is always a daemon to check these file system to see if there is anything changed. If so, then update these info to upper layer.
任何人都可以提供您的反馈吗?
Could anyone provide your feedback?
谢谢
推荐答案
对于投票,我不同意您的看法. uevent
基于事件,因此没有轮询.
I can't agree with you about polling. uevent
is event-based, so there is no polling.
触发uevent的情况很多,我宁愿先弄清楚存在哪些类型?
Triggering uevent happened in many cases and I would rather start with figuring out what uevent types are exist?
稍作搜索,您就可以找到-在 include/linux/kobject.h
Little searching and here you go - in include/linux/kobject.h
enum kobject_action {
KOBJ_ADD,
KOBJ_REMOVE,
KOBJ_CHANGE,
KOBJ_MOVE,
KOBJ_ONLINE,
KOBJ_OFFLINE,
KOBJ_MAX
};
就这样
- 添加事件
- 删除事件
- 更改事件
- 移动事件
- 在线活动
- 离线活动
KOBJ_MAX
是特殊的标记和枚举.
KOBJ_MAX
is special and marks and of enum.
有两个实际发送uevent的函数-kobject_uevent
和kobject_uevent_env
.这些功能是通过上面列出的操作中的on调用的.
There are 2 functions that actually sends uevent - kobject_uevent
and kobject_uevent_env
. These functions are called with on of the actions listed above.
最后,回答您的问题.没有预定义的情况会触发uevent.如果您搜索 kobject_uevent
和 kobject_uevent_env
您将看到,它发生在不同的不相关内核子系统中的各种回调中.
Finally, to answer your questions. There are no predefined cases that will trigger uevent. If you search for calls of kobject_uevent
and kobject_uevent_env
you will see that it's happens in various callbacks in different unrelated kernel subsystems.
uevent是用于统一来自各种不相关驱动程序的通知的内核工具.因此,我认为没有众所周知的会触发uevent的事物列表.
uevent is kernel facility to unify notifications from various unrelated drivers. So I think there are no well known list of things that will trigger uevent.
这篇关于uevents如何在内核中触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!