GETMNTENT(3) BSD GETMNTENT(3)
NAME
getmntent, setmntent, addmntent, endmntent - fstab, mnttab manipulation
routines
SYNOPSIS
#include <stdio.h>
#include <sys/types.h>
#include <mtab.h>
FILE *setmntent(file)
int file;
struct mntent *getmntent(file)
int file;
int addmntent(ent)
struct mntent *ent;
int endmntent(file)
int file;
DESCRIPTION
setmntent opens the file indicated by file for reading, where file can be
either MNTTAB_FILE for /etc/mnttab or FSTAB_FILE for /etc/fstab. If the
file indicated by file was already open, setmntent closes and then
reopens it.
getmntent returns a pointer to an object with the following structure
containing the broken-out fields of a line in the file indicated by file.
The fields have meanings described in fstab(5).
struct mntent{
char *mnt_fsname; /* name of mounted file system */
char *mnt_dir; /* file system path prefix */
char *mnt_type; /* MNTTYPE_* */
char *mnt_opts; /* MNTOPT* */
time_t mnt_time; /* Time of mount */
int mnt_freq; /* dump frequency, in days */
int mnt_passno; /* pass number on parallel fsck */
};
addmntent adds the structure pointed to by ent to the end of /etc/mnttab.
addmntent works only when file is set to MNTTAB_FILE. endmntent closes
the file indicated by file.
FILES
/etc/fstab file system table
/etc/mnttab mounted file system table
SEE ALSO
fopen(3S), getfsent(3), fstab(5), mtab(5).
DIAGNOSTICS
These routines return the NULL pointer on EOF or error. setmntent
returns 1 if it opens the file indicated by file successfully.
BUGS
All information is contained in a static area, so it must be copied if it
is to be saved.