summaryrefslogtreecommitdiff
path: root/Base/usr/share
diff options
context:
space:
mode:
authorSergey Bugaev <bugaevc@gmail.com>2020-01-11 19:54:48 +0300
committerAndreas Kling <awesomekling@gmail.com>2020-01-11 18:57:53 +0100
commitb37bd280533fe9975ed73f618ae9d157cafcf640 (patch)
treeb27625a4052e6acc4d0c7e96c8c7ec12bd44cbb8 /Base/usr/share
parent0cb0f54783aa9d0880e2b85edc9540d4331feb91 (diff)
downloadserenity-b37bd280533fe9975ed73f618ae9d157cafcf640.zip
Base: Document mount(2) and mount(8)
Diffstat (limited to 'Base/usr/share')
-rw-r--r--Base/usr/share/man/man2/mount.md53
-rw-r--r--Base/usr/share/man/man8/mount.md42
2 files changed, 95 insertions, 0 deletions
diff --git a/Base/usr/share/man/man2/mount.md b/Base/usr/share/man/man2/mount.md
new file mode 100644
index 0000000000..1d54e6be2c
--- /dev/null
+++ b/Base/usr/share/man/man2/mount.md
@@ -0,0 +1,53 @@
+## Name
+
+mount - mount a filesystem
+
+## Synopsis
+
+```**c++
+#include <unistd.h>
+
+int mount(const char* source, const char* target, const char* fs_type, int flags);
+```
+
+## Description
+
+`mount()` mounts a filesystem stored at `source` by overlaying its contents over `target`.
+
+`fs_type` must be one of the following supported filesystems:
+
+* `Ext2FS` (or `ext2`): The ext2 filesystem.
+* `ProcFS` (or `proc`): The process pseudo-filesystem (normally mounted at `/proc`).
+* `DevPtsFS` (or `devpts`): The pseudoterminal pseudo-filesystem (normally mounted at `/dev/pts`).
+* `TmpFS` (or `tmp`): A non-persistent filesystem that stores all its data in RAM. An instance of this filesystem is normally mounted at `/tmp`.
+
+For Ext2FS, `source` must be a path to a block device storing the filesystem contents. All
+the other filesystems ignore the `source` argument (by convention, it should have the same
+value as `fs_type`).
+
+The following `flags` are supported:
+
+* `MS_NODEV`: Disallow opening any devices from this file system.
+* `MS_NOEXEC`: Disallow executing any executables from this file system.
+* `MS_NOSUID`: Ignore set-user-id bits on executables from this file system.
+* `MS_BIND`: Perform a bind-mount (see below).
+
+These flags can be used as a security measure to limit the possible abuses of the newly
+mounted file system.
+
+### Bind mounts
+
+If `MS_BIND` is specified in `flags`, `fs_type` is ignored and a bind mount is performed
+instead. In this case `source` is treated as a path to a file or directory whose contents
+are overlayed over `target`. This can be used as an alternative to symlinks or hardlinks.
+
+## Errors
+
+* `EPERM`: The current process does not have superuser privileges.
+* `ENODEV`: The `fs_type` is unrecognized, or the device is not found, or the device doesn't contain a valid filesystem image.
+
+All of the usual path resolution errors may also occur.
+
+## See also
+
+* [`mount`(8)](../man8/mount.md)
diff --git a/Base/usr/share/man/man8/mount.md b/Base/usr/share/man/man8/mount.md
new file mode 100644
index 0000000000..7f0b9c2c4b
--- /dev/null
+++ b/Base/usr/share/man/man8/mount.md
@@ -0,0 +1,42 @@
+## Name
+
+mount - mount a filesystem
+
+## Synopsis
+
+```**sh
+$ mount
+# mount -a
+# mount <source> <target> [-t fstype] [-o options]
+```
+
+## Description
+
+If invoked without any arguments, `mount` prints a list of all currently mounted filesystems.
+
+If invoked as `mount -a`, `mount` mounts all the filesystems configured in `/etc/fstab`. This
+is normally done on system startup by [`SystemServer`(7)](../man7/SystemServer.md).
+
+Otherwise, `mount` performs a single filesystem mount. Source, target, and fstype have the
+same meaning as in the [`mount`(2)](../man2/mount.md) syscall (if not specified, fstype
+defaults to `ext2`).
+
+Options correspond to the mount flags, and should be specified as a comma-separated list of
+flag names (lowercase and without the `MS_` prefix). Additionally, the name `defaults` is
+accepted and ignored.
+
+## Files
+
+* `/etc/fstab` - read by `mount -a` on startup to find out which filesystems to mount.
+* `/proc/df` - read by `mount` to get information about mounted filesystems.
+
+## Examples
+
+```sh
+# mount devpts /dev/pts -t devpts -o noexec,nosuid
+# mount /home/anon/myfile.txt /tmp/foo -o bind
+```
+
+## See also
+
+* [`mount`(2)](../man2/mount.md)