GETMNTENT(3,L) AIX Technical Reference GETMNTENT(3,L)
-------------------------------------------------------------------------------
getmntent, setmntent, addmntent, endmntent, hasmntopt
PURPOSE
Gets file system descriptor file entry.
LIBRARY
Standard C Library (libc.a)
SYNTAX
#include <stdio.h>
#include <mntent.h>
struct mntent *getmntent(filep) int addmntent(filep,mnt)
FILE *filep; FILE *filep
struct mntent *mnt;
FILE *setmntent(filep, type) int endmntent(filep)
char *filep; FILE *filep;
char *type;
char *hasmntopt(mnt, opt)
struct mntent *mnt;
char *opt;
DESCRIPTION
These routines are used to access the mounted file system description file
/etc/mtab. In a TCF cluster, /etc/mtab is a symbolic link to a local-only
file. To find out about file systems mounted on other sites, you must specify
that site's <LOCAL>/mtab file to setmntent.
The setmntent routine opens a mounted 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. The getmntent routine reads the
next line from filep and returns a pointer to an object with the following
Processed November 7, 1990 GETMNTENT(3,L) 1
GETMNTENT(3,L) AIX Technical Reference GETMNTENT(3,L)
structure containing the broken-out fields of a line in the mounted file system
description file, <mntent.h>.
The fields have meanings described in mntent:
struct mntent {
char *mnt_fsname; /* file system name */
char *mnt_dir; /* file system path prefix */
char *mnt_type; /* ufs, nfs, swap, or xx */
char *mnt_opts; /* ro, quota, etc. */
int mnt_freq; /* dump frequency, in days */
int mnt_checkno; /* check number for parallel fsck */
char mnt_flags; /* file system flags */
gfs_t mnt_gfs; /* global file system number */
pckno_t mnt_pack; /* pack number */
long mnt_time; /* time when mounted */
};
The addmntent routine 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. The
hasmntopt routine 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; otherwise, it returns the value 0. The endmntent routine closes the
file.
Warning: The returned mntent structure points to static information that is
overwritten in each call.
RETURN VALUE
A NULL pointer (0) is returned if an error occurs or the end of a file is
reached.
FILE
/etc/mtab
RELATED INFORMATION
In this book: "mntent, mtab."
Processed November 7, 1990 GETMNTENT(3,L) 2