getfsent - Online Linux Manual PageSection : 3
Updated : 2022-12-15
Source : Linux man-pages 6.03

NAMEgetfsent, getfsspec, getfsfile, setfsent, endfsent − handle fstab entries

LIBRARYStandard C library (libc, −lc)

SYNOPSIS#include <fstab.h>int setfsent(void);" struct fstab *getfsent(void);" void endfsent(void);"struct fstab *getfsfile(const char *mount_point); struct fstab *getfsspec(const char *special_file);

DESCRIPTIONThese functions read from the file /etc/fstab. The struct fstab is defined by: struct fstab { char *fs_spec; /* block device name */ char *fs_file; /* mount point */ char *fs_vfstype; /* filesystem type */ char *fs_mntops; /* mount options */ const char *fs_type; /* rw/rq/ro/sw/xx option */ int fs_freq; /* dump frequency, in days */ int fs_passno; /* pass number on parallel dump */ };Here the field fs_type contains (on a *BSD system) one of the five strings "rw", "rq", "ro", "sw", "xx" (read-write, read-write with quota, read-only, swap, ignore). The function setfsent() opens the file when required and positions it at the first line. The function getfsent() parses the next line from the file. (After opening it when required.) The function endfsent() closes the file when required. The function getfsspec() searches the file from the start and returns the first entry found for which the fs_spec field matches the special_file argument. The function getfsfile() searches the file from the start and returns the first entry found for which the fs_file field matches the mount_point argument.

RETURN VALUEUpon success, the functions getfsent(), getfsfile(), and getfsspec() return a pointer to a struct fstab, while setfsent() returns 1. Upon failure or end-of-file, these functions return NULL and 0, respectively.

ATTRIBUTESFor an explanation of the terms used in this section, see attributes(7). InterfaceAttributeValue endfsent(), setfsent() Thread safety MT-Unsafe race:fsent getfsent(), getfsspec(), getfsfile() Thread safety MT-Unsafe race:fsent locale

STANDARDSThese functions are not in POSIX.1. Several operating systems have them, for example, *BSD, SunOS, Digital UNIX, AIX (which also has a getfstype()). HP-UX has functions of the same names, that however use a struct checklist instead of a struct fstab, and calls these functions obsolete, superseded by getmntent(3).

NOTESThese functions are not thread-safe. Since Linux allows mounting a block special device in several places, and since several devices can have the same mount point, where the last device with a given mount point is the interesting one, while getfsfile() and getfsspec() only return the first occurrence, these two functions are not suitable for use under Linux.

SEE ALSOgetmntent(3), fstab(5)
0
Johanes Gumabo
Data Size   :   11,449 byte
man-setfsent.3Build   :   2024-12-05, 20:55   :  
Visitor Screen   :   x
Visitor Counter ( page / site )   :   2 / 237,247
Visitor ID   :     :  
Visitor IP   :   18.191.171.136   :  
Visitor Provider   :   AMAZON-02   :  
Provider Position ( lat x lon )   :   39.962500 x -83.006100   :   x
Provider Accuracy Radius ( km )   :   1000   :  
Provider City   :   Columbus   :  
Provider Province   :   Ohio ,   :   ,
Provider Country   :   United States   :  
Provider Continent   :   North America   :  
Visitor Recorder   :   Version   :  
Visitor Recorder   :   Library   :  
Online Linux Manual Page   :   Version   :   Online Linux Manual Page - Fedora.40 - march=x86-64 - mtune=generic - 24.12.05
Online Linux Manual Page   :   Library   :   lib_c - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Online Linux Manual Page   :   Library   :   lib_m - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Data Base   :   Version   :   Online Linux Manual Page Database - 24.04.13 - march=x86-64 - mtune=generic - fedora-38
Data Base   :   Library   :   lib_c - 23.02.07 - march=x86-64 - mtune=generic - fedora.36

Very long time ago, I have the best tutor, Wenzel Svojanovsky . If someone knows the email address of Wenzel Svojanovsky , please send an email to johanes_gumabo@yahoo.co.id .
If error, please print screen and send to johanes_gumabo@yahoo.co.id
Under development. Support me via PayPal.