Reputation: 23770
I need to run some code on storage device mounting and unmounting.
How can i listen for these events on linux?
Upvotes: 4
Views: 5734
Reputation: 10393
You have to listen to the "uevent" signal. Attach a callback to this signal and wait for the notification.
Upvotes: 2
Reputation:
You can use libudev or the more convenient, glib based gudev to monitor udev events in C.
Upvotes: 6