version 1, including all changes.
.
Rev |
Author |
# |
Line |
1 |
perry |
1 |
GETMNTENT |
|
|
2 |
!!!GETMNTENT |
|
|
3 |
NAME |
|
|
4 |
SYNOPSIS |
|
|
5 |
DESCRIPTION |
|
|
6 |
RETURN VALUE |
|
|
7 |
FILES |
|
|
8 |
CONFORMING TO |
|
|
9 |
NOTES |
|
|
10 |
SEE ALSO |
|
|
11 |
---- |
|
|
12 |
!!NAME |
|
|
13 |
|
|
|
14 |
|
|
|
15 |
getmntent, setmntent, addmntent, endmntent, hasmntopt - get file system descriptor file entry |
|
|
16 |
!!SYNOPSIS |
|
|
17 |
|
|
|
18 |
|
|
|
19 |
__#include |
|
|
20 |
__''filename''__, const char *__''type''__); |
|
|
21 |
struct mntent *getmntent(FILE *__''filep''__); |
|
|
22 |
int addmntent(FILE *__''filep''__, const struct mntent *__''mnt''__); |
|
|
23 |
int endmntent(FILE *__''filep''__); |
|
|
24 |
char *hasmntopt(const struct mntent *__''mnt''__, const char *__''opt''__); |
|
|
25 |
__ |
|
|
26 |
!!DESCRIPTION |
|
|
27 |
|
|
|
28 |
|
|
|
29 |
These routines are used to access the file system |
|
|
30 |
description file ''/etc/fstab'' and the mounted file |
|
|
31 |
system description file ''/etc/mtab''. |
|
|
32 |
|
|
|
33 |
|
|
|
34 |
The __setmntent()__ function opens the file system |
|
|
35 |
description file ''filep'' and returns a file pointer |
|
|
36 |
which can be used by __getmntent()__. The argument |
|
|
37 |
''type'' is the type of access required and can take the |
|
|
38 |
same values as the ''mode'' argument of |
|
|
39 |
fopen(3). |
|
|
40 |
|
|
|
41 |
|
|
|
42 |
The __getmntent()__ function reads the next line from the |
|
|
43 |
file system description file ''filep'' and returns a |
|
|
44 |
pointer to a structure containing the broken out fields from |
|
|
45 |
a line in the file. The pointer points to a static area of |
|
|
46 |
memory which is overwritten by subsequent calls to |
|
|
47 |
__getmntent()__. |
|
|
48 |
|
|
|
49 |
|
|
|
50 |
The __addmntent()__ function adds the mntent structure |
|
|
51 |
''mnt'' to the end of the open file |
|
|
52 |
''filep''. |
|
|
53 |
|
|
|
54 |
|
|
|
55 |
The __endmntent()__ function closes the file system |
|
|
56 |
description file ''filep''. |
|
|
57 |
|
|
|
58 |
|
|
|
59 |
The __hasmntopt()__ function scans the ''mnt_opts'' |
|
|
60 |
field (see below) of the mntent structure ''mnt'' for a |
|
|
61 |
substring that matches ''opt''. See |
|
|
62 |
'''' for valid mount |
|
|
63 |
options. |
|
|
64 |
|
|
|
65 |
|
|
|
66 |
The ''mntent'' structure is defined in |
|
|
67 |
'''' as follows: |
|
|
68 |
|
|
|
69 |
|
|
|
70 |
struct mntent { |
|
|
71 |
char *mnt_fsname; /* name of mounted file system */ |
|
|
72 |
char *mnt_dir; /* file system path prefix */ |
|
|
73 |
char *mnt_type; /* mount type (see mntent.h) */ |
|
|
74 |
char *mnt_opts; /* mount options (see mntent.h) */ |
|
|
75 |
int mnt_freq; /* dump frequency in days */ |
|
|
76 |
int mnt_passno; /* pass number on parallel fsck */ |
|
|
77 |
}; |
|
|
78 |
!!RETURN VALUE |
|
|
79 |
|
|
|
80 |
|
|
|
81 |
The __getmntent()__ function returns a pointer to the |
|
|
82 |
mntent structure or NULL on failure. |
|
|
83 |
|
|
|
84 |
|
|
|
85 |
The __addmntent()__ function returns 0 on success and 1 |
|
|
86 |
on failure. |
|
|
87 |
|
|
|
88 |
|
|
|
89 |
The __endmntent()__ function always returns |
|
|
90 |
1. |
|
|
91 |
|
|
|
92 |
|
|
|
93 |
The __hasmntopt()__ function returns the address of the |
|
|
94 |
substring if a match is found and NULL |
|
|
95 |
otherwise. |
|
|
96 |
!!FILES |
|
|
97 |
|
|
|
98 |
|
|
|
99 |
/etc/fstab file system description file |
|
|
100 |
/etc/mtab mounted file system description file |
|
|
101 |
!!CONFORMING TO |
|
|
102 |
|
|
|
103 |
|
|
|
104 |
SunOS 4.1.3. |
|
|
105 |
!!NOTES |
|
|
106 |
|
|
|
107 |
|
|
|
108 |
SysV also has a __getmntent()__ function but the calling |
|
|
109 |
sequence differs, and the returned structure is different. |
|
|
110 |
Under SysV ''/etc/mnttab'' is used. BSD 4.4 and Digital |
|
|
111 |
Unix have a routine __getmntinfo()__, a wrapper around |
|
|
112 |
the system call __getfsstat()__. |
|
|
113 |
!!SEE ALSO |
|
|
114 |
|
|
|
115 |
|
|
|
116 |
fopen(3), fstab(5) |
|
|
117 |
---- |