]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/getfsent.3
fseeko.3: srcfix
[thirdparty/man-pages.git] / man3 / getfsent.3
CommitLineData
fea681da
MK
1.\" Copyright (C) 2002 Andries Brouwer (aeb@cwi.nl)
2.\"
93015253 3.\" %%%LICENSE_START(VERBATIM)
fea681da
MK
4.\" Permission is granted to make and distribute verbatim copies of this
5.\" manual provided the copyright notice and this permission notice are
6.\" preserved on all copies.
7.\"
8.\" Permission is granted to copy and distribute modified versions of this
9.\" manual under the conditions for verbatim copying, provided that the
10.\" entire resulting derived work is distributed under the terms of a
11.\" permission notice identical to this one.
c13182ef 12.\"
fea681da
MK
13.\" Since the Linux kernel and libraries are constantly changing, this
14.\" manual page may be incorrect or out-of-date. The author(s) assume no
15.\" responsibility for errors or omissions, or for damages resulting from
16.\" the use of the information contained herein. The author(s) may not
17.\" have taken the same level of care in the production of this manual,
18.\" which is licensed free of charge, as they might when working
19.\" professionally.
c13182ef 20.\"
fea681da
MK
21.\" Formatted or processed versions of this manual, if unaccompanied by
22.\" the source, must acknowledge the copyright and authors of this work.
4b72fb64 23.\" %%%LICENSE_END
fea681da
MK
24.\"
25.\" Inspired by a page written by Walter Harms.
26.\"
4b8c67d9 27.TH GETFSENT 3 2017-09-15 "GNU" "Linux Programmer's Manual"
fea681da
MK
28.SH NAME
29getfsent, getfsspec, getfsfile, setfsent, endfsent \- handle fstab entries
30.SH SYNOPSIS
31.B #include <fstab.h>
68e4db0a 32.PP
0daa9e92 33.B "void endfsent(void);"
68e4db0a 34.PP
0daa9e92 35.B "struct fstab *getfsent(void);"
68e4db0a 36.PP
fea681da 37.BI "struct fstab *getfsfile(const char *" mount_point );
68e4db0a 38.PP
fea681da 39.BI "struct fstab *getfsspec(const char *" special_file );
68e4db0a 40.PP
0daa9e92 41.B "int setfsent(void);"
fea681da
MK
42.SH DESCRIPTION
43These functions read from the file
44.IR /etc/fstab .
c9942389
MK
45The
46.IR "struct fstab"
47is defined by:
dd3568a1 48.PP
088a639b 49.in +4n
b8302363 50.EX
fea681da 51struct fstab {
296d592b
MK
52 char *fs_spec; /* block device name */
53 char *fs_file; /* mount point */
d647d5e1 54 char *fs_vfstype; /* file-system type */
296d592b
MK
55 char *fs_mntops; /* mount options */
56 const char *fs_type; /* rw/rq/ro/sw/xx option */
57 int fs_freq; /* dump frequency, in days */
58 int fs_passno; /* pass number on parallel dump */
fea681da 59};
b8302363 60.EE
296d592b
MK
61.in
62.PP
fea681da
MK
63Here the field
64.I fs_type
65contains (on a *BSD system)
66one of the five strings "rw", "rq", "ro", "sw", "xx"
67(read-write, read-write with quota, read-only, swap, ignore).
847e0d88 68.PP
fea681da 69The function
63aa9df0 70.BR setfsent ()
fea681da 71opens the file when required and positions it at the first line.
dd3568a1 72.PP
fea681da 73The function
63aa9df0 74.BR getfsent ()
fea681da
MK
75parses the next line from the file.
76(After opening it when required.)
dd3568a1 77.PP
fea681da 78The function
63aa9df0 79.BR endfsent ()
fea681da 80closes the file when required.
dd3568a1 81.PP
fea681da 82The function
63aa9df0 83.BR getfsspec ()
fea681da
MK
84searches the file from the start and returns the first entry found
85for which the
86.I fs_spec
87field matches the
88.I special_file
89argument.
dd3568a1 90.PP
fea681da 91The function
63aa9df0 92.BR getfsfile ()
fea681da
MK
93searches the file from the start and returns the first entry found
94for which the
95.I fs_file
96field matches the
97.I mount_point
98argument.
47297adb 99.SH RETURN VALUE
fea681da 100Upon success, the functions
63aa9df0
MK
101.BR getfsent (),
102.BR getfsfile (),
fea681da 103and
63aa9df0 104.BR getfsspec ()
c9942389
MK
105return a pointer to a
106.IR "struct fstab" ,
107while
63aa9df0 108.BR setfsent ()
fea681da
MK
109returns 1.
110Upon failure or end-of-file, these functions return NULL and 0, respectively.
889829be
MK
111.\" .SH HISTORY
112.\" The
113.\" .BR getfsent ()
114.\" function appeared in 4.0BSD; the other four functions appeared in 4.3BSD.
a93d3fc0
PH
115.SH ATTRIBUTES
116For an explanation of the terms used in this section, see
117.BR attributes (7).
118.TS
119allbox;
3b399480 120lb lb lbw24
a93d3fc0
PH
121l l l.
122Interface Attribute Value
123T{
a93d3fc0 124.BR endfsent (),
3b399480
MS
125.br
126.BR setfsent ()
127T} Thread safety MT-Unsafe race:fsent
128T{
129.BR getfsent (),
130.br
a93d3fc0 131.BR getfsspec (),
3b399480 132.br
a93d3fc0 133.BR getfsfile ()
3b399480 134T} Thread safety MT-Unsafe race:fsent locale
a93d3fc0 135.TE
47297adb 136.SH CONFORMING TO
422470aa 137These functions are not in POSIX.1.
10850212
MK
138Several operating systems have them, for example,
139*BSD, SunOS, Digital UNIX, AIX (which also has a
31e9a9ec 140.BR getfstype ()).
0c2ec4f1 141HP-UX has functions of the same names,
c9942389
MK
142that however use a
143.IR "struct checklist"
144instead of a
145.IR "struct fstab" ,
0c2ec4f1 146and calls these functions obsolete, superseded by
fea681da
MK
147.BR getmntent (3).
148.SH NOTES
149These functions are not thread-safe.
dd3568a1 150.PP
fea681da
MK
151Since Linux allows mounting a block special device in several places,
152and since several devices can have the same mount point, where the
153last device with a given mount point is the interesting one,
154while
63aa9df0 155.BR getfsfile ()
fea681da 156and
63aa9df0 157.BR getfsspec ()
fea681da
MK
158only return the first occurrence, these two functions are not suitable
159for use under Linux.
47297adb 160.SH SEE ALSO
fea681da
MK
161.BR getmntent (3),
162.BR fstab (5)