]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - 6/lib/libc/gen/getfsent.3
merge fix for boot-time hang on centos' xen
[FreeBSD/FreeBSD.git] / 6 / lib / libc / gen / getfsent.3
1 .\" Copyright (c) 1983, 1991, 1993
2 .\"     The Regents of the University of California.  All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\"    notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\"    notice, this list of conditions and the following disclaimer in the
11 .\"    documentation and/or other materials provided with the distribution.
12 .\" 3. All advertising materials mentioning features or use of this software
13 .\"    must display the following acknowledgement:
14 .\"     This product includes software developed by the University of
15 .\"     California, Berkeley and its contributors.
16 .\" 4. Neither the name of the University nor the names of its contributors
17 .\"    may be used to endorse or promote products derived from this software
18 .\"    without specific prior written permission.
19 .\"
20 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 .\" SUCH DAMAGE.
31 .\"
32 .\"     @(#)getfsent.3  8.1 (Berkeley) 6/4/93
33 .\" $FreeBSD$
34 .\"
35 .Dd April 7, 2003
36 .Dt GETFSENT 3
37 .Os
38 .Sh NAME
39 .Nm getfsent ,
40 .Nm getfsspec ,
41 .Nm getfsfile ,
42 .Nm setfsent ,
43 .Nm endfsent
44 .Nd get file system descriptor file entry
45 .Sh LIBRARY
46 .Lb libc
47 .Sh SYNOPSIS
48 .In fstab.h
49 .Ft "struct fstab *"
50 .Fn getfsent void
51 .Ft "struct fstab *"
52 .Fn getfsspec "const char *spec"
53 .Ft "struct fstab *"
54 .Fn getfsfile "const char *file"
55 .Ft int
56 .Fn setfsent void
57 .Ft void
58 .Fn endfsent void
59 .Ft void
60 .Fn setfstab "const char *file"
61 .Ft "const char *"
62 .Fn getfstab void
63 .Sh DESCRIPTION
64 The
65 .Fn getfsent ,
66 .Fn getfsspec ,
67 and
68 .Fn getfsfile
69 functions
70 each return a pointer to an object with the following structure
71 containing the broken-out fields of a line in the file system
72 description file,
73 .In fstab.h .
74 .Bd -literal -offset indent
75 struct fstab {
76         char    *fs_spec;       /* block special device name */
77         char    *fs_file;       /* file system path prefix */
78         char    *fs_vfstype;    /* File system type, ufs, nfs */
79         char    *fs_mntops;     /* Mount options ala -o */
80         char    *fs_type;       /* FSTAB_* from fs_mntops */
81         int     fs_freq;        /* dump frequency, in days */
82         int     fs_passno;      /* pass number on parallel fsck */
83 };
84 .Ed
85 .Pp
86 The fields have meanings described in
87 .Xr fstab 5 .
88 .Pp
89 The
90 .Fn setfsent
91 function
92 opens the file (closing any previously opened file) or rewinds it
93 if it is already open.
94 .Pp
95 The
96 .Fn endfsent
97 function
98 closes the file.
99 .Pp
100 The
101 .Fn setfstab
102 function sets the file to be used by subsequent operations.
103 The value set by
104 .Fn setfstab
105 does not persist across calls to
106 .Fn endfsent .
107 .Pp
108 The
109 .Fn getfstab
110 function returns the name of the file that will be used.
111 .Pp
112 The
113 .Fn getfsspec
114 and
115 .Fn getfsfile
116 functions
117 search the entire file (opening it if necessary) for a matching special
118 file name or file system file name.
119 .Pp
120 For programs wishing to read the entire database,
121 .Fn getfsent
122 reads the next entry (opening the file if necessary).
123 .Pp
124 All entries in the file with a type field equivalent to
125 .Dv FSTAB_XX
126 are ignored.
127 .Sh RETURN VALUES
128 The
129 .Fn getfsent ,
130 .Fn getfsspec ,
131 and
132 .Fn getfsfile
133 functions
134 return a
135 .Dv NULL
136 pointer on
137 .Dv EOF
138 or error.
139 The
140 .Fn setfsent
141 function
142 returns 0 on failure, 1 on success.
143 The
144 .Fn endfsent
145 function
146 returns nothing.
147 .Sh ENVIRONMENT
148 .Bl -tag -width ".Ev PATH_FSTAB"
149 .It Ev PATH_FSTAB
150 If the environment variable
151 .Ev PATH_FSTAB
152 is set, all operations are performed against the specified file.
153 .Ev PATH_FSTAB
154 will not be honored if the process environment or memory address space is
155 considered
156 .Dq tainted .
157 (See
158 .Xr issetugid 2
159 for more information.)
160 .El
161 .Sh FILES
162 .Bl -tag -width /etc/fstab -compact
163 .It Pa /etc/fstab
164 .El
165 .Sh SEE ALSO
166 .Xr fstab 5
167 .Sh HISTORY
168 The
169 .Fn getfsent
170 function appeared in
171 .Bx 4.0 ;
172 the
173 .Fn endfsent ,
174 .Fn getfsfile ,
175 .Fn getfsspec ,
176 and
177 .Fn setfsent
178 functions appeared in
179 .Bx 4.3 ;
180 the
181 .Fn setfstab
182 and
183 .Fn getfstab
184 functions appeared in
185 .Fx 5.1 .
186 .Sh BUGS
187 These functions use static data storage;
188 if the data is needed for future use, it should be
189 copied before any subsequent calls overwrite it.