Re: About /etc/mtab and /proc/mounts

Dominik Kubla
2003-02-27T09:01:51Z

On Thursday 27 February 2003 09:12, Kasper Dupont wrote:
> Dominik Kubla wrote:
> > I would recommend to replace /etc/mtab with a pseudo-FS like Sun did
> > for /etc/mnttab:
...
> How does that thing behave? I have considered a /proc/mtab implementation,
> that might be slightly similar.

Quoting the Solaris 8 man page:

File Formats mnttab(4)

NAME
mnttab - mounted file system table

DESCRIPTION
The file /etc/mnttab is really a file system that provides
read-only access to the table of mounted file systems for
the current host. /etc/mnttab is read by programs using the
routines described in getmntent(3C). Mounting a file system
adds an entry to this table. Unmounting removes an entry
from this table. Remounting a file system causes the infor-
mation in the mounted file system table to be updated to
reflect any changes caused by the remount. The list is main-
tained by the kernel in order of mount time. That is, the
first mounted file system is first in the list and the most
recently mounted file system is last. When mounted on a
mount point the file system appears as a regular file con-
taining the current mnttab information.
[...]
NOTES
The snapshot of the mnttab information is taken any time a
read(2) is performed at offset 0 (the beginning) of the
mnttab file. The file modification time returned by stat(2)
for the mnttab file is the time of the last change to
mounted file system information. A poll(2) system call
requesting a POLLRDBAND event can be used to block and wait
for the system's mounted file system information to be dif-
ferent from the most recent snapshot since the mnttab file
was opened.

Regards,
Dominik Kubla
--
"What this country needs is a short, victorious war to stem the tide of
revolution." (V.K. von Plehve, Russian Minister of Interior on the eve of
the Russo-Japanese war.)