getmntent(3) Library Functions Manual getmntent(3) getmntent, setmntent, addmntent, endmntent, hasmntopt, getmntent_r - LIBRARY Standard C library (libc, -lc) #include #include FILE *setmntent(const char *filename, 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 */ #include struct mntent *getmntent_r(FILE *restrict streamp, struct mntent *restrict mntbuf, char buf[restrict .buflen], int buflen); glibc (. feature_test_macros(7)): getmntent_r(): glibc 2.19: _DEFAULT_SOURCE glibc 2.19 : _BSD_SOURCE || _SVID_SOURCE /etc/fstab /etc/mtab. setmntent() filename , getmntent(). type , mode fclose(3). endmntent(), fclose(3). getmntent() stream , . , getmntent(). addmntent() mnt mntent stream. endmntent() stream, . hashmntopt() mnt_opts ( ) mnt mntent , opt. mount(8). The reentrant getmntent_r() function is similar to getmntent(), but stores the mntent structure in the provided *mntbuf, and stores the strings pointed to by the entries in that structure in the provided array buf of size buflen. 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 , mntent : (\040), (\011), (\012) (\\). addmntent() getmntent() . , \134 . getmntent() getmntent_r() mntent NULL . addmntent() 0 1 . endmntent() 1. hasmntopt() , , NULL. /etc/fstab /etc/mtab attributes(7). +----------------------------+----------------------------------------------------------+--------------------------+ | | | | +----------------------------+----------------------------------------------------------+--------------------------+ |setmntent(), endmntent(), | | MT-Safe | |hasmntopt() | | | +----------------------------+----------------------------------------------------------+--------------------------+ |getmntent() | | MT-Unsafe race:mntentbuf | | | | locale | +----------------------------+----------------------------------------------------------+--------------------------+ |addmntent() | | MT-Safe race:stream | | | | locale | +----------------------------+----------------------------------------------------------+--------------------------+ |getmntent_r() | | MT-Safe locale | +----------------------------+----------------------------------------------------------+--------------------------+ None. The nonreentrant functions are from SunOS 4.1.3. A routine getmntent_r() was introduced in HP-UX 10, but it returns an int. The prototype shown above is glibc-only. System V also has a getmntent() function but the calling sequence differs, and the returned structure is different. Under System V /etc/mnttab is used. 4.4BSD and Digital UNIX have a routine getmntinfo(), a wrapper around the system call getfsstat(). . fopen(3), fstab(5), mount(8) Azamat Hackimov , Dmitry Bolkhovskikh , Vladislav , Yuri Kozlov ; GNU 3 , . . , , . Linux man-pages 6.06 31 2023 . getmntent(3)