I looked around and found this in a 2.6.22 changelog:
-What: mount/umount uevents
-When: February 2007
-Why: These events are not correct, and do not properly let userspace know
- when a file system has been mounted or unmounted. Userspace should
- poll the /proc/mounts file instead to detect this properly.
Curses... do I have to poll that file? Maybe I can use inotify. But, the mount/umount uevents work fine in the 126.96.36.199 kernel ...I wonder if the 2.6.25 kernel could be patched to bring them back?
Comments:Posted on 9 May 2008, 12:14 by BarryK
inotifywait does not work
Or rather, it doesn't work on anything inside /proc or /sys. 'inotifywait' is a utility in the 'inotify-tools' package. It is used to wait for an event on a file or directory. Grumble, grumble...
Posted on 9 May 2008, 21:27 by Everitt
IIRC aren't 'mount' and 'umount' scripts in puppy? Wouldn't it be possible to add something to send a signal whenever something is mounted and unmounted, and only look at the /proc/mounts when something has changed?
I'm not sure how easy that'd be to build into the existing uevents code though.
Posted on 9 May 2008, 24:30 by Everitt
Futher to 'Another option'
Hmm, I've been looking into it all day. As far as I can tell it is possible to write a userspace application to send events via netmessage (ie a 'mount' or 'umount' notification), which hotplug2stdout will recieve. Unfortunately the interface doesn't seem to have any userfriendly documentation. My knowledge of C is very limited, I work with numbers, not text, so all I'm able to send at the moment is a single char. Interestingly the udevadm monitor --kernel reports (null) (null) (null) when I do this, sujesting that there is some precise format the message should be sent in. I can't for the life of me work it out though.
If Puppy is only going to use a custom system (no udev) then I doubt that's an issue, assuming that a full string can be sent. It seems rather complicated when polling still works though...
If you're interested I can post the code I have to the forum, but I'm going to give up on it myself; I have exams to revise for. :(
Posted on 9 May 2008, 24:41 by Everitt
Sorry for posting so much!
Sorry, I keep missnig obvious idea!
Why not just add a line to the (u)mount scripts to write something to a file in /tmp or /var, and use inotifywait to detect this?
There is of course still the problem of monitoring uevents and mounting at the same time.