summaryrefslogtreecommitdiff
path: root/Base/usr
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2020-01-10 23:23:20 +0100
committerAndreas Kling <awesomekling@gmail.com>2020-01-10 23:23:20 +0100
commit3f9e4cd24e89c13018947fc967d1801b17c0ec3f (patch)
treee7e18c3768a0aefc6ac717e26a4394e459ac1c88 /Base/usr
parentddd0b192819b3d782682a47e463dc30ee29c739e (diff)
downloadserenity-3f9e4cd24e89c13018947fc967d1801b17c0ec3f.zip
chroot: Add a little chroot program
This program changes the current filesystem root and spawns a shell.
Diffstat (limited to 'Base/usr')
-rw-r--r--Base/usr/share/man/man2/chroot.md26
-rw-r--r--Base/usr/share/man/man8/chroot.md28
2 files changed, 54 insertions, 0 deletions
diff --git a/Base/usr/share/man/man2/chroot.md b/Base/usr/share/man/man2/chroot.md
new file mode 100644
index 0000000000..472b3ce601
--- /dev/null
+++ b/Base/usr/share/man/man2/chroot.md
@@ -0,0 +1,26 @@
+## Name
+
+chroot - change filesystem root
+
+## Synopsis
+
+```**c++
+#include <unistd.h>
+
+int chroot(const char* path);
+```
+
+## Description
+
+`chroot()` changes the filesystem root of the current process to a new directory specified by `path`.
+
+## Errors
+
+* `EPERM`: The current process does not have superuser privileges.
+* `EFAULT`: `path` is not in readable memory.
+
+All of the usual path resolution errors may also occur.
+
+## See also
+
+* [`chroot`(8)](../man8/chroot.md)
diff --git a/Base/usr/share/man/man8/chroot.md b/Base/usr/share/man/man8/chroot.md
new file mode 100644
index 0000000000..62f70ccdcf
--- /dev/null
+++ b/Base/usr/share/man/man8/chroot.md
@@ -0,0 +1,28 @@
+## Name
+
+chroot - run a shell with a different filesystem root
+
+## Synopsis
+
+```**sh
+# chroot
+```
+
+## Description
+
+This program uses the [`chroot`(2)](../man2/chroot.md) syscall to switch into a
+different filesystem root and spawn a shell inside it.
+
+It will not work unless there is a `/bin/Shell` available inside the new root.
+
+## Examples
+
+```sh
+# chroot /var/chroot
+# pwd
+/
+```
+
+## See also
+
+* [`chroot`(2)](../man2/chroot.md)