1 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
3 .\" %%%LICENSE_START(VERBATIM)
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.
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.
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
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
25 .\" References consulted:
26 .\" Linux libc source code
27 .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
29 .\" Modified Sat Jul 24 21:46:57 1993 by Rik Faith (faith@cs.unc.edu)
30 .\" Modified 961109, 031115, aeb
32 .TH GETMNTENT 3 2019-03-06 "" "Linux Programmer's Manual"
34 getmntent, setmntent, addmntent, endmntent, hasmntopt,
35 getmntent_r \- get filesystem descriptor file entry
39 .B #include <mntent.h>
41 .BI "FILE *setmntent(const char *" filename ", const char *" type );
43 .BI "struct mntent *getmntent(FILE *" stream );
45 .BI "int addmntent(FILE *restrict " stream ,
46 .BI " const struct mntent *restrict " mnt );
48 .BI "int endmntent(FILE *" streamp );
50 .BI "char *hasmntopt(const struct mntent *" mnt ", const char *" opt );
53 .B #include <mntent.h>
55 .BI "struct mntent *getmntent_r(FILE *restrict " streamp ,
56 .BI " struct mntent *restrict " mntbuf ,
57 .BI " char *restrict " buf ", int " buflen );
61 Feature Test Macro Requirements for glibc (see
62 .BR feature_test_macros (7)):
69 Glibc 2.19 and earlier:
70 _BSD_SOURCE || _SVID_SOURCE
73 These routines are used to access the filesystem description file
75 and the mounted filesystem description file
80 function opens the filesystem description file
82 and returns a file pointer which can be used by
87 required and can take the same values as the
91 The returned stream should be closed using
98 function reads the next line of the filesystem
101 and returns a pointer to a structure
102 containing the broken out fields from a line in the file.
104 points to a static area of memory which is overwritten by subsequent
122 associated with the filesystem description file.
133 for a substring that matches
139 for valid mount options.
143 function is similar to
149 and stores the strings pointed to by the entries in that struct
150 in the provided array
157 structure is defined in
164 char *mnt_fsname; /* name of mounted filesystem */
165 char *mnt_dir; /* filesystem path prefix */
166 char *mnt_type; /* mount type (see mntent.h) */
167 char *mnt_opts; /* mount options (see mntent.h) */
168 int mnt_freq; /* dump frequency in days */
169 int mnt_passno; /* pass number on parallel fsck */
174 Since fields in the mtab and fstab files are separated by whitespace,
175 octal escapes are used to represent the characters space (\e040),
176 tab (\e011), newline (\e012), and backslash (\e\e) in those files
177 when they occur in one of the four strings in a
185 from string representation to escaped representation and back.
186 When converting from escaped representation, the sequence \e134 is
187 also converted to a backslash.
196 structure or NULL on failure.
200 function returns 0 on success and 1 on failure.
204 function always returns 1.
208 function returns the address of the substring if
209 a match is found and NULL otherwise.
213 filesystem description file
216 mounted filesystem description file
218 For an explanation of the terms used in this section, see
226 Interface Attribute Value
231 T} Thread safety MT-Safe
235 MT-Unsafe race:mntentbuf locale
240 MT-Safe race:stream locale
244 T} Thread safety MT-Safe locale
250 The nonreentrant functions are from SunOS 4.1.3.
253 was introduced in HP-UX 10, but it returns an
255 The prototype shown above is glibc-only.
259 function but the calling sequence
260 differs, and the returned structure is different.
264 4.4BSD and Digital UNIX have a routine
266 a wrapper around the system call