I'm know I can monitor (using poll, or select) on the files /proc/mount or /etc/mtab and findout WHEN a filesystem is mounted or unmounted. Also I can use getmntent for getting a list of mounted filesystems.My app is intended to monitor the mounted filesystem and report any change (mount or unmount). My solution:Detect some change in /proc/mounts.Get all currently mounted filesystem with getmntent.Compare the obtained list with some previous list.Process the difference.But I need to know if there are some way to get the last filesystem mounted when polling from /proc/mounts or /etc/mtab. Just reading the file or polling data into some structure (like mntent for instance.)
How to get the name of the last mounted/unmounted filesystem
linux;mount;notifications