man.bsd.lv manual page server

Manual Page Search Parameters

GETFSENT(3) Library Functions Manual GETFSENT(3)

getfsent, getfsspec, getfsfile, setfsent, endfsentget file system descriptor file entry

library “libc”

#include <fstab.h>

struct fstab *
getfsent(void);

struct fstab *
getfsspec(const char *spec);

struct fstab *
getfsfile(const char *file);

int
setfsent(void);

void
endfsent(void);

The (), getfsspec(), and getfsfile() functions each return a pointer to an object with the following structure containing the broken-out fields of a line in the file system description file, <fstab.h>.
struct fstab {
	char	*fs_spec;	/* block special device name */
	char	*fs_file;	/* file system path prefix */
	char	*fs_vfstype;	/* type of file system */
	char	*fs_mntops;	/* comma separated mount options */
	char	*fs_type;	/* rw, ro, sw, or xx */
	int	fs_freq;	/* dump frequency, in days */
	int	fs_passno;	/* pass number on parallel dump */
};

The fields have meanings described in fstab(5).

The () function opens the file (closing any previously opened file) or rewinds it if it is already open.

The () function closes the file.

The () and () functions search the entire file (opening it if necessary) for a matching special file name or file system file name.

For programs wishing to read the entire database, () reads the next entry (opening the file if necessary).

All entries in the file with a type field equivalent to FSTAB_XX are ignored.

The getfsent(), getfsspec(), and getfsfile() functions return a null pointer (0) on EOF or error. The setfsent() function returns 0 on failure, 1 on success. The endfsent() function returns nothing.

/etc/fstab
 

getfsspecname(3), fstab(5)

The getfsent() function appeared in 4.0BSD; the endfsent(), getfsfile(), getfsspec(), and setfsent() functions appeared in 4.3BSD.

These functions use static data storage; if the data is needed for future use, it should be copied before any subsequent calls overwrite it.

March 6, 2012 NetBSD-9.2