setmntent

Name

setmntent -- get file system descriptor file entry

Synopsis

#include <stdio.h>
#include <mntent.h>

FILE *setmntent(const char *filename, const char *type);

Description

This routine is used to access the file system description file /etc/fstab and the mounted file system description file /etc/mtab.

The setmntent() function opens the file system description file filep and returns a file pointer which can be used by getmntent(). The argument type is the type of access required and can take the same values as the mode argument of fopen(3).

The mntent structure is defined in <mntent.h> as follows:

struct mntent {

char *mnt_fsname; /* name of mounted file system */

char *mnt_dir; /* file system path prefix */

char *mnt_type; /* mount type (see mntent.h) */

char *mnt_opts; /* mount options (see mntent.h) */

int mnt_freq; /* dump frequency in days */

int mnt_passno; /* pass number on parallel fsck */

};

Files

/etc/fstab file system description file /etc/mtab mounted file system description file