Since I couldn't find any examples of how to receive Linux kernel uevent messages, I wrote a small demo to show how to read from the NETLINK_KOBJECT_UEVENT raw sockets and parse the messages into a text form: https://github.com/osresearch/safeboot/blob/master/src/uevent.c