Here is an improved version, after a lot of feedback from jmc@. Quick list of changes:
* the unmount description moved closer to the top, since we mention it in flags description anyway; * list of mount options is now sorted; * the description of the MNT_RELOAD flag was added; * the descriptions of the MNT_FORCE and MNT_UPDATE flags were reworked and moved to separate paragraphs. Okay to commit? -- WBR, Vadim Zhukov Index: mount.2 =================================================================== RCS file: /cvs/src/lib/libc/sys/mount.2,v retrieving revision 1.46 diff -u -p -r1.46 mount.2 --- mount.2 27 May 2016 19:45:04 -0000 1.46 +++ mount.2 17 Jul 2016 22:13:06 -0000 @@ -70,31 +70,41 @@ at the time of a successful mount are swept under the carpet, so to speak, and are unavailable until the filesystem is unmounted. .Pp +The +.Fn unmount +function disassociates the filesystem from the specified +mount point +.Fa dir . +.Pp The following .Fa flags -may be specified to -suppress default semantics which affect filesystem access. +may be specified to change default behaviour: .Bl -tag -width MNT_SYNCHRONOUS -.It Dv MNT_RDONLY -The filesystem should be treated as read-only: -even the superuser may not write to it. +.It Dv MNT_ASYNC +All I/O to the filesystem should be done asynchronously. .It Dv MNT_NOATIME Do not update the access time on files in the filesystem unless the modification or status change times are also being updated. +.It Dv MNT_NODEV +Do not interpret special files on the filesystem. .It Dv MNT_NOEXEC Do not allow files to be executed from the filesystem. .It Dv MNT_NOSUID Do not honor setuid or setgid bits on files when executing them. -.It Dv MNT_NODEV -Do not interpret special files on the filesystem. -.It Dv MNT_SYNCHRONOUS -All I/O to the filesystem should be done synchronously. -.It Dv MNT_ASYNC -All I/O to the filesystem should be done asynchronously. +.It Dv MNT_RDONLY +The filesystem should be treated as read-only: +even the superuser may not write to it. +.It Dv MNT_RELOAD +Reload a MNT_RDONLY filesystem. +Used, for example, by +.Xr fsck 8 +after modification of on-disk structures. .It Dv MNT_SOFTDEP Use soft dependencies. Applies to FFS filesystems only (see 'softdep' in .Xr mount 8 ) . +.It Dv MNT_SYNCHRONOUS +All I/O to the filesystem should be done synchronously. .It MNT_WXALLOWED Processes that ask for memory to be made writeable plus executable using the @@ -108,10 +118,13 @@ The option is typically used on the filesystem. .El .Pp -The flag +Two more flags affect the behaviour of system calls themselves, +and not the behaviour of the corresponding filesystem: +.Pp +The .Dv MNT_UPDATE -indicates that the mount command is being applied -to an already mounted filesystem. +flag indicates that the mount command is being applied to an already +mounted filesystem. This allows the mount flags to be changed without requiring that the filesystem be unmounted and remounted. Some filesystems may not allow all flags to be changed. @@ -119,6 +132,18 @@ For example, most filesystems will not allow a change from read-write to read-only. .Pp The +.Dv MNT_FORCE +flag, if used together with +.Dv MNT_UPDATE , +allows transition from read-write to read-only, +even if there are files open for writing. +And when used on unmount, it specifies that the filesystem +should be forcibly unmounted even if files are still active; +active special devices continue to work, +but any further access to any other active files result in errors, +even if the filesystem is later remounted. +.Pp +The .Fa type argument defines the type of the filesystem. The types of filesystems known to the system are defined in @@ -237,22 +262,6 @@ struct udf_args { char *fspec; /* block special device to mount */ }; .Ed -.Pp -The -.Fn unmount -function call disassociates the filesystem from the specified -mount point -.Fa dir . -.Pp -The -.Fa flags -argument may specify -.Dv MNT_FORCE -to specify that the filesystem should be forcibly unmounted even if files are -still active. -Active special devices continue to work, -but any further accesses to any other active files result in errors -even if the filesystem is later remounted. .Sh RETURN VALUES .Rv -std .Sh ERRORS