OSDN Git Service

(split) LDP man-pages の original/ を v3.29 に更新。
[linuxjm/LDP_man-pages.git] / original / man3 / getfsent.3
1 .\" Copyright (C) 2002 Andries Brouwer (aeb@cwi.nl)
2 .\"
3 .\" Permission is granted to make and distribute verbatim copies of this
4 .\" manual provided the copyright notice and this permission notice are
5 .\" preserved on all copies.
6 .\"
7 .\" Permission is granted to copy and distribute modified versions of this
8 .\" manual under the conditions for verbatim copying, provided that the
9 .\" entire resulting derived work is distributed under the terms of a
10 .\" permission notice identical to this one.
11 .\"
12 .\" Since the Linux kernel and libraries are constantly changing, this
13 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
14 .\" responsibility for errors or omissions, or for damages resulting from
15 .\" the use of the information contained herein.  The author(s) may not
16 .\" have taken the same level of care in the production of this manual,
17 .\" which is licensed free of charge, as they might when working
18 .\" professionally.
19 .\"
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
22 .\"
23 .\" Inspired by a page written by Walter Harms.
24 .\"
25 .TH GETFSENT 3 2002-02-28 "GNU" "Linux Programmer's Manual"
26 .SH NAME
27 getfsent, getfsspec, getfsfile, setfsent, endfsent \- handle fstab entries
28 .SH SYNOPSIS
29 .B #include <fstab.h>
30 .sp
31 .B "void endfsent(void);"
32 .sp
33 .B "struct fstab *getfsent(void);"
34 .sp
35 .BI "struct fstab *getfsfile(const char *" mount_point );
36 .sp
37 .BI "struct fstab *getfsspec(const char *" special_file );
38 .sp
39 .B "int setfsent(void);"
40 .SH DESCRIPTION
41 These functions read from the file
42 .IR /etc/fstab .
43 The \fIstruct fstab\fP is defined by:
44 .LP
45 .in +4n
46 .nf
47 struct fstab {
48     char       *fs_spec;       /* block device name */
49     char       *fs_file;       /* mount point */
50     char       *fs_vfstype;    /* file-sysem type */
51     char       *fs_mntops;     /* mount options */
52     const char *fs_type;       /* rw/rq/ro/sw/xx option */
53     int         fs_freq;       /* dump frequency, in days */
54     int         fs_passno;     /* pass number on parallel dump */
55 };
56 .fi
57 .in
58 .PP
59 Here the field
60 .I fs_type
61 contains (on a *BSD system)
62 one of the five strings "rw", "rq", "ro", "sw", "xx"
63 (read-write, read-write with quota, read-only, swap, ignore).
64
65 The function
66 .BR setfsent ()
67 opens the file when required and positions it at the first line.
68 .LP
69 The function
70 .BR getfsent ()
71 parses the next line from the file.
72 (After opening it when required.)
73 .LP
74 The function
75 .BR endfsent ()
76 closes the file when required.
77 .LP
78 The function
79 .BR getfsspec ()
80 searches the file from the start and returns the first entry found
81 for which the
82 .I fs_spec
83 field matches the
84 .I special_file
85 argument.
86 .LP
87 The function
88 .BR getfsfile ()
89 searches the file from the start and returns the first entry found
90 for which the
91 .I fs_file
92 field matches the
93 .I mount_point
94 argument.
95 .SH "RETURN VALUE"
96 Upon success, the functions
97 .BR getfsent (),
98 .BR getfsfile (),
99 and
100 .BR getfsspec ()
101 return a pointer to a \fIstruct fstab\fP, while
102 .BR setfsent ()
103 returns 1.
104 Upon failure or end-of-file, these functions return NULL and 0, respectively.
105 .\" .SH HISTORY
106 .\" The
107 .\" .BR getfsent ()
108 .\" function appeared in 4.0BSD; the other four functions appeared in 4.3BSD.
109 .SH "CONFORMING TO"
110 These functions are not in POSIX.1-2001.
111 Several operating systems have them,
112 e.g., *BSD, SunOS, Digital UNIX, AIX (which also has a
113 .BR getfstype ()).
114 HP-UX has functions of the same names,
115 that however use a \fIstruct checklist\fP
116 instead of a \fIstruct fstab\fP,
117 and calls these functions obsolete, superseded by
118 .BR getmntent (3).
119 .SH NOTES
120 These functions are not thread-safe.
121 .LP
122 Since Linux allows mounting a block special device in several places,
123 and since several devices can have the same mount point, where the
124 last device with a given mount point is the interesting one,
125 while
126 .BR getfsfile ()
127 and
128 .BR getfsspec ()
129 only return the first occurrence, these two functions are not suitable
130 for use under Linux.
131 .SH "SEE ALSO"
132 .BR getmntent (3),
133 .BR fstab (5)