I am a bit confused with the questions listed below:
While I execute
udevadm
on my desktop, it is able to listenuevent
sent from kernel. I think before the execution ofudevadm
, it will check the availability ofudevd
. That means, if theudevd
is not available on my desktop,udevadm
will 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 betweenudev
vs.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
udevd
can listen message from kernel, but alsoudevadm
does. 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 chooseudev
to complete this function. Is there any different between these two approaches?In user space, Can two different processes listen to
uevent
simultaneously? Cannetlink
send the message to these processes in the same time?