GETMNTENT(3) COMMAND REFERENCE GETMNTENT(3) NAME getmntent, setmntent, addmntent, endmntent, hasmntopt - get file system descriptor file entry SYNOPSIS #include <stdio.h> #include <mntent.h> FILE *setmntent(filep, type) char *filep; char *type; struct mntent *getmntent(filep) FILE *filep; int addmntent(filep, mnt) FILE *filep; struct mntent *mnt; char *hasmntopt(mnt, opt) struct mntent *mnt; char *opt; int endmntent(filep) FILE *filep; DESCRIPTION These routines replace the getfsent routines for accessing the file system description file /etc/fstab; they are also used to access the mounted file system description file /etc/mtab. The routine setmntent opens a file system description file and returns a file pointer which can then be used with getmntent, addmntent, or endmntent. The type argument is the same as in fopen(3). The routine getmntent reads the next line from filep and returns a pointer to an object with the following structure containing the broken-out fields of a line in the file system description file, <mntent.h>. The fields have meanings described in fstab(5). struct mntent { char *mnt_fsname; /* file system name */ char *mnt_dir; /* file system path prefix */ char *mnt_type; /* 4.2, nfs, swap, or xx */ char *mnt_opts; /* ro, quota, etc. */ int mnt_freq; /* dump frequency, in days */ int mnt_passno; /* pass number on parallel fsck */ }; The routine addmntent adds the mntent structure mnt to the end of the open file filep. Note that filep has to be opened for writing if this is to work. Routine hasmntopt scans the mnt_opts field of the mntent structure mnt for a substring that matches opt; it returns the address of the substring if a match is found, and returns 0 otherwise. Routine endmntent closes the file. Printed 3/13/89 1
GETMNTENT(3) COMMAND REFERENCE GETMNTENT(3) FILES /etc/fstab /etc/mtab RETURN VALUE Null pointer (0) returned on end-of-file or error. CAVEATS The returned mntent structure points to static information that is overwritten in each call. SEE ALSO getfsent(3), fstab(5). Printed 3/13/89 2
%%index%% na:360,150; sy:510,2973; de:3483,2510; fi:6425,118; rv:6543,180; ca:6723,194; se:6917,176; %%index%%000000000124