1 '\" te 2 .\" Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. 3 .\" Copyright 1989 AT&T 4 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. 5 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. 6 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] 7 .TH MNTTAB 4 "Dec 20, 2003" 8 .SH NAME 9 mnttab \- mounted file system table 10 .SH DESCRIPTION 11 .sp 12 .LP 13 The file \fB/etc/mnttab\fR is really a file system that provides read-only 14 access to the table of mounted file systems for the current host. 15 \fB/etc/mnttab\fR is read by programs using the routines described in 16 \fBgetmntent\fR(3C). Mounting a file system adds an entry to this table. 17 Unmounting removes an entry from this table. Remounting a file system causes 18 the information in the mounted file system table to be updated to reflect any 19 changes caused by the remount. The list is maintained by the kernel in order of 20 mount time. That is, the first mounted file system is first in the list and the 21 most recently mounted file system is last. When mounted on a mount point the 22 file system appears as a regular file containing the current \fBmnttab\fR 23 information. 24 .sp 25 .LP 26 Each entry is a line of fields separated by TABs in the form: 27 .sp 28 .in +2 29 .nf 30 \fIspecial mount_point fstype options time\fR 31 .fi 32 .in -2 33 34 .sp 35 .LP 36 where: 37 .sp 38 .ne 2 39 .na 40 \fB\fIspecial\fR\fR 41 .ad 42 .RS 15n 43 The name of the resource that has been mounted. 44 .RE 45 46 .sp 47 .ne 2 48 .na 49 \fB\fImount_point\fR\fR 50 .ad 51 .RS 15n 52 The pathname of the directory on which the filesystem is mounted. 53 .RE 54 55 .sp 56 .ne 2 57 .na 58 \fB\fIfstype\fR\fR 59 .ad 60 .RS 15n 61 The file system type of the mounted file system. 62 .RE 63 64 .sp 65 .ne 2 66 .na 67 \fB\fIoptions\fR\fR 68 .ad 69 .RS 15n 70 The mount options. See respective mount file system man page in the See Also 71 section below. 72 .RE 73 74 .sp 75 .ne 2 76 .na 77 \fB\fItime\fR\fR 78 .ad 79 .RS 15n 80 The time at which the file system was mounted. 81 .RE 82 83 .sp 84 .LP 85 Examples of entries for the \fIspecial\fR field include the pathname of a 86 block-special device, the name of a remote file system in the form of 87 \fIhost:pathname\fR, or the name of a \fBswap file\fR, for example, a file made 88 with \fBmkfile\fR(1M). 89 .SH IOCTLS 90 .sp 91 .LP 92 The following \fBioctl\fR(2) calls are supported: 93 .sp 94 .ne 2 95 .na 96 \fB\fBMNTIOC_NMNTS\fR\fR 97 .ad 98 .RS 21n 99 Returns the count of mounted resources in the current snapshot in the 100 \fBuint32_t\fR pointed to by \fIarg\fR. 101 .RE 102 103 .sp 104 .ne 2 105 .na 106 \fB\fBMNTIOC_GETDEVLIST\fR\fR 107 .ad 108 .RS 21n 109 Returns an array of \fBuint32_t\fR's that is twice as long as the length 110 returned by \fBMNTIOC_NMNTS\fR. Each pair of numbers is the major and minor 111 device number for the file system at the corresponding line in the current 112 \fB/etc/mnttab\fR snapshot. \fIarg\fR points to the memory buffer to receive 113 the device number information. 114 .RE 115 116 .sp 117 .ne 2 118 .na 119 \fB\fBMNTIOC_SETTAG\fR\fR 120 .ad 121 .RS 21n 122 Sets a tag word into the options list for a mounted file system. A tag is a 123 notation that will appear in the options string of a mounted file system but it 124 is not recognized or interpreted by the file system code. \fIarg\fR points to a 125 filled in \fBmnttagdesc\fR structure, as shown in the following example: 126 .sp 127 .in +2 128 .nf 129 uint_t mtd_major; /* major number for mounted fs */ 130 uint_t mtd_minor; /* minor number for mounted fs */ 131 char *mtd_mntpt; /* mount point of file system */ 132 char *mtd_tag; /* tag to set/clear */ 133 .fi 134 .in -2 135 136 If the tag already exists then it is marked as set but not re-added. Tags can 137 be at most \fBMAX_MNTOPT_TAG\fR long. 138 .sp 139 Use of this ioctl is restricted to processes with the \fB{PRIV_SYS_MOUNT}\fR 140 privilege. 141 .RE 142 143 .sp 144 .ne 2 145 .na 146 \fB\fBMNTIOC_CLRTAG\fR\fR 147 .ad 148 .RS 21n 149 Marks a tag in the options list for a mounted file system as not set. \fIarg\fR 150 points to the same structure as \fBMNTIOC_SETTAG\fR, which identifies the file 151 system and tag to be cleared. 152 .sp 153 Use of this ioctl is restricted to processes with the \fB{PRIV_SYS_MOUNT}\fR 154 privilege. 155 .RE 156 157 .SH ERRORS 158 .sp 159 .ne 2 160 .na 161 \fB\fBEFAULT\fR\fR 162 .ad 163 .RS 16n 164 The arg pointer in an \fBMNTIOC_ ioctl\fR call pointed to an inaccessible 165 memory location or a character pointer in a \fBmnttagdesc\fR structure pointed 166 to an inaccessible memory location. 167 .RE 168 169 .sp 170 .ne 2 171 .na 172 \fB\fBEINVAL\fR\fR 173 .ad 174 .RS 16n 175 The tag specified in a \fBMNTIOC_SETTAG\fR call already exists as a file system 176 option, or the tag specified in a \fBMNTIOC_CLRTAG\fR call does not exist. 177 .RE 178 179 .sp 180 .ne 2 181 .na 182 \fB\fBENAMETOOLONG\fR\fR 183 .ad 184 .RS 16n 185 The tag specified in a \fBMNTIOC_SETTAG\fR call is too long or the tag would 186 make the total length of the option string for the mounted file system too 187 long. 188 .RE 189 190 .sp 191 .ne 2 192 .na 193 \fB\fBEPERM\fR\fR 194 .ad 195 .RS 16n 196 The calling process does not have \fB{PRIV_SYS_MOUNT}\fR privilege and either a 197 \fBMNTIOC_SETTAG\fR or \fBMNTIOC_CLRTAG\fR call was made. 198 .RE 199 200 .SH FILES 201 .sp 202 .ne 2 203 .na 204 \fB\fB/etc/mnttab\fR\fR 205 .ad 206 .RS 28n 207 Usual mount point for \fBmnttab\fR file system 208 .RE 209 210 .sp 211 .ne 2 212 .na 213 \fB\fB/usr/include/sys/mntio.h\fR\fR 214 .ad 215 .RS 28n 216 Header file that contains \fBIOCTL\fR definitions 217 .RE 218 219 .SH SEE ALSO 220 .sp 221 .LP 222 \fBmkfile\fR(1M), \fBmount_cachefs\fR(1M), \fBmount_hsfs\fR(1M), 223 \fBmount_nfs\fR(1M), \fBmount_pcfs\fR(1M), \fBmount_ufs\fR(1M), 224 \fBmount\fR(1M), \fBioctl\fR(2), \fBread\fR(2), \fBpoll\fR(2), \fBstat\fR(2), 225 \fBgetmntent\fR(3C) 226 .SH WARNINGS 227 .sp 228 .LP 229 The \fBmnttab\fR file system provides the previously undocumented 230 \fBdev=\fR\fIxxx\fR option in the option string for each mounted file system. 231 This is provided for legacy applications that might have been using the 232 \fBdev=information\fR option. 233 .sp 234 .LP 235 Using \fBdev=\fR\fIoption\fR in applications is strongly discouraged. The 236 device number string represents a 32-bit quantity and might not contain correct 237 information in 64-bit environments. 238 .sp 239 .LP 240 Applications requiring device number information for mounted file systems 241 should use the \fBgetextmntent\fR(3C) interface, which functions properly in 242 either 32- or 64-bit environments. 243 .SH NOTES 244 .sp 245 .LP 246 The snapshot of the \fBmnttab\fR information is taken any time a \fBread\fR(2) 247 is performed at offset \fB0\fR (the beginning) of the \fBmnttab\fR file. The 248 file modification time returned by \fBstat\fR(2) for the \fBmnttab\fR file is 249 the time of the last change to mounted file system information. A \fBpoll\fR(2) 250 system call requesting a \fBPOLLRDBAND\fR event can be used to block and wait 251 for the system's mounted file system information to be different from the most 252 recent snapshot since the \fBmnttab\fR file was opened.