I want my program always know all of the mountpoints. After a quick google I found that getmntent() and friends can tell me what is mounted. I realize I could do this everytime that I needed to know what was mounted, but is there some way to recognise when something gets mounted/unmounted so I don't have to keep reading the file? Is this what dBus does?
Any hints would be helpful. I'm trying to start programming (I took a course on C in 2002, when I was in college.) and found a feature I want to implement in an open source program.
Based on the mention of getmntent()
, I'm going to guess you're dealing with Linux (other Unices also include it, but they're a lot less common nowadays...). If that's the case, man inotify
should get you started.