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