Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

query about glib c setmntent function

Tags:

c

mount

glibc

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 setmntentis file* which could be /etc/mtab or /proc/mounts. But this MOUNTED word has confused me.

Any help?

like image 698
anon Avatar asked Jun 12 '26 17:06

anon


1 Answers

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.

like image 165
pce Avatar answered Jun 14 '26 09:06

pce



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!