I am looking for a solution to get the list of all tmpfs mount points available on my Linux system and I need to get it from a C/C++ program.
I need a generic solution that is not distro dependent.
I don't want to access /proc/mounts or /etc/fstab.
I don't want to use a system() or popen().
Is there another way?
Thanks for your help!
The way
mountimplements this is to read/etc/mtab-strace mountis the fastest way to verify this if you don't have the source at hand. But as/etc/mtabis updated by mount/umount, and/proc/mountsis managed by the kernel itself,/proc/mountsis the better idea of the 2, and it's there on every linux system, independent of distro (hmm, maybe my Suse 4.4.2 which dates back to 1996 is an exception).Or, if you want to be portable to non-linux Unixes, use the getmntent family of functions - but as the manual page states, other unixes have functions with the same name perform differently from the linux implementation, so while your code may compile on non-linux unixes, it won't neccesarily work correctly there.