1GETFSENT(3) Linux Programmer's Manual GETFSENT(3)
2
3
4
6 getfsent, getfsspec, getfsfile, setfsent, endfsent - handle fstab
7 entries
8
10 #include <fstab.h>
11
12 void endfsent(void);
13
14 struct fstab *getfsent(void);
15
16 struct fstab *getfsfile(const char *mount_point);
17
18 struct fstab *getfsspec(const char *special_file);
19
20 int setfsent(void);
21
23 These functions read from the file /etc/fstab. The struct fstab is
24 defined by:
25
26 struct fstab {
27 char *fs_spec; /* block device name */
28 char *fs_file; /* mount point */
29 char *fs_vfstype; /* file-sysem type */
30 char *fs_mntops; /* mount options */
31 const char *fs_type; /* rw/rq/ro/sw/xx option */
32 int fs_freq; /* dump frequency, in days */
33 int fs_passno; /* pass number on parallel dump */
34 };
35
36 Here the field fs_type contains (on a *BSD system) one of the five
37 strings "rw", "rq", "ro", "sw", "xx" (read-write, read-write with
38 quota, read-only, swap, ignore).
39
40 The function setfsent() opens the file when required and positions it
41 at the first line.
42
43 The function getfsent() parses the next line from the file. (After
44 opening it when required.)
45
46 The function endfsent() closes the file when required.
47
48 The function getfsspec() searches the file from the start and returns
49 the first entry found for which the fs_spec field matches the spe‐
50 cial_file argument.
51
52 The function getfsfile() searches the file from the start and returns
53 the first entry found for which the fs_file field matches the
54 mount_point argument.
55
57 Upon success, the functions getfsent(), getfsfile(), and getfsspec()
58 return a pointer to a struct fstab, while setfsent() returns 1. Upon
59 failure or end-of-file, these functions return NULL and 0, respec‐
60 tively.
61
63 These functions are not in POSIX.1-2001. Several operating systems
64 have them, e.g., *BSD, SunOS, Digital Unix, AIX (which also has a getf‐
65 stype()). HP-UX has functions of the same names, that however use a
66 struct checklist instead of a struct fstab, and calls these functions
67 obsolete, superseded by getmntent(3).
68
70 These functions are not thread-safe.
71
72 Since Linux allows mounting a block special device in several places,
73 and since several devices can have the same mount point, where the last
74 device with a given mount point is the interesting one, while getfs‐
75 file() and getfsspec() only return the first occurrence, these two
76 functions are not suitable for use under Linux.
77
79 getmntent(3), fstab(5)
80
82 This page is part of release 3.22 of the Linux man-pages project. A
83 description of the project, and information about reporting bugs, can
84 be found at http://www.kernel.org/doc/man-pages/.
85
86
87
88GNU 2002-02-28 GETFSENT(3)