Pike v8.1 release 6

Method System.chroot()


Method chroot

int chroot(string newroot)
int chroot(Stdio.File newroot)

Description

Changes the root directory for this process to the indicated directory.

Returns

A nonzero value is returned if the call is successful. If there's an error then zero is returned and errno is set appropriately.

Note

Since this function modifies the directory structure as seen from Pike, you have to modify the environment variables PIKE_MODULE_PATH and PIKE_INCLUDE_PATH to compensate for the new root-directory.

This function only exists on systems that have the chroot(2) system call.

The second variant only works on systems that also have the fchroot(2) system call.

Note

On success the current working directory will be changed to the new "/". This behavior was added in Pike 7.9.

Note

This function could be interrupted by signals prior to Pike 7.9.