Hello all. As found by some of my students, mount(2) lacks description of some flags used by userland. After trying to sync things out, I realized that this page is not well organized at all. For example, unmount syscall is mentioned closer to end, after description of flags that it could use.
I didn't document all of the flags involved in mount calls, since some of them are purely kernel internal. But I could easily miss something crucial... So this is my first public draft of mount(2) patch. Looking for comments & thanks in advance! -- 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 9 Jul 2016 15:16:29 -0000 @@ -70,31 +70,57 @@ 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 call 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. .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_FORCE +On unmount, specifies 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. +On update, allows to forcibly change from read-write to read-only, +even if there are files open for writing. .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 already mounted filesystem. +Used, e.g., by +.Xr fsck 8 . .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 Dv MNT_UPDATE +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. +For example, +most filesystems will not allow a change from read-write to read-only. .It MNT_WXALLOWED Processes that ask for memory to be made writeable plus executable using the @@ -108,16 +134,6 @@ The option is typically used on the filesystem. .El .Pp -The flag -.Dv MNT_UPDATE -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. -For example, -most filesystems will not allow a change from read-write to read-only. -.Pp The .Fa type argument defines the type of the filesystem. @@ -237,22 +253,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