From 3f9e4cd24e89c13018947fc967d1801b17c0ec3f Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Fri, 10 Jan 2020 23:23:20 +0100 Subject: chroot: Add a little chroot program This program changes the current filesystem root and spawns a shell. --- Base/usr/share/man/man2/chroot.md | 26 ++++++++++++++++++++++++++ Base/usr/share/man/man8/chroot.md | 28 ++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 Base/usr/share/man/man2/chroot.md create mode 100644 Base/usr/share/man/man8/chroot.md (limited to 'Base/usr') 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 + +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) -- cgit v1.2.3