1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 04:57:44 +00:00

Base: Document new chroot abilities

This commit is contained in:
Sergey Bugaev 2020-01-12 21:54:06 +03:00 committed by Andreas Kling
parent 33c0dc08a7
commit 9513f54932
2 changed files with 12 additions and 3 deletions

View file

@ -1,6 +1,6 @@
## Name
chroot - change filesystem root
chroot, chroot_with_mount_flags - change filesystem root
## Synopsis
@ -8,12 +8,18 @@ chroot - change filesystem root
#include <unistd.h>
int chroot(const char* path);
int chroot_with_mount_flags(const char* path, int mount_flags);
```
## Description
`chroot()` changes the filesystem root of the current process to a new directory specified by `path`.
`chroot_with_mount_flags()` additionally applies the given `mount_flags` to the new root directory
of the current process as if it was a separate mount. All the same flags as for [`mount`(2)](mount.md)
are accepted, except `MS_BIND` doesn't make sense for chroots. Additionally, the value -1 is accepted,
and makes `chroot_with_mount_flags()` behave like regular `chroot()`.
## Errors
* `EPERM`: The current process does not have superuser privileges.
@ -24,3 +30,4 @@ All of the usual path resolution errors may also occur.
## See also
* [`chroot`(8)](../man8/chroot.md)
* [`mount`(2)](mount.md)