I am a bit confused with the questions listed below:
While I execute
udevadmon my desktop, it is able to listenueventsent from kernel. I think before the execution ofudevadm, it will check the availability ofudevd. That means, if theudevdis not available on my desktop,udevadmwill not be able to work. Is my thinking correct?To have the same functionality of
udevadm, I found that linux also provides another way
to archive this. It's callednetlink. What confuses me is If I do things this way, I could have exactly the same thing that I have by usingudevadm. Hence, what's the difference betweenudevvs.netlink socket?
socket(PF_NETLINK, SOCK_DGRAM, NETLINK_KOBJECT_UEVENT); <----The socket I created to listen to uevent.
Thanks for avd's feedback. I still have some questions to ask after having your feedback.
There are not only
udevdcan listen message from kernel, but alsoudevadmdoes. Is my thinking correct? Or udevadm is only to manageudevd.By setting up the socket binding to the
NETLINK_KOBJECT_UEVENT, the user space code can also listen uevent sent from kernel. At this point, It seems I have no reason to chooseudevto complete this function. Is there any different between these two approaches?In user space, Can two different processes listen to
ueventsimultaneously? Cannetlinksend the message to these processes in the same time?