1 MNTTAB(4)                        File Formats                        MNTTAB(4)
   2 
   3 
   4 
   5 NAME
   6        mnttab - mounted file system table
   7 
   8 DESCRIPTION
   9        The file /etc/mnttab is really a file system that provides read-only
  10        access to the table of mounted file systems for the current host.
  11        /etc/mnttab is read by programs using the routines described in
  12        getmntent(3C). Mounting a file system adds an entry to this table.
  13        Unmounting removes an entry from this table. Remounting a file system
  14        causes the information in the mounted file system table to be updated
  15        to reflect any changes caused by the remount. The list is maintained by
  16        the kernel in order of mount time. That is, the first mounted file
  17        system is first in the list and the most recently mounted file system
  18        is last. When mounted on a mount point the file system appears as a
  19        regular file containing the current mnttab information.
  20 
  21 
  22        Each entry is a line of fields separated by TABs in the form:
  23 
  24          special   mount_point   fstype   options   time
  25 
  26 
  27 
  28        where:
  29 
  30        special
  31                       The name of the resource that has been mounted.
  32 
  33 
  34        mount_point
  35                       The pathname of the directory on which the filesystem is
  36                       mounted.
  37 
  38 
  39        fstype
  40                       The file system type of the mounted file system.
  41 
  42 
  43        options
  44                       The mount options. See respective mount file system man
  45                       page in the See Also section below.
  46 
  47 
  48        time
  49                       The time at which the file system was mounted.
  50 
  51 
  52 
  53        Examples of entries for the special field include the pathname of a
  54        block-special device, the name of a remote file system in the form of
  55        host:pathname, or the name of a swap file, for example, a file made
  56        with mkfile(1M).
  57 
  58 IOCTLS
  59        The following ioctl(2) calls are supported:
  60 
  61        MNTIOC_NMNTS
  62                             Returns the count of mounted resources in the
  63                             current snapshot in the uint32_t pointed to by
  64                             arg.
  65 
  66 
  67        MNTIOC_GETDEVLIST
  68                             Returns an array of uint32_t's that is twice as
  69                             long as the length returned by MNTIOC_NMNTS. Each
  70                             pair of numbers is the major and minor device
  71                             number for the file system at the corresponding
  72                             line in the current /etc/mnttab snapshot. arg
  73                             points to the memory buffer to receive the device
  74                             number information.
  75 
  76 
  77        MNTIOC_SETTAG
  78                             Sets a tag word into the options list for a
  79                             mounted file system. A tag is a notation that will
  80                             appear in the options string of a mounted file
  81                             system but it is not recognized or interpreted by
  82                             the file system code. arg points to a filled in
  83                             mnttagdesc structure, as shown in the following
  84                             example:
  85 
  86                               uint_t  mtd_major;  /* major number for mounted fs */
  87                               uint_t  mtd_minor;  /* minor number for mounted fs */
  88                               char    *mtd_mntpt; /* mount point of file system */
  89                               char    *mtd_tag;   /* tag to set/clear */
  90 
  91                             If the tag already exists then it is marked as set
  92                             but not re-added. Tags can be at most
  93                             MAX_MNTOPT_TAG long.
  94 
  95                             Use of this ioctl is restricted to processes with
  96                             the {PRIV_SYS_MOUNT} privilege.
  97 
  98 
  99        MNTIOC_CLRTAG
 100                             Marks a tag in the options list for a mounted file
 101                             system as not set. arg points to the same
 102                             structure as MNTIOC_SETTAG, which identifies the
 103                             file system and tag to be cleared.
 104 
 105                             Use of this ioctl is restricted to processes with
 106                             the {PRIV_SYS_MOUNT} privilege.
 107 
 108 
 109 ERRORS
 110        EFAULT
 111                        The arg pointer in an MNTIOC_ ioctl call pointed to an
 112                        inaccessible memory location or a character pointer in
 113                        a mnttagdesc structure pointed to an inaccessible
 114                        memory location.
 115 
 116 
 117        EINVAL
 118                        The tag specified in a MNTIOC_SETTAG call already
 119                        exists as a file system option, or the tag specified in
 120                        a MNTIOC_CLRTAG call does not exist.
 121 
 122 
 123        ENAMETOOLONG
 124                        The tag specified in a MNTIOC_SETTAG call is too long
 125                        or the tag would make the total length of the option
 126                        string for the mounted file system too long.
 127 
 128 
 129        EPERM
 130                        The calling process does not have {PRIV_SYS_MOUNT}
 131                        privilege and either a MNTIOC_SETTAG or MNTIOC_CLRTAG
 132                        call was made.
 133 
 134 
 135 FILES
 136        /etc/mnttab
 137                                    Usual mount point for mnttab file system
 138 
 139 
 140        /usr/include/sys/mntio.h
 141                                    Header file that contains IOCTL definitions
 142 
 143 
 144 SEE ALSO
 145        mkfile(1M), mount_hsfs(1M), mount_nfs(1M), mount_pcfs(1M),
 146        mount_ufs(1M), mount(1M), ioctl(2), read(2), poll(2), stat(2),
 147        getmntent(3C)
 148 
 149 WARNINGS
 150        The mnttab file system provides the previously undocumented dev=xxx
 151        option in the option string for each mounted file system.  This is
 152        provided for legacy applications that might have been using the
 153        dev=information option.
 154 
 155 
 156        Using dev=option in applications is strongly discouraged. The device
 157        number string represents a 32-bit quantity and might not contain
 158        correct information in 64-bit environments.
 159 
 160 
 161        Applications requiring device number information for mounted file
 162        systems should use the getextmntent(3C) interface, which functions
 163        properly in either 32- or 64-bit environments.
 164 
 165 NOTES
 166        The snapshot of the mnttab information is taken any time a read(2) is
 167        performed at offset 0 (the beginning) of the mnttab file. The file
 168        modification time returned by stat(2) for the mnttab file is the time
 169        of the last change to mounted file system information. A poll(2) system
 170        call requesting a POLLRDBAND event can be used to block and wait for
 171        the system's mounted file system information to be different from the
 172        most recent snapshot since the mnttab file was opened.
 173 
 174 
 175 
 176                                September 8, 2015                     MNTTAB(4)