245 lines
5.8 KiB
HTML
245 lines
5.8 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of GETFSENT</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>GETFSENT</H1>
|
|
Section: Linux Programmer's Manual (3)<BR>Updated: 2017-09-15<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
getfsent, getfsspec, getfsfile, setfsent, endfsent - handle fstab entries
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
<B>#include <<A HREF="file:///usr/include/fstab.h">fstab.h</A>></B>
|
|
|
|
<P>
|
|
|
|
<B>void endfsent(void);</B>
|
|
|
|
<P>
|
|
|
|
<B>struct fstab *getfsent(void);</B>
|
|
|
|
<P>
|
|
|
|
<B>struct fstab *getfsfile(const char *</B><I>mount_point</I><B>);</B>
|
|
|
|
<P>
|
|
|
|
<B>struct fstab *getfsspec(const char *</B><I>special_file</I><B>);</B>
|
|
|
|
<P>
|
|
|
|
<B>int setfsent(void);</B>
|
|
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
These functions read from the file
|
|
<I>/etc/fstab</I>.
|
|
|
|
The
|
|
<I>struct fstab</I>
|
|
|
|
is defined by:
|
|
<P>
|
|
|
|
|
|
|
|
struct fstab {
|
|
<BR> char *fs_spec; /* block device name */
|
|
<BR> char *fs_file; /* mount point */
|
|
<BR> char *fs_vfstype; /* file-system type */
|
|
<BR> char *fs_mntops; /* mount options */
|
|
<BR> const char *fs_type; /* rw/rq/ro/sw/xx option */
|
|
<BR> int fs_freq; /* dump frequency, in days */
|
|
<BR> int fs_passno; /* pass number on parallel dump */
|
|
};
|
|
|
|
|
|
<P>
|
|
|
|
Here the field
|
|
<I>fs_type</I>
|
|
|
|
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).
|
|
<P>
|
|
|
|
The function
|
|
<B>setfsent</B>()
|
|
|
|
opens the file when required and positions it at the first line.
|
|
<P>
|
|
|
|
The function
|
|
<B>getfsent</B>()
|
|
|
|
parses the next line from the file.
|
|
(After opening it when required.)
|
|
<P>
|
|
|
|
The function
|
|
<B>endfsent</B>()
|
|
|
|
closes the file when required.
|
|
<P>
|
|
|
|
The function
|
|
<B>getfsspec</B>()
|
|
|
|
searches the file from the start and returns the first entry found
|
|
for which the
|
|
<I>fs_spec</I>
|
|
|
|
field matches the
|
|
<I>special_file</I>
|
|
|
|
argument.
|
|
<P>
|
|
|
|
The function
|
|
<B>getfsfile</B>()
|
|
|
|
searches the file from the start and returns the first entry found
|
|
for which the
|
|
<I>fs_file</I>
|
|
|
|
field matches the
|
|
<I>mount_point</I>
|
|
|
|
argument.
|
|
<A NAME="lbAE"> </A>
|
|
<H2>RETURN VALUE</H2>
|
|
|
|
Upon success, the functions
|
|
<B>getfsent</B>(),
|
|
|
|
<B>getfsfile</B>(),
|
|
|
|
and
|
|
<B>getfsspec</B>()
|
|
|
|
return a pointer to a
|
|
<I>struct fstab</I>,
|
|
|
|
while
|
|
<B>setfsent</B>()
|
|
|
|
returns 1.
|
|
Upon failure or end-of-file, these functions return NULL and 0, respectively.
|
|
|
|
|
|
|
|
|
|
<A NAME="lbAF"> </A>
|
|
<H2>ATTRIBUTES</H2>
|
|
|
|
For an explanation of the terms used in this section, see
|
|
<B><A HREF="/cgi-bin/man/man2html?7+attributes">attributes</A></B>(7).
|
|
|
|
<TABLE BORDER>
|
|
<TR VALIGN=top><TD><B>Interface</B></TD><TD><B>Attribute</B></TD><TD><B>Value</B><BR></TD></TR>
|
|
<TR VALIGN=top><TD>
|
|
<B>endfsent</B>(),
|
|
|
|
<BR>
|
|
|
|
<B>setfsent</B>()
|
|
|
|
</TD><TD>Thread safety</TD><TD>MT-Unsafe race:fsent<BR></TD></TR>
|
|
<TR VALIGN=top><TD>
|
|
<B>getfsent</B>(),
|
|
|
|
<BR>
|
|
|
|
<B>getfsspec</B>(),
|
|
|
|
<BR>
|
|
|
|
<B>getfsfile</B>()
|
|
|
|
</TD><TD>Thread safety</TD><TD>MT-Unsafe race:fsent locale<BR></TD></TR>
|
|
</TABLE>
|
|
|
|
<A NAME="lbAG"> </A>
|
|
<H2>CONFORMING TO</H2>
|
|
|
|
These functions are not in POSIX.1.
|
|
Several operating systems have them, for example,
|
|
*BSD, SunOS, Digital UNIX, AIX (which also has a
|
|
<B>getfstype</B>()).
|
|
|
|
HP-UX has functions of the same names,
|
|
that however use a
|
|
<I>struct checklist</I>
|
|
|
|
instead of a
|
|
<I>struct fstab</I>,
|
|
|
|
and calls these functions obsolete, superseded by
|
|
<B><A HREF="/cgi-bin/man/man2html?3+getmntent">getmntent</A></B>(3).
|
|
|
|
<A NAME="lbAH"> </A>
|
|
<H2>NOTES</H2>
|
|
|
|
These functions are not thread-safe.
|
|
<P>
|
|
|
|
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
|
|
<B>getfsfile</B>()
|
|
|
|
and
|
|
<B>getfsspec</B>()
|
|
|
|
only return the first occurrence, these two functions are not suitable
|
|
for use under Linux.
|
|
<A NAME="lbAI"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+getmntent">getmntent</A></B>(3),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?5+fstab">fstab</A></B>(5)
|
|
|
|
<A NAME="lbAJ"> </A>
|
|
<H2>COLOPHON</H2>
|
|
|
|
This page is part of release 5.05 of the Linux
|
|
<I>man-pages</I>
|
|
|
|
project.
|
|
A description of the project,
|
|
information about reporting bugs,
|
|
and the latest version of this page,
|
|
can be found at
|
|
<A HREF="https://www.kernel.org/doc/man-pages/.">https://www.kernel.org/doc/man-pages/.</A>
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="1"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="2"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="3"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DT id="4"><A HREF="#lbAE">RETURN VALUE</A><DD>
|
|
<DT id="5"><A HREF="#lbAF">ATTRIBUTES</A><DD>
|
|
<DT id="6"><A HREF="#lbAG">CONFORMING TO</A><DD>
|
|
<DT id="7"><A HREF="#lbAH">NOTES</A><DD>
|
|
<DT id="8"><A HREF="#lbAI">SEE ALSO</A><DD>
|
|
<DT id="9"><A HREF="#lbAJ">COLOPHON</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:44 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|