getmntent(3) Library Functions Manual getmntent(3) getmntent, setmntent, addmntent, endmntent, hasmntopt, getmntent_r - (libc -lc) #include #include FILE *setmntent(const char *path, const char *type); struct mntent *getmntent(FILE *stream); int addmntent(FILE *restrict stream, const struct mntent *restrict mnt); int endmntent(FILE *streamp); char *hasmntopt(const struct mntent *mnt, const char *opt); /* GNU extension */ #include struct mntent *getmntent_r(int size; FILE *restrict streamp, struct mntent *restrict mntbuf, char buf[restrict size], int size); glibc ( feature_test_macros(7)): getmntent_r(): glibc 2.19: _DEFAULT_SOURCE glibc 2.19 : _BSD_SOURCE || _SVID_SOURCE /etc/fstab /etc/mtab. setmntent() path getmntent(). type mode fopen(3). endmntent() fclose(3). getmntent() stream . getmntent(). addmntent() mntent mnt stream. endmntent() stream . hasmntopt() mnt_opts ( ) mntent mnt opt. mount(8) . getmntent_r() getmntent() mntent *mntbuf buf size. mntent : struct mntent { char *mnt_fsname; /* */ char *mnt_dir; /* */ char *mnt_type; /* ( mntent.h) */ char *mnt_opts; /* ( mntent.h) */ int mnt_freq; /* (dump) */ int mnt_passno; /* fsck */ }; mtab fstab (\040) (\011) (\012) (\\) mntent. addmntent() getmntent() . \134 . getmntent() getmntent_r() mntent NULL . addmntent() 0 1 . endmntent() 1. hasmntopt() NULL . /etc/fstab /etc/mtab attributes(7). +----------------------+------------------------------------+----------+ | | | | +----------------------+------------------------------------+----------+ |setmntent(), | | MT-Safe | |endmntent(), | | | |hasmntopt() | | | +----------------------+------------------------------------+----------+ |getmntent() | | MT-Unsafe | | | | race:mntentbuf | | | | locale | +----------------------+------------------------------------+----------+ |addmntent() | | MT-Safe | | | | race:stream | | | | locale | +----------------------+------------------------------------+----------+ |getmntent_r() | | | | | | (locale) | | | | | | | | | | | | | | | | (MT-Safe) | +----------------------+------------------------------------+----------+ . SunOS 4.1.3. getmntent_r() HP-UX 10 int. glibc . System V getmntent() . System V /etc/mnttab. 4.4BSD Digital UNIX getmntinfo() getfsstat(). fopen(3) fstab(5) mount(8) 3 . . : . 6.18 8 2026 getmntent(3)