Question

uevents has been sent from kernel space to user space through netlink socket.

In kernel, there must be something trigger uevent.

I guess there are two possibilities:

  1. Hardware interrupt - this means, once hardware interruption happened, kernel sends event to user space to signal that there is some events happened.

  2. 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?

Thanks

Was it helpful?

Solution

I can't agree with you about polling. uevent is event-based, so there is no polling.

Triggering uevent happened in many cases and I would rather start with figuring out what uevent types are exist?

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
};

So it's

  • Add event
  • Remove event
  • Change event
  • Move event
  • Online event
  • Offline event

KOBJ_MAX is special and marks and of enum.

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.

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 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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top