I have seen something like
setmntent(MOUNTED, "r");
What is the significance of MOUNTED
? Is it a keyword? Macro?
After reading the man page of setmntent
, I was of the opinion that the first argument to setmntent
is file*
which could be /etc/mtab
or /proc/mounts
. But this MOUNTED
word has confused me.
Any help?
They are Macros in mmtent.h.
/* File listing canonical interesting mount points. */
#define MNTTAB _PATH_MNTTAB /* Deprecated alias. */
/* File listing currently active mount points. */
#define MOUNTED _PATH_MOUNTED /* Deprecated alias. */
Defines the type struct mntent and the macros MNTTAB, MOUNTED, MNTTYPE_, MNTOPT_, and declares the functions setmntent, getmntent, getmntent_r, addmntent, endmntent, hasmntopt.
The macros FSTAB, MNTTAB, and MOUNTED define a Path, but they are an deprecated alias and _PATH_MNTTAB
and _PATH_MOUNTED
should be used.
#define _PATH_FSTAB "/etc/fstab"
(fstab.h)
#define _PATH_MOUNTED "/etc/mtab"
(ie. paths.h of glibc)
see Mount-Information.