Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ getmntent(3X) — HP-UX 6.00

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

checklist(4)

getfsent(3X)

mntent(4)

mnttab(4)

GETMNTENT(3X)  —  HP-UX

Series 300 Only

NAME

setmntent, getmntent, addmntent, endmntent, hasmntopt − get file system descriptor file entry

SYNOPSIS

#include <stdio.h>
#include <mntent.h>
FILE *setmntent(filename, type)
char *filename;
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/checklist.  They are also used to access the mounted file system description file /etc/mnttab. 

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(3C). 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 filesystem description file, <mntent.h>.  The fields have meanings described in checklist(4).

struct mntent {

char *mnt_fsname; /* file system name */
char *mnt_dir; /* file system path prefix */
char *mnt_type; /* hfs, nfs, swap, or xx */
char *mnt_opts; /* ro, suid, etc. */
int mnt_freq; /* dump frequency, in days */
int mnt_passno; /* pass number on parallel fsck */
long mnt_time; /* When file system was mounted; */
  /* see mnttab(4). */

};

Addmntent adds the mntent structure mnt to the end of the open file filep. Note that filep must be opened for writing.  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, 0 otherwise.  Endmntent closes the file. 

The following definitions are provided in <mntent.h>:

#define MNT_CHECKLIST "/etc/checklist"
#define MNT_MNTTAB "/etc/mnttab"
#define MNTMAXSTR 128 /* Max size string in mntent */
#define MNTTYPE_HFS "hfs" /* HFS file system */
#define MNTTYPE_NFS "nfs" /* Network file system */
#define MNTTYPE_SWAP "swap" /* Swap file system */
#define MNTTYPE_IGNORE "ignore" /* Ignore this entry */
#define MNTOPT_DEFAULTS "defaults" /* Use all default options */
#define MNTOPT_RO "ro" /* Read only */
#define MNTOPT_RW "rw" /* Read/write */
#define MNTOPT_SUID "suid" /* Set uid allowed */
#define MNTOPT_NOSUID "nosuid" /* No set uid allowed */

NETWORKING FEATURES

NFS

The following definitions are provided in <mntent.h>:

#define MNTOPT_BG "bg" /* Retry mount in background */
#define MNTOPT_FG "fg" /* Retry mount in foreground */
#define MNTOPT_RETRY "retry" /* Number of retries allowed */
#define MNTOPT_RSIZE "rsize" /* Read buffer size in bytes */
#define MNTOPT_WSIZE "wsize" /* Write buffer size in bytes*/
#define MNTOPT_TIMEO "timeo" /* Timeout in 1/10 seconds */
#define MNTOPT_RETRANS "retrans" /* Number of retransmissions */
#define MNTOPT_PORT "port" /* Server’s IP NFS port */
#define MNTOPT_SOFT "soft" /* Soft mount */
#define MNTOPT_HARD "hard" /* Hard mount */
#define MNTOPT_INTR "intr" /* Interruptable hard mounts */
#define MNTOPT_NOINTR "nointr" /* Uninterruptable hard mounts*/

RETURN VALUE

Setmntent returns a null pointer on error.  Getmntent will return a null pointer if the first entry on a line is not found.  Otherwise, getmntent returns a structure with null strings and −1 numeric fields for entries that are not found.  Addmntent returns 1 on error. 

WARNINGS

The returned mntent structure points to static information that is overwritten in each call. 

AUTHOR

Addmntent, endmntent, getmntent, hasmntopt and setmntent were developed by The University of California, Berkeley, Sun Microsystems, Inc.  and HP. 

FILES

/etc/checklist
/etc/mnttab

SEE ALSO

checklist(4), getfsent(3X), mntent(4), mnttab(4). 

Hewlett-Packard Company  —  Version B.1,  May 11, 2021

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026